Subversion Repositories Code-Repo

Rev

Rev 121 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 121 Rev 122
Line 324... Line 324...
324
    unsigned char data_written_to_buffer = 0;
324
    unsigned char data_written_to_buffer = 0;
325
    unsigned char overrun_error = 0;
325
    unsigned char overrun_error = 0;
326
 
326
 
327
    // Clear SSPOV (overflow bit)
327
    // Clear SSPOV (overflow bit)
328
    if (SSPCON1bits.SSPOV == 1) {
328
    if (SSPCON1bits.SSPOV == 1) {
329
        DBG_PRINT_I2C("I2C: overflow detected\r\n");
329
        DBG_PRINT_I2C("I2C: (ERROR) overflow detected\r\n");
330
        SSPCON1bits.SSPOV = 0;
330
        SSPCON1bits.SSPOV = 0;
331
        // We failed to read the buffer in time, so we know we
331
        // We failed to read the buffer in time, so we know we
332
        //  can't properly receive this message, just put us in the
332
        //  can't properly receive this message, just put us in the
333
        //  a state where we are looking for a new message
333
        //  a state where we are looking for a new message
334
        i2c_data.operating_state = I2C_IDLE;
334
        i2c_data.operating_state = I2C_IDLE;
Line 337... Line 337...
337
    }
337
    }
338
 
338
 
339
    // Read SPPxBUF if it is full
339
    // Read SPPxBUF if it is full
340
    if (SSPSTATbits.BF == 1) {
340
    if (SSPSTATbits.BF == 1) {
341
        received_data = SSPBUF;
341
        received_data = SSPBUF;
342
        DBG_PRINT_I2C("I2C: data read from buffer: %x\r\n", SSPBUF);
342
//        DBG_PRINT_I2C("I2C: data read from buffer: %x\r\n", SSPBUF);
343
        data_read_from_buffer = 1;
343
        data_read_from_buffer = 1;
344
    }
344
    }
345
 
345
 
346
    if (!overrun_error) {
346
    if (!overrun_error) {
347
        switch (i2c_data.operating_state) {
347
        switch (i2c_data.operating_state) {