-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtdmaC.nc
69 lines (57 loc) · 1.95 KB
/
tdmaC.nc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <Timer.h>
#include "messages.h"
#include <printf.h>
configuration tdmaC {
provides{
interface AMSend;
interface Receive;
interface tdma;
}
}
implementation {
components tdmaP as AppP, MainC, LedsC;
components new Timer32C() as TimerBeaconTx;
components new Timer32C() as TimerOff;
components new Timer32C() as TimerOn;
components new Timer32C() as TimerSendJoinReq;
components new Timer32C() as TimerTurnoffRadio;
components new Timer32C() as TimerData;
components CC2420TimeSyncMessageC as TSAM;
components CC2420ActiveMessageC;
components ActiveMessageC;
components RandomC;
components SerialPrintfC, SerialStartC;
components new AMSenderC(AM_JOINREQMSG) as SendJoinReq;
components new AMReceiverC(AM_JOINREQMSG) as ReceiveJoinReq;
components new AMSenderC(AM_REPLYSLOTMSG) as SendReplyJoin;
components new AMReceiverC(AM_REPLYSLOTMSG) as ReceiveReplyJoin;
components new AMSenderC(AM_DATAMSG) as SendData;
components new AMReceiverC(AM_DATAMSG) as ReceiveData;
components new AMSenderC(AM_ACKMSG) as SendAck;
components new AMReceiverC(AM_ACKMSG) as ReceiveAck;
AppP.AMSend = AMSend;
AppP.Receive = Receive;
AppP.tdma = tdma;
AppP.TSPacket -> TSAM.TimeSyncPacket32khz;
AppP.SendBeacon -> TSAM.TimeSyncAMSend32khz[AM_BEACONMSG]; // wire to the beacon AM type
AppP.ReceiveBeacon -> TSAM.Receive[AM_BEACONMSG];
AppP.Leds -> LedsC;
AppP.Boot -> MainC;
AppP.TimerBeaconTx -> TimerBeaconTx;
AppP.TimerOff -> TimerOff;
AppP.TimerOn -> TimerOn;
AppP.TimerSendJoinReq -> TimerSendJoinReq;
AppP.TimerTurnoffRadio -> TimerTurnoffRadio;
AppP.TimerData -> TimerData;
AppP.AMControl -> ActiveMessageC;
AppP.AMPacket -> ActiveMessageC;
AppP.Random -> RandomC;
AppP.SendJoinReq -> SendJoinReq;
AppP.ReceiveJoinReq -> ReceiveJoinReq;
AppP.SendReplyJoin -> SendReplyJoin;
AppP.ReceiveReplyJoin -> ReceiveReplyJoin;
AppP.SendData -> SendData;
AppP.ReceiveData -> ReceiveData;
AppP.SendAck -> SendAck;
AppP.ReceiveAck -> ReceiveAck;
}