diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-09-05 18:47:55 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-09-05 18:47:55 -0400 |
| commit | 0880d0b01a016177f047cc07a6a11d5e3639d095 (patch) | |
| tree | 602c68e273b977323863d6be100f5ee9880b3f34 | |
| parent | ca008db4258598f14f6ec1891a4ab20c262ca924 (diff) | |
| download | can-gauge-interface-0880d0b01a016177f047cc07a6a11d5e3639d095.zip | |
usb: add nack to protocol
| -rw-r--r-- | doc/protocol | 2 | ||||
| -rw-r--r-- | 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 @@ <command> ::= <opcode> " " <args> "\n" -<response> ::= <retval> "\n" +<response> ::= (<retval>|"nack") "\n" Echo: <opcode> ::= "e" @@ -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; |