Hi, I would like to know is what is the problem with the code, I can't get my
camera works which interfaced with the micaz.
mfile:
// ===========
module UART0M {
uses interface Boot;
uses interface Timer<TMilli> as Timer0;
uses interface Leds;
uses interface StdControl as Uart0TxCtrl;
uses interface StdControl as Uart0RxCtrl;
uses interface HplAtm128Uart as Uart0;
}
implementation {
uint8_t init_buf[]={0xFF,0xFF,0xFF,0x01,0x01,0x87,0x01,0x07};
uint8_t sync_buf[]={0xFF,0xFF,0xFF,0x0D,0x00,0x00,0x00,0x00};
uint8_t qua_buf []={0xFF,0xFF,0xFF,0x10,0x00,0x00,0x00,0x00};
uint8_t testbuf []={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07};
uint8_t rxbuf[];
int counter=0;
event void Boot.booted() {
call Uart0TxCtrl.start();
call Uart0RxCtrl.start();
call Uart0.enableTxIntr();
call Uart0.enableRxIntr();
call Timer0.startPeriodic( 3000 );
}
*/
event void Timer0.fired() {
call Uart0.tx(testbuf[0]);
call Leds.led2Toggle();
}
async event void Uart0.txDone() {
counter+=1;
atomic{
if(counter<=7){
call Uart0.tx(testbuf[counter]);
}
else counter=0;
call Leds.led1Toggle();
} //end atomic
}
async event void Uart0.rxDone(uint8_t data) {
int rx_count=0;
call Leds.led0Toggle();
/*
if (rx_count<=7){
if(rx_count==0){
rxbuf[rx_count]=data;
rx_count++;
}
else if(rx_count==0 && data==0xFF){
rxbuf[rx_count]=data;
rx_count++;
}
else if(rx_count==1 && data==0xFF){
rxbuf[rx_count]=data;
rx_count++;
}
else if(rx_count==2 && data==0xFF){
rxbuf[rx_count]=data;
rx_count++;
}
else if(rx_count==3){
rxbuf[rx_count]=data;
rx_count++;
}
else if(rx_count==4){
rxbuf[rx_count]=data;
rx_count++;
}
else if(rx_count==5){
rxbuf[rx_count]=data;
rx_count++;
}
else if(rx_count==6){
rxbuf[rx_count]=data;
rx_count++;
}
else if(rx_count==7){
rxbuf[rx_count]=data;
rx_count++;
}
} //if
else {rx_count=0;
call Leds.led0Toggle(); }
*/
} //rxDone
}
//==========
cfile:
configuration UART0C {
}
implementation {
components MainC, UART0M, LedsC, HplAtm128UartC;
components new TimerMilliC() as Timer0;
UART0M -> MainC.Boot;
UART0M.Timer0 -> Timer0;
UART0M.Leds -> LedsC;
UART0M.Uart0TxCtrl -> HplAtm128UartC.Uart0TxControl;
UART0M.Uart0RxCtrl -> HplAtm128UartC.Uart0RxControl;
UART0M.Uart0 -> HplAtm128UartC.HplUart0;
}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help