Skip to content

Commit

Permalink
Corrected word read access of non word aligned data. Closes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
krichardsson committed Aug 8, 2018
1 parent 752485c commit 448a0ef
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/libdw1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,11 +770,20 @@ bool dwIsReceiveDone(dwDevice_t* dev) {
}

bool dwIsReceiveFailed(dwDevice_t *dev) {
return *(uint32_t*)dev->sysstatus & SYS_STATUS_ALL_RX_ERR;
bool ldeErr = getBit(dev->sysstatus, LEN_SYS_STATUS, LDEERR_BIT);
bool rxCRCErr = getBit(dev->sysstatus, LEN_SYS_STATUS, RXFCE_BIT);
bool rxHeaderErr = getBit(dev->sysstatus, LEN_SYS_STATUS, RXPHE_BIT);
bool rxDecodeErr = getBit(dev->sysstatus, LEN_SYS_STATUS, RXRFSL_BIT);


bool rxSfdto = getBit(dev->sysstatus, LEN_SYS_STATUS, RXSFDTO_BIT);
bool affrej = getBit(dev->sysstatus, LEN_SYS_STATUS, AFFREJ_BIT);

return (ldeErr || rxCRCErr || rxHeaderErr || rxDecodeErr || rxSfdto || affrej);
}

bool dwIsReceiveTimeout(dwDevice_t* dev) {
return *(uint32_t*)dev->sysstatus & SYS_STATUS_ALL_RX_TO;
return getBit(dev->sysstatus, LEN_SYS_STATUS, RXRFTO_BIT);
}

bool dwIsClockProblem(dwDevice_t* dev) {
Expand Down

0 comments on commit 448a0ef

Please sign in to comment.