aboutsummaryrefslogtreecommitdiff
path: root/libraries/Bridge
diff options
context:
space:
mode:
authorAngelo Scialabba <a.scialabba@arduino.cc>2013-07-15 16:36:14 +0200
committerCristian Maglie <c.maglie@bug.st>2013-07-15 16:41:17 +0200
commit36cc2c89e740a3a170bae02d1e48ea52625505a0 (patch)
treedd4467f4d5847b790bac0a89589d562d569f5614 /libraries/Bridge
parentbeb9e08b79d5c59957c1532e50da30cccc318cac (diff)
Bridge: CRC16 being used as CRC
Diffstat (limited to 'libraries/Bridge')
-rw-r--r--libraries/Bridge/Bridge.cpp9
1 files changed, 6 insertions, 3 deletions
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 <util/crc16.h>
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() {