Subversion Repositories Code-Repo

Rev

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

Rev 114 Rev 115
Line 14... Line 14...
14
    i2c_pdata = data;
14
    i2c_pdata = data;
15
    i2c_pdata->buffer = i2c_buffer;
15
    i2c_pdata->buffer = i2c_buffer;
16
    i2c_pdata->buflen = 0;
16
    i2c_pdata->buflen = 0;
17
    i2c_pdata->slave_event_count = 0;
17
    i2c_pdata->slave_event_count = 0;
18
    i2c_pdata->status = I2C_IDLE;
18
    i2c_pdata->status = I2C_IDLE;
19
    i2c_pdata->slave_error_count = 0;
19
    i2c_pdata->slave_error_code = 0;
20
    i2c_pdata->bufind = 0;
20
    i2c_pdata->bufind = 0;
21
    i2c_pdata->buflen = 0;
-
 
22
    i2c_pdata->slave_in_last_byte = 0;
21
    i2c_pdata->slave_in_last_byte = 0;
23
    i2c_pdata->slave_sending_data = 0;
22
    i2c_pdata->slave_sending_data = 0;
24
    i2c_pdata->slave_sending_blank_data = 0;
23
    i2c_pdata->slave_sending_blank_data = 0;
25
    i2c_pdata->mode = 0;
24
    i2c_pdata->mode = 0;
26
    i2c_pdata->master_dest_addr = 0;
25
    i2c_pdata->master_dest_addr = 0;
Line 320... Line 319...
320
                // If we arnt current in the middle of sending data, check to see
319
                // If we arnt current in the middle of sending data, check to see
321
                //  if there is a message in the queue to send
320
                //  if there is a message in the queue to send
322
                if (!i2c_pdata->slave_sending_data) {
321
                if (!i2c_pdata->slave_sending_data) {
323
                    // Check the message type of the next message in queue
322
                    // Check the message type of the next message in queue
324
                    msgtype = MQ_peek_FromMainToHigh();
323
                    msgtype = MQ_peek_FromMainToHigh();
325
                    if (msgtype != MSGTYPE_I2C_REPLY || msgtype == 0) {
324
                    if (msgtype != MSGTYPE_I2C_REPLY) {
326
                        // If the message queue is empty or to another interrupt processor, return 0xFF
325
                        // If the message queue is empty or to another interrupt processor, return 0xFF
327
                        DBG_PRINT_I2C("I2C: Returning 0xFF [%d:%d]\r\n", 0, i2c_pdata->slave_in_last_byte-1);
326
                        DBG_PRINT_I2C("I2C: Returning 0xFF [%d:%d]\r\n", 0, i2c_pdata->slave_in_last_byte-1);
328
                        SSPBUF = 0xFF;
327
                        SSPBUF = 0xFF;
329
                        i2c_pdata->bufind = 1;
328
                        i2c_pdata->bufind = 1;
330
                        i2c_pdata->slave_sending_data = 1;
329
                        i2c_pdata->slave_sending_data = 1;