I have written a module for receiving the TOSMsg
but i could not receive the msg.
what i have to do.
the module is given below
//includes sensorboardApp;
includes AM;
includes mouse;
module MouseM {
provides {
interface StdControl;
}
uses {
interface StdControl as Control;
interface Leds;
interface ReceiveMsg;
}
}
implementation {
includes AM;
includes mouse;
module MouseM {
provides {
interface StdControl;
}
uses {
interface StdControl as Control;
interface Leds;
interface ReceiveMsg;
}
}
implementation {
TOS_MsgPtr buffer,r;
MOUSE_MSG *msg;
uint8_t length,i;
command result_t StdControl.init()
{
call Leds.init();
outp(0X01,UBRR0H);
outp(0X74,UBRR0L);
outp(((0<<FE0)|(0<<DOR0)|(0<<U2X)),UCSR0A);
outp(((0<<UPM01)|(0<<UPM00)|(1<<USBS0)|(1 << UCSZ1) | (0 << UCSZ0)) , UCSR0C);
outp(((1 << RXCIE) | (1 << TXCIE) | (1 << RXEN) | (1 << TXEN)) ,UCSR0B);
return SUCCESS;
}
command result_t StdControl.start()
{
//buffer=signal ReceiveMsg.receive(r);
return SUCCESS;
}
}
event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr m) {
call Leds.greenToggle();
msg=(MOUSE_MSG*)&(m->data);
//length=sizeof(msg->data);
if(msg->data>=0 && msg->data<128)
{
outp(msg->data, UDR0);
sbi(UCSR0A, TXC);
call Leds.redToggle();
}
return m;
}
command result_t StdControl.stop()
{
outp(0x00, UCSR0A);
outp(0x00, UCSR0B);
outp(0x00, UCSR0C);
}
}
{
outp(0x00, UCSR0A);
outp(0x00, UCSR0B);
outp(0x00, UCSR0C);
}
}
Inbox full of spam? Get leading spam protection and 1GB storage with All New Yahoo! Mail.
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
