From 36cc2c89e740a3a170bae02d1e48ea52625505a0 Mon Sep 17 00:00:00 2001 From: Angelo Scialabba Date: Mon, 15 Jul 2013 16:36:14 +0200 Subject: Bridge: CRC16 being used as CRC --- libraries/Bridge/Bridge.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libraries/Bridge/Bridge.cpp') diff --git a/libraries/Bridge/Bridge.cpp b/libraries/Bridge/Bridge.cpp index 363dcd1..bc52b7b 100644 --- a/libraries/Bridge/Bridge.cpp +++ b/libraries/Bridge/Bridge.cpp @@ -17,6 +17,7 @@ */ #include "Bridge.h" +#include BridgeClass::BridgeClass(Stream &_stream) : index(0), stream(_stream), started(false), max_retries(0) { @@ -94,12 +95,14 @@ unsigned int BridgeClass::get(const char *key, uint8_t *value, unsigned int maxl } void BridgeClass::crcUpdate(uint8_t c) { - CRC = CRC ^ c; - CRC = (CRC >> 8) + (CRC << 8); + + CRC = _crc_ccitt_update(CRC, c); + //CRC = CRC ^ c; + //CRC = (CRC >> 8) + (CRC << 8); } void BridgeClass::crcReset() { - CRC = 0xAAAA; + CRC = 0xFFFF; } void BridgeClass::crcWrite() { -- cgit v1.2.3-18-g5258