[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/imote2/test/Testuart
Testuart.nc, 1.1, 1.2 TestuartM.nc, 1.1, 1.2
Lama Nachman
lnachman at users.sourceforge.net
Sun Mar 4 22:20:55 PST 2007
Update of /cvsroot/tinyos/tinyos-1.x/contrib/imote2/test/Testuart
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv6665/Testuart
Modified Files:
Testuart.nc TestuartM.nc
Log Message:
Pushed out internal tree
Index: Testuart.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/imote2/test/Testuart/Testuart.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Testuart.nc 1 Feb 2005 04:08:31 -0000 1.1
--- Testuart.nc 5 Mar 2007 06:20:52 -0000 1.2
***************
*** 41,54 ****
implementation {
components Main,
! TestuartM,
! TimerC,
! LedsC,
! HPLUARTC;
Main.StdControl -> TimerC.StdControl;
! Main.StdControl -> TestuartM.StdControl;
! TestuartM.Timer -> TimerC.Timer[unique("Timer")];
! TestuartM.Leds -> LedsC;
! TestuartM.UART -> HPLUARTC;
}
--- 41,55 ----
implementation {
components Main,
! TestuartM as app,
! TimerC,
! LedsC,
! BufferedFFUARTC as BulkUART;
Main.StdControl -> TimerC.StdControl;
! Main.StdControl -> app.StdControl;
! Main.StdControl -> BulkUART;
! app.Timer -> TimerC.Timer[unique("Timer")];
! app.Leds -> LedsC;
! app.BulkUARTSend -> BulkUART;
}
Index: TestuartM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/imote2/test/Testuart/TestuartM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TestuartM.nc 1 Feb 2005 04:08:31 -0000 1.1
--- TestuartM.nc 5 Mar 2007 06:20:52 -0000 1.2
***************
*** 41,49 ****
interface Timer;
interface Leds;
! interface HPLUART as UART;
}
}
implementation {
!
/**
* Initialize the component.
--- 41,54 ----
interface Timer;
interface Leds;
! interface SendDataAlloc as BulkUARTSend;
}
}
implementation {
! #include "assert.h"
!
! #define BYTES_TO_SEND (130)
! int16_t *gDataBuffer;
! bool freeToSend = TRUE;
!
/**
* Initialize the component.
***************
*** 53,57 ****
command result_t StdControl.init() {
call Leds.init();
- call UART.init();
return SUCCESS;
}
--- 58,61 ----
***************
*** 65,69 ****
command result_t StdControl.start() {
// Start a repeating timer that fires every 1000ms
! return call Timer.start(TIMER_REPEAT, 1000);
}
--- 69,77 ----
command result_t StdControl.start() {
// Start a repeating timer that fires every 1000ms
!
! gDataBuffer = (int16_t *)call BulkUARTSend.alloc(BYTES_TO_SEND);
! assert(gDataBuffer);
!
! return call Timer.start(TIMER_REPEAT, 25);
}
***************
*** 86,103 ****
event result_t Timer.fired()
{
call Leds.redToggle();
- //call UART.put('a');
return SUCCESS;
}
! async event result_t UART.get(uint8_t data){
! call UART.put(data);
! //call Leds.greenToggle();
! return SUCCESS;
}
- async event result_t UART.putDone(){
- return SUCCESS;
- }
}
--- 94,125 ----
event result_t Timer.fired()
{
+ //fill buffer
+ static int currentVal=0;
+ int i;
+ if(freeToSend){
+ for(i=0; i<BYTES_TO_SEND/2; i++){
+ gDataBuffer[i] = currentVal++;
+ }
+ freeToSend = FALSE;
+ call BulkUARTSend.send((uint8_t *)gDataBuffer,BYTES_TO_SEND);
+ }
call Leds.redToggle();
return SUCCESS;
}
! event result_t BulkUARTSend.sendDone(uint8_t* packet, uint32_t numBytes, result_t success){
!
! assert(packet == (uint8_t *)gDataBuffer);
!
! if(success == SUCCESS){
! freeToSend = TRUE;
! }
! else{
! trace(DBG_USR1,"BulkUARTSend.sendDone failed!\r\n");
! }
!
! return success;
}
}
More information about the Tinyos-contrib-commits
mailing list