From 0880d0b01a016177f047cc07a6a11d5e3639d095 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Fri, 5 Sep 2025 18:47:55 -0400 Subject: usb: add nack to protocol --- doc/protocol | 2 +- fw/usb.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/protocol b/doc/protocol index 2273f40..5d2cb65 100644 --- a/doc/protocol +++ b/doc/protocol @@ -1,5 +1,5 @@ ::= " " "\n" - ::= "\n" + ::= (|"nack") "\n" Echo: ::= "e" diff --git a/fw/usb.c b/fw/usb.c index 7f283e1..532bafd 100644 --- a/fw/usb.c +++ b/fw/usb.c @@ -86,8 +86,10 @@ idleState(void) { case 'e': state.next = echoState; break; case 'w': state.next = writeEepromState; break; case 'r': state.next = readEepromState; break; - default: break; // invalid command + default: putsUSBUSART("nack\n"); break; // invalid command } + } else if (readLen > 0) { + putsUSBUSART("nack\n"); } return &state; -- cgit v1.2.3