-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathL3_LLinterface.cpp
More file actions
67 lines (55 loc) · 1.48 KB
/
L3_LLinterface.cpp
File metadata and controls
67 lines (55 loc) · 1.48 KB
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
#include "mbed.h"
#include "L3_FSMevent.h"
#include "L3_msg.h"
#include "protocol_parameters.h"
#include "time.h"
static uint8_t rcvdMsg[L3_MAXDATASIZE];
static uint8_t rcvdSize;
static int16_t rcvdRssi;
static int8_t rcvdSnr;
static uint8_t rcvdSrcId;
//Downward primitives
//TX function
void (*L3_LLI_dataReqFunc)(uint8_t* msg, uint8_t size, uint8_t destId);
void (*L3_LLI_reconfigSrcIdReqFunc)(uint8_t myId);
//interface event : DATA_IND, RX data has arrived
void L3_LLI_dataInd(uint8_t* dataPtr, uint8_t srcId, uint8_t size, int8_t snr, int16_t rssi)
{
debug_if(DBGMSG_L3, "\n[L3] --> DATA IND : size:%i, %s\n", size, dataPtr);
memcpy(rcvdMsg, dataPtr, size*sizeof(uint8_t));
rcvdSize = size;
rcvdSnr = snr;
rcvdRssi = rssi;
rcvdSrcId = srcId;
L3_event_setEventFlag(L3_event_msgRcvd);
}
void L3_LLI_dataCnf(uint8_t res)
{
debug_if(DBGMSG_L3, "\n --> DATA CNF : res : %i\n", res);
L3_event_setEventFlag(L3_event_dataSendCnf);
}
void L3_LLI_reconfigSrcIdCnf(uint8_t res)
{
debug_if(DBGMSG_L3, "\n --> RECONFIG SRCID CNF : res : %i\n", res);
L3_event_setEventFlag(L3_event_recfgSrcIdCnf);
}
uint8_t* L3_LLI_getMsgPtr()
{
return rcvdMsg;
}
uint8_t L3_LLI_getSize()
{
return rcvdSize;
}
uint8_t L3_LLI_getSrcId()
{
return rcvdSrcId;
}
void L3_LLI_setDataReqFunc(void (*funcPtr)(uint8_t*, uint8_t, uint8_t))
{
L3_LLI_dataReqFunc = funcPtr;
}
void L3_LLI_setReconfigSrcIdReqFunc(void (*funcPtr)(uint8_t))
{
L3_LLI_reconfigSrcIdReqFunc = funcPtr;
}