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 RING_BUFFER_SIZE 100
|
||||
#define MAX_PACKET_LENGTH 20
|
||||
#define MAX_PACKET_LENGTH 100
|
||||
|
||||
static const uint8_t COMMAND_TRANSFER_SPI = 1;
|
||||
|
||||
@ -59,6 +59,7 @@ void handlePacket(uint8_t *packet, size_t packetLen) {
|
||||
//Paket layout is:
|
||||
// 8 bit command | 8 bit address | 16bit length | <length> byte data | 16 bit crc
|
||||
|
||||
|
||||
uint16_t crc = Calculate_CRC(packet, packetLen);
|
||||
|
||||
if (crc != 0) {
|
||||
@ -134,10 +135,12 @@ void handleNewData() {
|
||||
|
||||
//TODO check if this is thread safe by arduino
|
||||
void serialEvent() {
|
||||
//Serial.println(ringBuffer.availableWriteSpace());
|
||||
while (Serial.available()) {
|
||||
uint8_t byte = Serial.read();
|
||||
ringBuffer.writeData(&byte, 1);
|
||||
}
|
||||
//Serial.println(ringBuffer.availableWriteSpace());
|
||||
}
|
||||
|
||||
void setup() {
|
||||
|
Loading…
Reference in New Issue
Block a user