[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/SharedUSART/apps/TestUSART
TestUSARTM.nc, 1.1.1.1, 1.2
Chris Pettus
cepett01 at users.sourceforge.net
Thu Aug 24 08:52:16 PDT 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/SharedUSART/apps/TestUSART
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv17078/TestUSART
Modified Files:
TestUSARTM.nc
Log Message:
Added check to the radio sendDone event success result. In previous version if the send failed the message was just lost. Also added some debug LED information, if the green LED is lit then USART0 is in UART mode.
Index: TestUSARTM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/SharedUSART/apps/TestUSART/TestUSARTM.nc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** TestUSARTM.nc 15 Dec 2005 22:40:29 -0000 1.1.1.1
--- TestUSARTM.nc 24 Aug 2006 15:52:14 -0000 1.2
***************
*** 66,71 ****
// START Variables, structures and arrays used by the Radio communications
TOS_Msg msg[4]; // Must be a power of 2. Outgoing radio messages
! uint8_t currentSendMsg; // Current radio message index, outgoing messages
! uint8_t lastSendMsg; // Last radio message index, outgoing messages
TOS_MsgPtr cur_msg; // The current command message received
--- 66,71 ----
// START Variables, structures and arrays used by the Radio communications
TOS_Msg msg[4]; // Must be a power of 2. Outgoing radio messages
! uint8_t currentSendMsg = 0; // Current radio message index, outgoing messages
! uint8_t lastSendMsg = 0; // Last radio message index, outgoing messages
TOS_MsgPtr cur_msg; // The current command message received
***************
*** 143,146 ****
--- 143,147 ----
task void switchToRadio() {
call SerialCommControl.stop(); // Stop the serial device and switch to SPI mode
+ call Leds.greenOff(); // turn off the led used for UART mode indication
call BusArbitration.releaseBus(); // Release the USART bus from serial control
***************
*** 162,165 ****
--- 163,167 ----
if (call BusArbitration.getBus() == SUCCESS) {
call SerialCommControl.init(); // Reconfigure the USART for the serial device.
+ call Leds.greenOn(); // turn on the led used for UART mode indication
atomic {
statusFlags &= ~pendingUARTBus; // UART has bus, remove the pending flag
***************
*** 188,195 ****
if (call RadioSend.send(TOS_BCAST_ADDR, sizeof(struct ConsoleMsg),
&msg[currentSendMsg & 0x03])) {
! atomic {
// If message was succesfully queued for sending move index to next message
! currentSendMsg++;
! }
}
// If the send command failed post the task again
--- 190,197 ----
if (call RadioSend.send(TOS_BCAST_ADDR, sizeof(struct ConsoleMsg),
&msg[currentSendMsg & 0x03])) {
! //atomic {
// If message was succesfully queued for sending move index to next message
! //currentSendMsg++;
! //}
}
// If the send command failed post the task again
***************
*** 454,460 ****
*/
event result_t RadioSend.sendDone(TOS_MsgPtr sent, result_t success) {
!
// This if statement may not be necessary since the interface is paramterized
if (sent->type == AM_CONSOLEMSG) {
// Check if there are more messages for the radio
if ((currentSendMsg & 0x03) != (lastSendMsg & 0x03)) post sendRadioPacket();
--- 456,469 ----
*/
event result_t RadioSend.sendDone(TOS_MsgPtr sent, result_t success) {
!
// This if statement may not be necessary since the interface is paramterized
if (sent->type == AM_CONSOLEMSG) {
+ if (success == SUCCESS) {
+ // if the send was successful, move current msg index
+ currentSendMsg++;
+ //call Leds.yellowToggle(); // uncomment to use for debugging
+ } else {
+ //call Leds.redToggle(); // uncomment to use for debugging
+ }
// Check if there are more messages for the radio
if ((currentSendMsg & 0x03) != (lastSendMsg & 0x03)) post sendRadioPacket();
More information about the Tinyos-contrib-commits
mailing list