From 54d6f5d4c50af2ea09a103825040e739d7acd58b Mon Sep 17 00:00:00 2001 From: Florian Didron Date: Mon, 2 Dec 2019 18:58:07 +0900 Subject: feat: add fw version webusb cmd --- tmk_core/common/webusb.c | 8 ++++---- tmk_core/common/webusb.h | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'tmk_core/common') diff --git a/tmk_core/common/webusb.c b/tmk_core/common/webusb.c index 47507bab55..f269ed58be 100644 --- a/tmk_core/common/webusb.c +++ b/tmk_core/common/webusb.c @@ -20,9 +20,9 @@ void webusb_receive(uint8_t *data, uint8_t length) { return; } - if(command == WEBUSB_GET_LANDING_PAGE) { + if(command == WEBUSB_GET_FW_VERSION) { // Landing page + packet headers(2) + stop bit(1) - uint8_t lp_size = sizeof(WEBUSB_LANDING_PAGE_URL) + 3; + uint8_t lp_size = sizeof(FIRMWARE_VERSION) + 3; uint8_t url[lp_size]; uint8_t event[2]; @@ -33,8 +33,8 @@ void webusb_receive(uint8_t *data, uint8_t length) { stop[0] = WEBUSB_STOP_BIT; memcpy(url, event, 2); - memcpy(url + 2, WEBUSB_LANDING_PAGE_URL, sizeof(WEBUSB_LANDING_PAGE_URL)); - memcpy(url + 2 + sizeof(WEBUSB_LANDING_PAGE_URL), stop, 1); + memcpy(url + 2, FIRMWARE_VERSION, sizeof(FIRMWARE_VERSION)); + memcpy(url + 2 + sizeof(FIRMWARE_VERSION), stop, 1); webusb_send(url, lp_size); return; } diff --git a/tmk_core/common/webusb.h b/tmk_core/common/webusb.h index 873ecb7ce2..7696db677d 100644 --- a/tmk_core/common/webusb.h +++ b/tmk_core/common/webusb.h @@ -3,6 +3,9 @@ #include #include +#ifndef FIRMWARE_VERSION +#define FIRMWARE_VERSION u8"default" +#endif #define WEBUSB_STOP_BIT -2 #define WEBUSB_BLINK_STEPS 512 #define WEBUSB_BLINK_END WEBUSB_BLINK_STEPS * 60 @@ -27,7 +30,7 @@ enum Webusb_Status_Code { enum Webusb_Command_Code { WEBUSB_CMD_PAIR, - WEBUSB_GET_LANDING_PAGE + WEBUSB_GET_FW_VERSION }; enum Webusb_Event_Code { -- cgit v1.2.3