Skip to content

A truly modular keyboard

C

firmware: HELLO lists optional caps

Nathan510586c3ebe3
diff --git a/firmware/Core/Src/proto.c b/firmware/Core/Src/proto.c
index 6ad94bc..f7052d6 100644
--- a/firmware/Core/Src/proto.c
+++ b/firmware/Core/Src/proto.c
@@ -4,6 +4,11 @@
#include "keymap.h"
#include "proto.h"
+/* Optional features the desktop app can use, only what's implemented.
+ * kb= (the embedded Keybit image version) waits for keybit_image.h to
+ * export one. */
+#define CAPS "hold,macro"
+
static proto_port_t *ports[PROTO_MAX_PORTS];
static int port_count;
@@ -149,7 +154,7 @@ static void Handle_Line(proto_port_t *port, char *cmd)
if (strcmp(cmd, "HELLO") == 0)
{
- Reply(port, "KEYWORD v=%s proto=1", KEYWORD_FW_VERSION);
+ Reply(port, "KEYWORD v=%s proto=1 caps=%s", KEYWORD_FW_VERSION, CAPS);
}
else if (strcmp(cmd, "SIDES?") == 0)
{
diff --git a/firmware/test/proto_test.c b/firmware/test/proto_test.c
index 67adb29..c3c782b 100644
--- a/firmware/test/proto_test.c
+++ b/firmware/test/proto_test.c
@@ -90,9 +90,9 @@ int main(void)
memset(present[1].uid, 0xAB, UID_LEN);
present[1].at = 'T';
- expect("HELLO\n", "KEYWORD v=" KEYWORD_FW_VERSION " proto=1\n");
- expect("HELLO\r\n", "KEYWORD v=" KEYWORD_FW_VERSION " proto=1\n");
- expect("HELLO\r", "KEYWORD v=" KEYWORD_FW_VERSION " proto=1\n"); /* terminal Enter */
+ expect("HELLO\n", "KEYWORD v=" KEYWORD_FW_VERSION " proto=1 caps=hold,macro\n");
+ expect("HELLO\r\n", "KEYWORD v=" KEYWORD_FW_VERSION " proto=1 caps=hold,macro\n");
+ expect("HELLO\r", "KEYWORD v=" KEYWORD_FW_VERSION " proto=1 caps=hold,macro\n"); /* terminal Enter */
expect("\r\n\r\n", "");
expect("SIDES?\n", "SIDES L=1 R=0 T=1\n");
expect("KEYS?\n", "KEY+ uid=" U " at=L v=2\nKEY+ uid=ABABABABABABABABABABABAB at=T v=0\nKEYS END\n");
@@ -196,7 +196,7 @@ int main(void)
longline[sizeof(longline) - 2] = '\n';
longline[sizeof(longline) - 1] = 0;
expect(longline, "ERR line too long\n");
- expect("HELLO\n", "KEYWORD v=" KEYWORD_FW_VERSION " proto=1\n");
+ expect("HELLO\n", "KEYWORD v=" KEYWORD_FW_VERSION " proto=1 caps=hold,macro\n");
/* Two transports at once: each has its own line buffer, so half a line
* on one doesn't mix with the other, and replies go back where they
@@ -207,7 +207,7 @@ int main(void)
assert(out[0] == 0);
assert(strcmp(out2, "SIDES L=1 R=0 T=1\n") == 0);
PROTO_Input(&port, (const uint8_t *)"LO\n", 3);
- assert(strcmp(out, "KEYWORD v=" KEYWORD_FW_VERSION " proto=1\n") == 0);
+ assert(strcmp(out, "KEYWORD v=" KEYWORD_FW_VERSION " proto=1 caps=hold,macro\n") == 0);
assert(strcmp(out2, "SIDES L=1 R=0 T=1\n") == 0);
/* Unsolicited events go to every connected port, and only those. */