packet field beautified

This commit is contained in:
Robin Müller 2020-10-13 00:45:05 +02:00
parent 8e97270bb7
commit da92a31910

View File

@ -52,25 +52,26 @@ void transferSPI(uint8_t address, uint8_t *data, size_t datalen) {
}
void handlePacket(uint8_t *packet, size_t packetLen) {
//Paket layout is:
// byte --------------------
// 1 | 8 bit command |
// --------------------
// 1 | 8 bit address |
// --------------------
// 2 | 16bit length |
// --------------------
// length | <length> byte data |
// --------------------
// 2 | 16 bit crc |
// --------------------
/* Paket layout is:
------------------------------
|byte | field |
| | |
|------------------------------|
|1 | 8 bit command |
|------------------------------|
|1 | 8 bit address |
|------------------------------|
|2 | 16bit length |
|------------------------------|
|length | <length> byte data |
|------------------------------|
|2 | 16 bit crc |
|------------------------------|
------------------------------
*/
uint16_t crc = Calculate_CRC(packet, packetLen);
if (crc != 0) {
Serial.println("invalid Checksum");
return;
@ -86,8 +87,6 @@ void handlePacket(uint8_t *packet, size_t packetLen) {
uint8_t command = packet[0];
uint8_t address = packet[1];
switch (command) {
case COMMAND_TRANSFER_SPI:
transferSPI(address, packet + 4, payloadLen);