[Tinyos-help] Accessing MAC Layer Events from Application
Jim Fell
jfell at lsr.com
Mon Sep 22 08:47:52 PDT 2008
Hello. I'm attempting to toggle a port pin whenever a packet is
received or sent by utilizing the MAC layer events. However, when I add
these events to my application, even though it compiles, I do not seen
the pins toggling on my oscilloscope. I've been able to verify that the
functions I'm using the toggle the pins work. So, I can only guess that
I may not be setting up the wiring to the events properly. Here's what
I have so far. Any insight would be appreciated. Thanks.
-Jim
configuration MoteC
{
uses interface Transport;
uses interface Mac;
}
implementation
{
components MoteP as MoteP;
components MainC as MainC;
components HplMsp430GeneralIOC as dPins;
MoteP.MacLayer = Mac;
MoteP.Boot -> MainC;
MoteP.dOutput0 -> dPins.Port23;
MoteP.dOutput1 -> dPins.Port34;
MoteP.dOutput2 -> dPins.Port35;
}
// ---------------------------------------
module MoteP
{
uses interface Boot as Boot;
uses interface Mac as MacLayer;
uses interface HplMsp430GeneralIO as dOutput0;
uses interface HplMsp430GeneralIO as dOutput1;
uses interface HplMsp430GeneralIO as dOutput2;
}
implementation
{
event void Boot.booted()
{
call dOutput0.selectIOFunc();
call dOutput0.makeOutput();
call dOutput1.selectIOFunc();
call dOutput1.makeOutput();
call dOutput2.selectIOFunc();
call dOutput2.makeOutput();
call Timer0.startPeriodic( 100 );
call Timer1.startPeriodic( 200 );
call Timer2.startPeriodic( 400 );
}
event void MacLayer.msgReceived(am_id_t msgId, message_t *msg, void
*data,
uint8_t len)
{
// The code in this event does not seem to be executed.
call dOutput0.toggle();
}
event void MacLayer.msgSnoopReceived(am_id_t msgId, message_t *msg,
void *data, uint8_t len)
{
// The code in this event does not seem to be executed.
call dOutput1.toggle();
}
event void MacLayer.sendMsgDone(am_id_t msgId, am_addr_t recipientId,
message_t *msg, error_t err, bool ackTimeout)
{
// The code in this event does not seem to be executed.
call dOutput2.toggle();
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080922/cd639285/attachment.htm
More information about the Tinyos-help
mailing list