mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Bridge library is now platform independent.
This commit is contained in:
parent
fdb98f1213
commit
258c7af469
@ -4,7 +4,7 @@ email=info@arduino.cc
|
|||||||
sentence=The library to use the Arduino YUN. The Bridge library create a link between the 32U4 and the AR9331 enabling to control most of the linux features from the sketch.
|
sentence=The library to use the Arduino YUN. The Bridge library create a link between the 32U4 and the AR9331 enabling to control most of the linux features from the sketch.
|
||||||
paragraph=The Bridge library feature: access to the shared storage, run and manage linux processes, open a remote console, access to the linux file system, including the SD card, enstablish http clients or servers.
|
paragraph=The Bridge library feature: access to the shared storage, run and manage linux processes, open a remote console, access to the linux file system, including the SD card, enstablish http clients or servers.
|
||||||
url=http://arduino.cc/en/Reference/YunBridgeLibrary
|
url=http://arduino.cc/en/Reference/YunBridgeLibrary
|
||||||
architectures=avr
|
architectures=*
|
||||||
version=1.0
|
version=1.0
|
||||||
dependencies=none
|
dependencies=none
|
||||||
core-dependencies=arduino (>1.5.4)
|
core-dependencies=arduino (>1.5.4)
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Bridge.h"
|
#include "Bridge.h"
|
||||||
#include <util/crc16.h>
|
|
||||||
|
|
||||||
BridgeClass::BridgeClass(Stream &_stream) :
|
BridgeClass::BridgeClass(Stream &_stream) :
|
||||||
index(0), stream(_stream), started(false), max_retries(0) {
|
index(0), stream(_stream), started(false), max_retries(0) {
|
||||||
@ -94,11 +93,23 @@ unsigned int BridgeClass::get(const char *key, uint8_t *value, unsigned int maxl
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BridgeClass::crcUpdate(uint8_t c) {
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
|
// AVR use an optimized implementation of CRC
|
||||||
|
#include <util/crc16.h>
|
||||||
|
#else
|
||||||
|
// Generic implementation for non-AVR architectures
|
||||||
|
uint16_t _crc_ccitt_update(uint16_t crc, uint8_t data)
|
||||||
|
{
|
||||||
|
data ^= crc & 0xff;
|
||||||
|
data ^= data << 4;
|
||||||
|
return ((((uint16_t)data << 8) | ((crc >> 8) & 0xff)) ^
|
||||||
|
(uint8_t)(data >> 4) ^
|
||||||
|
((uint16_t)data << 3));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void BridgeClass::crcUpdate(uint8_t c) {
|
||||||
CRC = _crc_ccitt_update(CRC, c);
|
CRC = _crc_ccitt_update(CRC, c);
|
||||||
//CRC = CRC ^ c;
|
|
||||||
//CRC = (CRC >> 8) + (CRC << 8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BridgeClass::crcReset() {
|
void BridgeClass::crcReset() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user