interrupt safe USB send function

This commit is contained in:
Jan Käberich 2022-08-21 22:20:59 +02:00
parent 5137457545
commit c05d248f83
13 changed files with 38 additions and 73 deletions

View file

@ -59,6 +59,12 @@ uint16_t Protocol::DecodeBuffer(uint8_t *buf, uint16_t len, PacketInfo *info) {
return data - buf;
}
if(length > sizeof(PacketInfo) * 2) {
// larger than twice the maximum expected packet size, probably an error, ignore
info->type = PacketType::None;
return 1;
}
/* The complete frame has been received, check checksum */
auto type = (PacketType) data[3];
uint32_t crc = *(uint32_t*) &data[length - 4];