[tuxdroid-svn] r1122 - firmware/tuxaudio/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2008-05-06 15:54:17
|
Author: jaguarondi Date: 2008-05-06 17:54:05 +0200 (Tue, 06 May 2008) New Revision: 1122 Modified: firmware/tuxaudio/trunk/communication.c firmware/tuxaudio/trunk/communication.h Log: * I2C read was dropped if tuxcore nacked the request. Now the flag is only cleared when an empty command has been received. All pong are now received. Modified: firmware/tuxaudio/trunk/communication.c =================================================================== --- firmware/tuxaudio/trunk/communication.c 2008-05-06 15:43:40 UTC (rev 1121) +++ firmware/tuxaudio/trunk/communication.c 2008-05-06 15:54:05 UTC (rev 1122) @@ -118,9 +118,9 @@ return 2; } else - nack_cnt = 0; /* Send something else. */ { + nack_cnt = 0; if (FifoLength(core_cmdout)) /* Send commands received from RF or testers to tuxcore only. */ { @@ -142,11 +142,10 @@ return 1; } -void getStatus(void) +void get_core_cmd(void) { if (i2c_get_status() != I2C_BUSY) { - statusFlag = 0; msg_in.addr = TUXCORE_ADDR; msg_in.len = CMD_SIZE; i2c_read_bytes(&msg_in); @@ -218,12 +217,15 @@ */ void i2cMasterReceiveService(uint8_t receiveDataLength, uint8_t * receiveData) { - if (*receiveData == 0) - /* Nothing to get. */ - return; if (receiveDataLength != CMD_SIZE) /* Error here. */ return; + if (*receiveData == 0) + { + /* Got nothing so stop reading. */ + statusFlag = 0; + return; + } if (msg_in.addr == TUXCORE_ADDR) /* From tuxcore */ { @@ -268,6 +270,6 @@ if (!sendCommands()) { if (statusFlag) - getStatus(); + get_core_cmd(); } } Modified: firmware/tuxaudio/trunk/communication.h =================================================================== --- firmware/tuxaudio/trunk/communication.h 2008-05-06 15:43:40 UTC (rev 1121) +++ firmware/tuxaudio/trunk/communication.h 2008-05-06 15:54:05 UTC (rev 1122) @@ -63,7 +63,7 @@ void send_status_p(uint8_t cmd, uint8_t param1, uint8_t param2, \ uint8_t param3); uint8_t popStatus(uint8_t * command); -void getStatus(void); +void get_core_cmd(void); void core_communications(bool tick); #endif /* COMMUNICATION_H */ |