Skip to content

Timestamp #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lwm/nwk/nwkFrame.h
Original file line number Diff line number Diff line change
@@ -111,6 +111,7 @@ typedef struct NwkFrame_t
{
uint8_t lqi;
int8_t rssi;
uint32_t timestamp;
} rx;

struct
2 changes: 2 additions & 0 deletions src/lwm/nwk/nwkRx.c
Original file line number Diff line number Diff line change
@@ -124,6 +124,7 @@ void PHY_DataInd(PHY_DataInd_t *ind)
if (NULL == (frame = nwkFrameAlloc()))
return;

frame->rx.timestamp = ind->timestamp;
frame->state = NWK_RX_STATE_RECEIVED;
frame->size = ind->size;
frame->rx.lqi = ind->lqi;
@@ -428,6 +429,7 @@ static bool nwkRxIndicateFrame(NwkFrame_t *frame)
if (NULL == nwkIb.endpoint[header->nwkDstEndpoint])
return false;

ind.timestamp = frame->rx.timestamp;
ind.srcAddr = header->nwkSrcAddr;
ind.dstAddr = header->nwkDstAddr;
ind.srcEndpoint = header->nwkSrcEndpoint;
1 change: 1 addition & 0 deletions src/lwm/nwk/nwkRx.h
Original file line number Diff line number Diff line change
@@ -78,6 +78,7 @@ typedef struct NWK_DataInd_t
uint8_t size;
uint8_t lqi;
int8_t rssi;
uint32_t timestamp;
} NWK_DataInd_t;

/*- Prototypes -------------------------------------------------------------*/
5 changes: 5 additions & 0 deletions src/lwm/phy/phy.c
Original file line number Diff line number Diff line change
@@ -311,6 +311,11 @@ void PHY_TaskHandler(void)
for (uint8_t i = 0; i < size + 1/*lqi*/; i++)
phyRxBuffer[i] = TRX_FRAME_BUFFER(i);

ind.timestamp = SCTSRLL;
ind.timestamp |= (uint32_t)SCTSRLH << 8;
ind.timestamp |= (uint32_t)SCTSRHL << 16;
ind.timestamp |= (uint32_t)SCTSRHH << 24;

ind.data = phyRxBuffer;
ind.size = size - PHY_CRC_SIZE;
ind.lqi = phyRxBuffer[size];
1 change: 1 addition & 0 deletions src/lwm/phy/phy.h
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@ typedef struct PHY_DataInd_t
uint8_t size;
uint8_t lqi;
int8_t rssi;
uint32_t timestamp;
} PHY_DataInd_t;

enum