mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-30 02:36:20 +02:00
* build CRC over settings, only if the CRC matches settings are applied * send command 0x80 (set time was wrong) * improved crc16 routine * added statistics for received commands and send statistics (channels are not correct for now!) * receive of commands 0x01, 0x02, 0x03, 0x81 and 0x84 working
16 lines
421 B
C++
16 lines
421 B
C++
#ifndef __CRC_H__
|
|
#define __CRC_H__
|
|
|
|
#include <cstdint>
|
|
|
|
#define CRC8_INIT 0x00
|
|
#define CRC8_POLY 0x01
|
|
|
|
#define CRC16_MODBUS_POLYNOM 0xA001
|
|
#define CRC16_NRF24_POLYNOM 0x1021
|
|
|
|
uint8_t crc8(uint8_t buf[], uint8_t len);
|
|
uint16_t crc16(uint8_t buf[], uint8_t len);
|
|
uint16_t crc16nrf24(uint8_t buf[], uint16_t lenBits, uint16_t startBit = 0, uint16_t crcIn = 0xffff);
|
|
|
|
#endif /*__CRC_H__*/
|