Created
March 14, 2014 06:11
-
-
Save tejainece/9542863 to your computer and use it in GitHub Desktop.
TinyOS: Receive 802.15.4 compliant messages that are sent using non-beacon direct transmission.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef __APP_PROFILE_H | |
| #define __APP_PROFILE_H | |
| enum { | |
| RADIO_CHANNEL = 0xC, | |
| PAN_ID = 0x3332, | |
| MY_ADDRESS = 0x6288 | |
| }; | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| COMPONENT=Receive_D_N154C | |
| CFLAGS += -I$(shell pwd)/.. | |
| # To use the TKN15.4 MAC instead of a platform's default MAC protocol first | |
| # include the TinyOS "Makerules" file as usual ... | |
| include $(MAKERULES) | |
| # ... and then include the TKN15.4 "Makefile.include" file. That's all. | |
| # Hint: type "make <platform> verbose" to see the aggregate include path. | |
| include $(TOSDIR)/lib/mac/tkn154/Makefile.include |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| configuration Receive_D_N154C | |
| { | |
| } implementation { | |
| components MainC, LedsC, Ieee802154NonBeaconEnabledC as MAC; | |
| components Receive_D_N154P as App; | |
| MainC.Boot <- App; | |
| App.MCPS_DATA -> MAC; | |
| App.Frame -> MAC; | |
| App.Packet -> MAC; | |
| App.Leds -> LedsC; | |
| App.MLME_RESET -> MAC; | |
| App.MLME_SET -> MAC; | |
| App.MLME_GET -> MAC; | |
| App.MLME_START -> MAC; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "TKN154.h" | |
| #include "app_profile.h" | |
| module Receive_D_N154P | |
| { | |
| uses { | |
| interface Boot; | |
| interface MLME_RESET; | |
| interface MLME_START; | |
| interface MLME_SET; | |
| interface MLME_GET; | |
| interface MCPS_DATA; | |
| interface IEEE154Frame as Frame; | |
| interface Leds; | |
| interface Packet; | |
| } | |
| } implementation { | |
| event void Boot.booted() { | |
| call MLME_RESET.request(TRUE); | |
| } | |
| event void MLME_RESET.confirm(ieee154_status_t status) | |
| { | |
| if (status != IEEE154_SUCCESS) | |
| return; | |
| call MLME_SET.macShortAddress(MY_ADDRESS); | |
| call MLME_SET.macAssociationPermit(FALSE); | |
| call MLME_SET.macRxOnWhenIdle(TRUE); | |
| call MLME_START.request( | |
| PAN_ID, // PANId | |
| RADIO_CHANNEL, // LogicalChannel | |
| 0, // ChannelPage, | |
| 0, // StartTime, | |
| 15, // BeaconOrder | |
| 15, // SuperframeOrder | |
| TRUE, // PANCoordinator | |
| FALSE, // BatteryLifeExtension | |
| FALSE, // CoordRealignment | |
| NULL, // no realignment security | |
| NULL // no beacon security | |
| ); | |
| } | |
| event void MLME_START.confirm(ieee154_status_t status) { | |
| } | |
| event void MCPS_DATA.confirm( | |
| message_t *msg, | |
| uint8_t msduHandle, | |
| ieee154_status_t status, | |
| uint32_t Timestamp | |
| ) | |
| { | |
| } | |
| event message_t* MCPS_DATA.indication ( message_t* frame__ ){ | |
| call Leds.led1Toggle(); | |
| return frame__; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment