fds
Revision 2:6c547cdb94e6, committed 2019-12-09
- Comitter:
- brainliang
- Date:
- Mon Dec 09 09:13:59 2019 +0000
- Parent:
- 1:c41959327807
- Commit message:
- ade
Changed in this revision
nRF24L01P.cpp | Show annotated file Show diff for this revision Revisions of this file |
nRF24L01P.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r c41959327807 -r 6c547cdb94e6 nRF24L01P.cpp --- a/nRF24L01P.cpp Mon Dec 09 06:23:05 2019 +0000 +++ b/nRF24L01P.cpp Mon Dec 09 09:13:59 2019 +0000 @@ -186,3 +186,13 @@ } } +uint8_t nRF24L01P::Get_Checksum(uint8_t mydata[]) +{ + uint8_t i; + uint8_t checksum=0; + uint8_t length = mydata[3]; + + for(i=0;i<length+2;i++) + checksum ^= (mydata[3+i]&0xFF); + return checksum; +} \ No newline at end of file
diff -r c41959327807 -r 6c547cdb94e6 nRF24L01P.h --- a/nRF24L01P.h Mon Dec 09 06:23:05 2019 +0000 +++ b/nRF24L01P.h Mon Dec 09 09:13:59 2019 +0000 @@ -78,6 +78,7 @@ void NRF_Send_TX(uint8_t * tx_buf, uint8_t len); void NRF24L01_IRQ(void); + uint8_t Get_Checksum(uint8_t mydata[]) void Nrf_Connect(void);