forked from mohr/ArduinoIO
SPI Settings adjusted and debugg info activated
This commit is contained in:
parent
b4314f72cb
commit
2c1925d18f
8
main.cpp
8
main.cpp
@ -46,7 +46,7 @@ void sendData(uint8_t *data, size_t len) {
|
||||
}
|
||||
|
||||
void transferSPI(uint8_t address, uint8_t *data, size_t datalen) {
|
||||
SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0));
|
||||
SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE3));
|
||||
CS_PORT = ~address;
|
||||
SPI.transfer(data, datalen);
|
||||
delay(100);
|
||||
@ -63,14 +63,14 @@ void handlePacket(uint8_t *packet, size_t packetLen) {
|
||||
uint16_t crc = Calculate_CRC(packet, packetLen);
|
||||
|
||||
if (crc != 0) {
|
||||
//Serial.println("invalid Checksum");
|
||||
Serial.println("invalid Checksum");
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t payloadLen = (packet[2] << 8) | packet[3];
|
||||
|
||||
if (payloadLen != packetLen - 6) {
|
||||
//Serial.println("invalid len");
|
||||
Serial.println("invalid len");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ void handlePacket(uint8_t *packet, size_t packetLen) {
|
||||
sendData(packet, packetLen);
|
||||
break;
|
||||
default:
|
||||
//Serial.println("invalid command");
|
||||
Serial.println("invalid command");
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user