diff --git a/firmware/stmf446retx/Inc/mainboard_usb.h b/firmware/stmf446retx/Inc/mainboard_usb.h index 26551697..2c73f9c1 100644 --- a/firmware/stmf446retx/Inc/mainboard_usb.h +++ b/firmware/stmf446retx/Inc/mainboard_usb.h @@ -43,11 +43,11 @@ extern "C" { #ifndef HID_EPIN_ADDR #define HID_EPIN_ADDR 0x81U #endif /* HID_EPIN_ADDR */ -#define HID_EPIN_SIZE 0x0EU +#define HID_EPIN_SIZE 0x04U #define USB_HID_CONFIG_DESC_SIZ 34U #define USB_HID_DESC_SIZ 9U -#define HID_MOUSE_REPORT_DESC_SIZE 0x2DU +#define HID_MOUSE_REPORT_DESC_SIZE 63U #define HID_DESCRIPTOR_TYPE 0x21U #define HID_REPORT_DESC 0x22U diff --git a/firmware/stmf446retx/Inc/usbd_desc.h b/firmware/stmf446retx/Inc/usbd_desc.h index 6eab7e4e..a42cff0c 100644 --- a/firmware/stmf446retx/Inc/usbd_desc.h +++ b/firmware/stmf446retx/Inc/usbd_desc.h @@ -41,10 +41,10 @@ * @{ */ -/** @defgroup USBD_DESC_Exported_Constants USBD_DESC_Exported_Constants - * @brief Constants. - * @{ - */ +/* + * User to provide a unique ID to define the USB device serial number + * The use of UID_BASE register can be considered as an example + */ #define DEVICE_ID1 (UID_BASE) #define DEVICE_ID2 (UID_BASE + 0x4) #define DEVICE_ID3 (UID_BASE + 0x8) diff --git a/firmware/stmf446retx/Src/mainboard_usb.c b/firmware/stmf446retx/Src/mainboard_usb.c index c585e5e9..53beff06 100644 --- a/firmware/stmf446retx/Src/mainboard_usb.c +++ b/firmware/stmf446retx/Src/mainboard_usb.c @@ -158,7 +158,7 @@ __ALIGN_BEGIN static uint8_t USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ] __ALIGN_E 0x01, /* bNumEndpoints */ 0x03, /* bInterfaceClass: HID */ 0x00, /* bInterfaceSubClass : 1=BOOT, 0=no boot */ - 0x00, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */ + 0x01, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */ 0, /* iInterface: Index of string descriptor */ /******************** Descriptor of Joystick Mouse HID ********************/ /* 18 */ @@ -219,69 +219,39 @@ __ALIGN_BEGIN static uint8_t USBD_HID_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_ __ALIGN_BEGIN static uint8_t HID_MOUSE_ReportDesc[HID_MOUSE_REPORT_DESC_SIZE] __ALIGN_END = { -// 0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */ -// 0x09, 0x05, /* Usage (Gamepad) */ -// 0xA1, 0x01, /* Collection (Application) */ - -// // --- Buttons: 13 total --- -// 0x05, 0x09, // USAGE_PAGE (Button) -// 0x19, 0x01, // USAGE_MINIMUM (Button 1) -// 0x29, 0x0D, // USAGE_MAXIMUM (Button 13) -// 0x15, 0x00, // LOGICAL_MINIMUM (0) -// 0x25, 0x01, // LOGICAL_MAXIMUM (1) -// 0x75, 0x01, // REPORT_SIZE (1 bit per button) -// 0x95, 0x0D, // REPORT_COUNT (13 bits total) -// 0x81, 0x02, // INPUT (Data,Var,Abs) - -// // --- Padding (3 bits) --- -// 0x75, 0x01, // REPORT_SIZE (1) -// 0x95, 0x03, // REPORT_COUNT (3 bits) -// 0x81, 0x03, // INPUT (Const,Var,Abs) - -// // --- Encoders (3 x int8_t) --- -// 0x05, 0x01, // USAGE_PAGE (Generic Desktop) -// 0x09, 0x30, // USAGE (X) -// 0x09, 0x31, // USAGE (Y) -// 0x09, 0x32, // USAGE (Z) -// 0x15, 0x81, // LOGICAL_MINIMUM (-127) -// 0x25, 0x7F, // LOGICAL_MAXIMUM (127) -// 0x75, 0x08, // REPORT_SIZE (8 bits) -// 0x95, 0x03, // REPORT_COUNT (3 axes) -// 0x81, 0x02, // INPUT (Data,Var,Abs) - -// 0xC0 /* End Collection */ - 0x05, 0x01, // Usage Page (Generic Desktop) - 0x09, 0x06, // Usage (Keyboard) - 0xA1, 0x01, // Collection (Application) - - // Modifiers (8 bits) - 0x05, 0x07, // Usage Page (Keyboard/Keypad) - 0x19, 0xE0, // Usage Minimum (224) - Left Control - 0x29, 0xE7, // Usage Maximum (231) - Right GUI - 0x15, 0x00, // Logical Minimum (0) - 0x25, 0x01, // Logical Maximum (1) - 0x75, 0x01, // Report Size (1 bit) - 0x95, 0x08, // Report Count (8 bits) - 0x81, 0x02, // Input (Data, Variable, Absolute) - - // Reserved byte (8 bits) - 0x75, 0x08, // Report Size (8 bits) - 0x95, 0x01, // Report Count (1) - 0x81, 0x01, // Input (Constant) - - // Key bitfield (112 bits = 14 bytes) - 0x05, 0x07, // Usage Page (Keyboard/Keypad) - 0x19, 0x04, // Usage Minimum (4) - 0x29, 0x73, // Usage Maximum (115) -- 0x73 - 0x15, 0x00, // Logical Minimum (0) - 0x25, 0x01, // Logical Maximum (1) - 0x75, 0x01, // Report Size (1 bit) - 0x95, 0x70, // Report Count (112 bits, 0x70) - 0x81, 0x02, // Input (Data, Variable, Absolute) - - 0xC0 // End Collection + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x06, // USAGE (Keyboard) + 0xa1, 0x01, // COLLECTION (Application) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) + 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x08, // REPORT_COUNT (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + 0x95, 0x05, // REPORT_COUNT (5) + 0x75, 0x01, // REPORT_SIZE (1) + 0x05, 0x08, // USAGE_PAGE (LEDs) + 0x19, 0x01, // USAGE_MINIMUM (Num Lock) + 0x29, 0x05, // USAGE_MAXIMUM (Kana) + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x03, // REPORT_SIZE (3) + 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) + 0x95, 0x06, // REPORT_COUNT (6) + 0x75, 0x08, // REPORT_SIZE (8) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x65, // LOGICAL_MAXIMUM (101) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) + 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) + 0x81, 0x00, // INPUT (Data,Ary,Abs) + 0xc0 // END_COLLECTION }; - static uint8_t HIDInEpAdd = HID_EPIN_ADDR; /** diff --git a/firmware/stmf446retx/Src/usb_device.c b/firmware/stmf446retx/Src/usb_device.c index 3d3e900d..c7f53d23 100644 --- a/firmware/stmf446retx/Src/usb_device.c +++ b/firmware/stmf446retx/Src/usb_device.c @@ -1,3 +1,4 @@ + /* USER CODE BEGIN Header */ /** ****************************************************************************** diff --git a/firmware/stmf446retx/Src/usbd_desc.c b/firmware/stmf446retx/Src/usbd_desc.c index c992f3bd..332d755b 100644 --- a/firmware/stmf446retx/Src/usbd_desc.c +++ b/firmware/stmf446retx/Src/usbd_desc.c @@ -1,7 +1,7 @@ /* USER CODE BEGIN Header */ /** ****************************************************************************** - * @file : usbd_desc.c + * @file : App/usbd_desc.c * @version : v1.0_Cube * @brief : This file implements the USB device descriptors. ****************************************************************************** @@ -62,11 +62,11 @@ * @{ */ -#define USBD_VID 0xCAFE +#define USBD_VID 1155 #define USBD_LANGID_STRING 1033 -#define USBD_MANUFACTURER_STRING "TeamSKBD" +#define USBD_MANUFACTURER_STRING "Team SKBD" #define USBD_PID_FS 22315 -#define USBD_PRODUCT_STRING_FS "MSKBD Mainboard" +#define USBD_PRODUCT_STRING_FS "Modular Keyboard" #define USBD_CONFIGURATION_STRING_FS "HID Config" #define USBD_INTERFACE_STRING_FS "HID Interface" diff --git a/firmware/stmf446retx/platformio.ini b/firmware/stmf446retx/platformio.ini index 854de7fa..88a218fd 100644 --- a/firmware/stmf446retx/platformio.ini +++ b/firmware/stmf446retx/platformio.ini @@ -16,4 +16,4 @@ board_build.stm32cube.custom_config_header = yes [platformio] include_dir = Inc -src_dir = Src +src_dir = Src \ No newline at end of file