Skip to content

Commit

Permalink
Add timestamp to PHY_DataInd_t and copy it to NwkFrame_t and NWK_Data…
Browse files Browse the repository at this point in the history
…Ind_t where its exposed to pinoccio via scouthandler.cpp as NWK_DataInd_t.timestamp
  • Loading branch information
jacobrosenthal committed Apr 27, 2015
1 parent 3745497 commit b0fb979
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lwm/nwk/nwkFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ typedef struct NwkFrame_t
{
uint8_t lqi;
int8_t rssi;
uint32_t timestamp;
} rx;

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

frame->rx.timestamp = ind->timesamp;
frame->state = NWK_RX_STATE_RECEIVED;
frame->size = ind->size;
frame->rx.lqi = ind->lqi;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/lwm/nwk/nwkRx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 -------------------------------------------------------------*/
Expand Down
5 changes: 5 additions & 0 deletions src/lwm/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions src/lwm/phy/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b0fb979

Please sign in to comment.