forked from mohr/ArduinoIO
extended max packet len
This commit is contained in:
parent
ffc7e7eb7a
commit
b4314f72cb
5
main.cpp
5
main.cpp
@ -15,7 +15,7 @@
|
|||||||
#define CS_DDR DDRC
|
#define CS_DDR DDRC
|
||||||
|
|
||||||
#define RING_BUFFER_SIZE 100
|
#define RING_BUFFER_SIZE 100
|
||||||
#define MAX_PACKET_LENGTH 20
|
#define MAX_PACKET_LENGTH 100
|
||||||
|
|
||||||
static const uint8_t COMMAND_TRANSFER_SPI = 1;
|
static const uint8_t COMMAND_TRANSFER_SPI = 1;
|
||||||
|
|
||||||
@ -59,6 +59,7 @@ void handlePacket(uint8_t *packet, size_t packetLen) {
|
|||||||
//Paket layout is:
|
//Paket layout is:
|
||||||
// 8 bit command | 8 bit address | 16bit length | <length> byte data | 16 bit crc
|
// 8 bit command | 8 bit address | 16bit length | <length> byte data | 16 bit crc
|
||||||
|
|
||||||
|
|
||||||
uint16_t crc = Calculate_CRC(packet, packetLen);
|
uint16_t crc = Calculate_CRC(packet, packetLen);
|
||||||
|
|
||||||
if (crc != 0) {
|
if (crc != 0) {
|
||||||
@ -134,10 +135,12 @@ void handleNewData() {
|
|||||||
|
|
||||||
//TODO check if this is thread safe by arduino
|
//TODO check if this is thread safe by arduino
|
||||||
void serialEvent() {
|
void serialEvent() {
|
||||||
|
//Serial.println(ringBuffer.availableWriteSpace());
|
||||||
while (Serial.available()) {
|
while (Serial.available()) {
|
||||||
uint8_t byte = Serial.read();
|
uint8_t byte = Serial.read();
|
||||||
ringBuffer.writeData(&byte, 1);
|
ringBuffer.writeData(&byte, 1);
|
||||||
}
|
}
|
||||||
|
//Serial.println(ringBuffer.availableWriteSpace());
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
Loading…
Reference in New Issue
Block a user