Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
DO/DO.cpp
- Committer:
- Sainratp
- Date:
- 2017-10-23
- Revision:
- 0:703249a56b9d
- Child:
- 1:5c0ca9bdf810
File content as of revision 0:703249a56b9d:
#include "mbed.h" #include "DO.h" #include "config.h" char calcCRC16(char* trame) { char length = trame[2]; int CRC16 = 0xFFFF; for(char i =0x00; i<length; i++) { CRC16 = CRC16 ^ trame[3+i]; for(int j = 0 ; j<8 ; j++) { if((CRC16 & 0x1)==0x01) { CRC16 = CRC16/2 ^ 0xA001; } else { CRC16 = CRC16/2; } } } return CRC16 & 0x00FF ; } void recieveData(char* data){ if(calcCRC16(data)){ } else{ printf("Erreur : Checksum incorect \n"); } }