WIP: device synchronization

This commit is contained in:
Jan Käberich 2022-08-07 03:01:22 +02:00
parent 047f6ce981
commit 58918f81c1
90 changed files with 8970 additions and 310 deletions

View file

@ -8,8 +8,8 @@
static uint8_t inputBuffer[1024];
uint16_t inputCnt = 0;
static uint8_t outputBuffer[1024];
static Communication::Callback callback = nullptr;
static uint8_t blockAcks = 0;
void Communication::SetCallback(Callback cb) {
callback = cb;
@ -66,7 +66,15 @@ void communication_usb_input(const uint8_t *buf, uint16_t len) {
}
bool Communication::SendWithoutPayload(Protocol::PacketType type) {
if(type == Protocol::PacketType::Ack && blockAcks) {
blockAcks--;
return true;
}
Protocol::PacketInfo p;
p.type = type;
return Send(p);
}
void Communication::BlockNextAck() {
blockAcks++;
}