Subversion Repositories NaviCtrl

Rev

Rev 252 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 252 Rev 326
Line 260... Line 260...
260
                                        case I2C_MODE_RECEIVER:
260
                                        case I2C_MODE_RECEIVER:
261
                                                if (I2C_RxBufferSize == 0) // nothing to send?
261
                                                if (I2C_RxBufferSize == 0) // nothing to send?
262
                                                {
262
                                                {
263
                                                        I2C_GenerateSTOP (I2C1, ENABLE);
263
                                                        I2C_GenerateSTOP (I2C1, ENABLE);
264
                                                        VIC_ITCmd(I2C1_ITLine, DISABLE);
264
                                                        VIC_ITCmd(I2C1_ITLine, DISABLE);
265
                                                        LED_GRN_OFF;
265
//                                                      LED_GRN_OFF;
266
                                                        I2C_State = I2C_STATE_IDLE;
266
                                                        I2C_State = I2C_STATE_IDLE;
267
                                                        I2C_Error = I2C_ERROR_NONE;
267
                                                        I2C_Error = I2C_ERROR_NONE;
268
                                                        return;
268
                                                        return;
269
                                                }
269
                                                }
270
                                                else
270
                                                else
Line 339... Line 339...
339
                                        }
339
                                        }
340
                                        else
340
                                        else
341
                                        {   // stop communication
341
                                        {   // stop communication
342
                                                I2C_GenerateSTOP(I2C1, ENABLE); // generate stop condition to free the bus
342
                                                I2C_GenerateSTOP(I2C1, ENABLE); // generate stop condition to free the bus
343
                                                VIC_ITCmd(I2C1_ITLine, DISABLE);
343
                                                VIC_ITCmd(I2C1_ITLine, DISABLE);
344
                                                LED_GRN_OFF;
344
//                                              LED_GRN_OFF;
345
                                                I2C_State = I2C_STATE_IDLE;                     // ready for new actions
345
                                                I2C_State = I2C_STATE_IDLE;                     // ready for new actions
346
                                                I2C_Error = I2C_ERROR_NONE;    
346
                                                I2C_Error = I2C_ERROR_NONE;    
347
                                        }
347
                                        }
348
                                }
348
                                }
349
                                break;
349
                                break;
Line 363... Line 363...
363
                                        // call the rx handler function to process recieved data
363
                                        // call the rx handler function to process recieved data
364
                                        if(I2C_pRxHandler != NULL) (*I2C_pRxHandler)((u8*)I2C_Buffer, I2C_RxBufferSize);
364
                                        if(I2C_pRxHandler != NULL) (*I2C_pRxHandler)((u8*)I2C_Buffer, I2C_RxBufferSize);
365
                                        I2C1_Timeout = SetDelay(I2C1_TIMEOUT);
365
                                        I2C1_Timeout = SetDelay(I2C1_TIMEOUT);
366
                                        DebugOut.Analog[15]++;
366
                                        DebugOut.Analog[15]++;
367
                                        VIC_ITCmd(I2C1_ITLine, DISABLE);
367
                                        VIC_ITCmd(I2C1_ITLine, DISABLE);
368
                                        LED_GRN_OFF;
368
//                                      LED_GRN_OFF;
369
                                        I2C_State = I2C_STATE_IDLE;
369
                                        I2C_State = I2C_STATE_IDLE;
370
                                        I2C_Error = I2C_ERROR_NONE;
370
                                        I2C_Error = I2C_ERROR_NONE;
371
                                        return;
371
                                        return;
372
                                }
372
                                }
373
                                Rx_Idx++;
373
                                Rx_Idx++;