This commit is contained in:
2025-09-17 12:51:01 -07:00
parent 8e0ae599a7
commit 736b7f406d
25 changed files with 16650 additions and 15995 deletions

View File

@@ -37,7 +37,6 @@ Behavior in this mode includes:
* **Ignoring Local Inputs**: The device does not process its own switch presses.
* **Discovery Queries**: The device broadcasts a query to its neighbors to determine its parent.
* **Awaiting Responses**: Active devices (Master or Modules) respond with a **depth value**—a numerical measure of distance (in hops) to the Master.
* The Master has a depth of **0**.
* Each Module reports its depth as `(parent depth + 1)`.

View File

@@ -46,7 +46,141 @@ extern "C" {
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
// Modifier Keys
#define KEY_LEFT_CTRL 0xE0
#define KEY_LEFT_SHIFT 0xE1
#define KEY_LEFT_ALT 0xE2
#define KEY_LEFT_GUI 0xE3
#define KEY_RIGHT_CTRL 0xE4
#define KEY_RIGHT_SHIFT 0xE5
#define KEY_RIGHT_ALT 0xE6
#define KEY_RIGHT_GUI 0xE7
// Regular Keys (Usage ID 0x040x73)
#define KEY_A 0x04
#define KEY_B 0x05
#define KEY_C 0x06
#define KEY_D 0x07
#define KEY_E 0x08
#define KEY_F 0x09
#define KEY_G 0x0A
#define KEY_H 0x0B
#define KEY_I 0x0C
#define KEY_J 0x0D
#define KEY_K 0x0E
#define KEY_L 0x0F
#define KEY_M 0x10
#define KEY_N 0x11
#define KEY_O 0x12
#define KEY_P 0x13
#define KEY_Q 0x14
#define KEY_R 0x15
#define KEY_S 0x16
#define KEY_T 0x17
#define KEY_U 0x18
#define KEY_V 0x19
#define KEY_W 0x1A
#define KEY_X 0x1B
#define KEY_Y 0x1C
#define KEY_Z 0x1D
#define KEY_1 0x1E
#define KEY_2 0x1F
#define KEY_3 0x20
#define KEY_4 0x21
#define KEY_5 0x22
#define KEY_6 0x23
#define KEY_7 0x24
#define KEY_8 0x25
#define KEY_9 0x26
#define KEY_0 0x27
#define KEY_ENTER 0x28
#define KEY_ESC 0x29
#define KEY_BACKSPACE 0x2A
#define KEY_TAB 0x2B
#define KEY_SPACE 0x2C
#define KEY_MINUS 0x2D
#define KEY_EQUAL 0x2E
#define KEY_LEFT_BRACKET 0x2F
#define KEY_RIGHT_BRACKET 0x30
#define KEY_BACKSLASH 0x31
#define KEY_NON_US_HASH 0x32
#define KEY_SEMICOLON 0x33
#define KEY_APOSTROPHE 0x34
#define KEY_GRAVE 0x35
#define KEY_COMMA 0x36
#define KEY_PERIOD 0x37
#define KEY_SLASH 0x38
#define KEY_CAPS_LOCK 0x39
// Function Keys
#define KEY_F1 0x3A
#define KEY_F2 0x3B
#define KEY_F3 0x3C
#define KEY_F4 0x3D
#define KEY_F5 0x3E
#define KEY_F6 0x3F
#define KEY_F7 0x40
#define KEY_F8 0x41
#define KEY_F9 0x42
#define KEY_F10 0x43
#define KEY_F11 0x44
#define KEY_F12 0x45
#define KEY_PRINT_SCREEN 0x46
#define KEY_SCROLL_LOCK 0x47
#define KEY_PAUSE 0x48
// Navigation Keys
#define KEY_INSERT 0x49
#define KEY_HOME 0x4A
#define KEY_PAGE_UP 0x4B
#define KEY_DELETE 0x4C
#define KEY_END 0x4D
#define KEY_PAGE_DOWN 0x4E
#define KEY_RIGHT_ARROW 0x4F
#define KEY_LEFT_ARROW 0x50
#define KEY_DOWN_ARROW 0x51
#define KEY_UP_ARROW 0x52
// Keypad
#define KEY_NUM_LOCK 0x53
#define KEYPAD_SLASH 0x54
#define KEYPAD_ASTERISK 0x55
#define KEYPAD_MINUS 0x56
#define KEYPAD_PLUS 0x57
#define KEYPAD_ENTER 0x58
#define KEYPAD_1 0x59
#define KEYPAD_2 0x5A
#define KEYPAD_3 0x5B
#define KEYPAD_4 0x5C
#define KEYPAD_5 0x5D
#define KEYPAD_6 0x5E
#define KEYPAD_7 0x5F
#define KEYPAD_8 0x60
#define KEYPAD_9 0x61
#define KEYPAD_0 0x62
#define KEYPAD_DOT 0x63
// Misc/Non-US
#define KEY_NON_US_BACKSLASH 0x64
#define KEY_APPLICATION 0x65
#define KEY_POWER 0x66
#define KEYPAD_EQUAL 0x67
#define KEY_F13 0x68
#define KEY_F14 0x69
#define KEY_F15 0x6A
#define KEY_F16 0x6B
#define KEY_F17 0x6C
#define KEY_F18 0x6D
#define KEY_F19 0x6E
#define KEY_F20 0x6F
#define KEY_F21 0x70
#define KEY_F22 0x71
#define KEY_F23 0x72
#define KEY_F24 0x73
/* USER CODE END EM */
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);

View File

@@ -19,6 +19,7 @@
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "usb_device.h"
#include <string.h>
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
@@ -27,18 +28,24 @@
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
typedef struct {
typedef struct{
uint8_t MODIFIER;
uint8_t RESERVED;
uint8_t KEYCODE1;
uint8_t KEYCODE2;
uint8_t KEYCODE3;
uint8_t KEYCODE4;
uint8_t KEYCODE5;
uint8_t KEYCODE6;
}USBHIDReport;
uint8_t KEYPRESS[13];
}HIDReport;
USBHIDReport USBREPORT = {0,0,0,0,0,0,0,0};
typedef struct {
GPIO_TypeDef* GPIOx;
uint16_t PIN;
}SwitchPins;
typedef struct {
uint8_t buffer[256];
uint16_t head;
uint16_t tail;
uint16_t count;
} HIDQueue;
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
@@ -48,10 +55,18 @@ USBHIDReport USBREPORT = {0,0,0,0,0,0,0,0};
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
#define ROW 2
#define COL 2
#define MAXQUEUE 256
#define MODE_INACTIVE 0
#define MODE_MAINBOARD 1
#define MODE_ACTIVE 2
#define MODE_DEBUG 3
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
I2C_HandleTypeDef hi2c1;
TIM_HandleTypeDef htim2;
@@ -63,11 +78,36 @@ UART_HandleTypeDef huart1;
UART_HandleTypeDef huart2;
UART_HandleTypeDef huart3;
/* USER CODE BEGIN PV */
// Initialize HID report properly
HIDReport REPORT = {0, 0, {0}};
// Initialize column pins array (no pointer needed)
SwitchPins ROW_PINS[] = {
{GPIOC, GPIO_PIN_4},
{GPIOC, GPIO_PIN_5}
};
// Initialize row pins array
SwitchPins COLUMN_PINS[] = {
{GPIOC, GPIO_PIN_6},
{GPIOC, GPIO_PIN_7}
};
// Initialize keycodes array
uint8_t KEYCODES[2][2] = {
{KEY_M, KEY_I}, // 'M', 'I'
{KEY_K, KEY_U} // 'K', 'U'
};
extern USBD_HandleTypeDef hUsbDeviceFS;
volatile uint8_t MODE = MODE_MAINBOARD;
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_TIM2_Init(void);
@@ -78,8 +118,17 @@ static void MX_USART1_UART_Init(void);
static void MX_USART2_UART_Init(void);
static void MX_I2C1_Init(void);
static void MX_USART3_UART_Init(void);
/* USER CODE BEGIN PFP */
//Queue Functions (move this later as a separate c/h file)
uint8_t Q_IsEmpty(HIDQueue* q);
uint8_t Q_IsMax(HIDQueue*q);
uint8_t Q_Enqueue(HIDQueue* q);
uint8_t Q_Dequeue(HIDQueue* q);
uint8_t Q_Peek(HIDQueue* q);
void addUSBReport(uint8_t usageID);
void matrixScan(void);
void resetReport(void);
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
@@ -131,41 +180,33 @@ int main(void)
/* Infinite loop */
/* USER CODE BEGIN WHILE */
// 2x2 Matrix Keyboard: Rows = PC6, PC7; Cols = PC4, PC5
// Key mapping: [Row0-Col0]='M', [Row0-Col1]='I', [Row1-Col0]='K', [Row1-Col1]='U'
const uint8_t keycodes[2][2] = {
{0x10, 0x0C}, // 'M', 'I' (HID keycodes)
{0x0E, 0x18} // 'K', 'U'
};
uint8_t prev_state[2][2] = {{1,1},{1,1}}; // Inputs are HIGH by default
while (1)
{
for (int row = 0; row < 2; row++) {
// Set current row LOW, other HIGH
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6, (row == 0) ? GPIO_PIN_RESET : GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_7, (row == 1) ? GPIO_PIN_RESET : GPIO_PIN_SET);
HAL_Delay(1);
uint8_t col0 = HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_4);
uint8_t col1 = HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_5);
uint8_t curr_state[2] = {col0, col1};
for (int col = 0; col < 2; col++) {
if (curr_state[col] == GPIO_PIN_RESET && prev_state[row][col] == GPIO_PIN_SET) {
// Key pressed (edge, input goes LOW)
USBREPORT.KEYCODE1 = keycodes[row][col];
USBD_HID_SendReport(&hUsbDeviceFS, &USBREPORT, sizeof(USBREPORT));
}
if (curr_state[col] == GPIO_PIN_SET && prev_state[row][col] == GPIO_PIN_RESET) {
// Key released (input goes HIGH)
USBREPORT.KEYCODE1 = 0;
USBD_HID_SendReport(&hUsbDeviceFS, &USBREPORT, sizeof(USBREPORT));
}
prev_state[row][col] = curr_state[col];
}
}
HAL_Delay(10);
/* USER CODE END WHILE */
if (MODE != MODE_INACTIVE){
//Reset Report
resetReport();
/* USER CODE BEGIN 3 */
//TODO: Append Child Module Reports
matrixScan();
switch (MODE){
case MODE_ACTIVE:
//TODO: Send to parent
//TODO: Check heartbeat signal from parent.
break;
case MODE_MAINBOARD:
//Send to USB
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&REPORT, sizeof(REPORT));
break;
}
//TODO: Send heartbeat signal to child nodes
}else{ //INACTIVE Mode
//TODO: Request parents
}
HAL_Delay(USBD_HID_GetPollingInterval(&hUsbDeviceFS));
}
/* USER CODE END 3 */
}
@@ -510,9 +551,9 @@ static void MX_USART3_UART_Init(void)
/* USER CODE BEGIN USART3_Init 2 */
/* USER CODE END USART3_Init 2 */
}
/**
* @brief GPIO Initialization Function
* @param None
@@ -541,26 +582,26 @@ static void MX_GPIO_Init(void)
/*Configure GPIO pins : PC4 PC5 */
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pins : PB0 PB1 PB2 PB10 */
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pins : PC6 PC7 PC8 PC9 */
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pin : PA8 */
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
@@ -570,6 +611,52 @@ static void MX_GPIO_Init(void)
}
/* USER CODE BEGIN 4 */
/**
* @brief Returns whether the HID Queue is Full
* @retval uint8_t; 1 for full, 0 otherwise
* @param HIDQueue
*/
uint8_t Q_IsEmpty(HIDQueue* q){
return 0;
}
uint8_t Q_IsMax(HIDQueue*q){
return 0;
}
uint8_t Q_Enqueue(HIDQueue* q){
return 0;
}
uint8_t Q_Dequeue(HIDQueue* q){
return 0;
}
uint8_t Q_Peek(HIDQueue* q){
return 0;
}
void addUSBReport(uint8_t usageID){
if(usageID < 0x04 || usageID > 0x73) return; //Usage ID is out of bounds
uint16_t bit_index = usageID - 0x04; //Offset, UsageID starts with 0x04. Gives us the actual value of the bit
uint8_t byte_index = bit_index/8; //Calculates which byte in the REPORT array
uint8_t bit_offset = bit_index%8; //Calculates which bits in the REPORT[byte_index] should be set/unset
REPORT.KEYPRESS[byte_index] |= (1 << bit_offset);
}
void matrixScan(void){
for (uint8_t col = 0; col < COL; col++){
HAL_GPIO_WritePin(COLUMN_PINS[col].GPIOx, COLUMN_PINS[col].PIN, GPIO_PIN_SET);
HAL_Delay(1);
for(uint8_t row = 0; row < ROW; row++){
if(HAL_GPIO_ReadPin(ROW_PINS[row].GPIOx, ROW_PINS[row].PIN)){
addUSBReport(KEYCODES[row][col]);
}
}
HAL_GPIO_WritePin(COLUMN_PINS[col].GPIOx, COLUMN_PINS[col].PIN, GPIO_PIN_RESET);
}
}
void resetReport(void){
REPORT.MODIFIER = 0;
memset(REPORT.KEYPRESS, 0, sizeof(REPORT.KEYPRESS));
}
/* USER CODE END 4 */

View File

@@ -1,12 +1,20 @@
../Core/Src/main.c:94:5:main 1
../Core/Src/main.c:150:6:SystemClock_Config 3
../Core/Src/main.c:197:13:MX_I2C1_Init 2
../Core/Src/main.c:231:13:MX_TIM2_Init 4
../Core/Src/main.c:280:13:MX_TIM3_Init 3
../Core/Src/main.c:329:13:MX_UART4_Init 2
../Core/Src/main.c:362:13:MX_UART5_Init 2
../Core/Src/main.c:395:13:MX_USART1_UART_Init 2
../Core/Src/main.c:428:13:MX_USART2_UART_Init 2
../Core/Src/main.c:461:13:MX_USART3_UART_Init 2
../Core/Src/main.c:494:13:MX_GPIO_Init 1
../Core/Src/main.c:553:6:Error_Handler 1
../Core/Src/main.c:143:5:main 3
../Core/Src/main.c:218:6:SystemClock_Config 3
../Core/Src/main.c:265:13:MX_I2C1_Init 2
../Core/Src/main.c:299:13:MX_TIM2_Init 4
../Core/Src/main.c:348:13:MX_TIM3_Init 3
../Core/Src/main.c:397:13:MX_UART4_Init 2
../Core/Src/main.c:430:13:MX_UART5_Init 2
../Core/Src/main.c:463:13:MX_USART1_UART_Init 2
../Core/Src/main.c:496:13:MX_USART2_UART_Init 2
../Core/Src/main.c:529:13:MX_USART3_UART_Init 2
../Core/Src/main.c:562:13:MX_GPIO_Init 1
../Core/Src/main.c:619:9:Q_IsEmpty 1
../Core/Src/main.c:622:9:Q_IsMax 1
../Core/Src/main.c:625:9:Q_Enqueue 1
../Core/Src/main.c:628:9:Q_Dequeue 1
../Core/Src/main.c:631:9:Q_Peek 1
../Core/Src/main.c:635:6:addUSBReport 3
../Core/Src/main.c:643:6:matrixScan 4
../Core/Src/main.c:656:6:resetReport 1
../Core/Src/main.c:667:6:Error_Handler 1

View File

@@ -1,12 +1,20 @@
../Core/Src/main.c:94:5:main 8 static
../Core/Src/main.c:150:6:SystemClock_Config 88 static
../Core/Src/main.c:197:13:MX_I2C1_Init 8 static
../Core/Src/main.c:231:13:MX_TIM2_Init 48 static
../Core/Src/main.c:280:13:MX_TIM3_Init 56 static
../Core/Src/main.c:329:13:MX_UART4_Init 8 static
../Core/Src/main.c:362:13:MX_UART5_Init 8 static
../Core/Src/main.c:395:13:MX_USART1_UART_Init 8 static
../Core/Src/main.c:428:13:MX_USART2_UART_Init 8 static
../Core/Src/main.c:461:13:MX_USART3_UART_Init 8 static
../Core/Src/main.c:494:13:MX_GPIO_Init 48 static
../Core/Src/main.c:553:6:Error_Handler 4 static,ignoring_inline_asm
../Core/Src/main.c:143:5:main 8 static
../Core/Src/main.c:218:6:SystemClock_Config 88 static
../Core/Src/main.c:265:13:MX_I2C1_Init 8 static
../Core/Src/main.c:299:13:MX_TIM2_Init 48 static
../Core/Src/main.c:348:13:MX_TIM3_Init 56 static
../Core/Src/main.c:397:13:MX_UART4_Init 8 static
../Core/Src/main.c:430:13:MX_UART5_Init 8 static
../Core/Src/main.c:463:13:MX_USART1_UART_Init 8 static
../Core/Src/main.c:496:13:MX_USART2_UART_Init 8 static
../Core/Src/main.c:529:13:MX_USART3_UART_Init 8 static
../Core/Src/main.c:562:13:MX_GPIO_Init 48 static
../Core/Src/main.c:619:9:Q_IsEmpty 16 static
../Core/Src/main.c:622:9:Q_IsMax 16 static
../Core/Src/main.c:625:9:Q_Enqueue 16 static
../Core/Src/main.c:628:9:Q_Dequeue 16 static
../Core/Src/main.c:631:9:Q_Peek 16 static
../Core/Src/main.c:635:6:addUSBReport 24 static
../Core/Src/main.c:643:6:matrixScan 16 static
../Core/Src/main.c:656:6:resetReport 8 static
../Core/Src/main.c:667:6:Error_Handler 4 static,ignoring_inline_asm

View File

@@ -1,10 +1,10 @@
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:273:16:USBD_HID_Init 3
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:320:16:USBD_HID_DeInit 2
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:351:16:USBD_HID_Setup 18
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:483:9:USBD_HID_SendReport 4
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:516:10:USBD_HID_GetPollingInterval 2
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:546:17:USBD_HID_GetFSCfgDesc 2
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:566:17:USBD_HID_GetHSCfgDesc 2
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:586:17:USBD_HID_GetOtherSpeedCfgDesc 2
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:607:16:USBD_HID_DataIn 1
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:624:17:USBD_HID_GetDeviceQualifierDesc 1
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:304:16:USBD_HID_Init 3
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:351:16:USBD_HID_DeInit 2
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:382:16:USBD_HID_Setup 18
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:514:9:USBD_HID_SendReport 4
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:547:10:USBD_HID_GetPollingInterval 2
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:577:17:USBD_HID_GetFSCfgDesc 2
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:597:17:USBD_HID_GetHSCfgDesc 2
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:617:17:USBD_HID_GetOtherSpeedCfgDesc 2
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:638:16:USBD_HID_DataIn 1
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:655:17:USBD_HID_GetDeviceQualifierDesc 1

View File

@@ -1,10 +1,10 @@
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:273:16:USBD_HID_Init 24 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:320:16:USBD_HID_DeInit 16 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:351:16:USBD_HID_Setup 32 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:483:9:USBD_HID_SendReport 32 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:516:10:USBD_HID_GetPollingInterval 24 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:546:17:USBD_HID_GetFSCfgDesc 24 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:566:17:USBD_HID_GetHSCfgDesc 24 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:586:17:USBD_HID_GetOtherSpeedCfgDesc 24 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:607:16:USBD_HID_DataIn 16 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:624:17:USBD_HID_GetDeviceQualifierDesc 16 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:304:16:USBD_HID_Init 24 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:351:16:USBD_HID_DeInit 16 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:382:16:USBD_HID_Setup 32 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:514:9:USBD_HID_SendReport 32 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:547:10:USBD_HID_GetPollingInterval 24 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:577:17:USBD_HID_GetFSCfgDesc 24 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:597:17:USBD_HID_GetHSCfgDesc 24 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:617:17:USBD_HID_GetOtherSpeedCfgDesc 24 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:638:16:USBD_HID_DataIn 16 static
../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c:655:17:USBD_HID_GetDeviceQualifierDesc 16 static

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -37,17 +37,52 @@ extern "C" {
*/
///** @defgroup USBD_HID_Exported_Defines
// * @{
// */
//#ifndef HID_EPIN_ADDR
//#define HID_EPIN_ADDR 0x81U
//#endif /* HID_EPIN_ADDR */
//#define HID_EPIN_SIZE 0x04U
//
//#define USB_HID_CONFIG_DESC_SIZ 34U
//#define USB_HID_DESC_SIZ 9U
//#define HID_MOUSE_REPORT_DESC_SIZE 63U
//
//#define HID_DESCRIPTOR_TYPE 0x21U
//#define HID_REPORT_DESC 0x22U
//
//#ifndef HID_HS_BINTERVAL
//#define HID_HS_BINTERVAL 0x07U
//#endif /* HID_HS_BINTERVAL */
//
//#ifndef HID_FS_BINTERVAL
//#define HID_FS_BINTERVAL 0x0AU
//#endif /* HID_FS_BINTERVAL */
//
//#define USBD_HID_REQ_SET_PROTOCOL 0x0BU
//#define USBD_HID_REQ_GET_PROTOCOL 0x03U
//
//#define USBD_HID_REQ_SET_IDLE 0x0AU
//#define USBD_HID_REQ_GET_IDLE 0x02U
//
//#define USBD_HID_REQ_SET_REPORT 0x09U
//#define USBD_HID_REQ_GET_REPORT 0x01U
///**
// * @}
// */
/** @defgroup USBD_HID_Exported_Defines
* @{
*/
#ifndef HID_EPIN_ADDR
#define HID_EPIN_ADDR 0x81U
#endif /* HID_EPIN_ADDR */
#define HID_EPIN_SIZE 0x04U
#define HID_EPIN_SIZE 0x0EU
#define USB_HID_CONFIG_DESC_SIZ 34U
#define USB_HID_DESC_SIZ 9U
#define HID_MOUSE_REPORT_DESC_SIZE 63U
#define HID_MOUSE_REPORT_DESC_SIZE 0x2DU
#define HID_DESCRIPTOR_TYPE 0x21U
#define HID_REPORT_DESC 0x22U
@@ -72,10 +107,6 @@ extern "C" {
* @}
*/
/** @defgroup USBD_CORE_Exported_TypesDefinitions
* @{
*/
typedef enum
{
USBD_HID_IDLE = 0,

View File

@@ -157,8 +157,8 @@ __ALIGN_BEGIN static uint8_t USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ] __ALIGN_E
0x00, /* bAlternateSetting: Alternate setting */
0x01, /* bNumEndpoints */
0x03, /* bInterfaceClass: HID */
0x01, /* bInterfaceSubClass : 1=BOOT, 0=no boot */
0x01, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
0x00, /* bInterfaceSubClass : 1=BOOT, 0=no boot */
0x0, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
0, /* iInterface: Index of string descriptor */
/******************** Descriptor of Joystick Mouse HID ********************/
/* 18 */
@@ -219,38 +219,69 @@ __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)
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
// 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
// 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 (96 bits = 12 bytes)
0x05, 0x07, // Usage Page (Keyboard/Keypad)
0x19, 0x04, // Usage Minimum (4) — 'A' key
0x29, 0x63, // Usage Maximum (99) — 96 keys total (4 to 99)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1 bit)
0x95, 0x60, // Report Count (96 bits)
0x81, 0x02, // Input (Data, Variable, Absolute)
0xC0 // End Collection
};
static uint8_t HIDInEpAdd = HID_EPIN_ADDR;

View File

@@ -0,0 +1,2 @@
Hello World
No module named 'KLEPlacement'Bye

View File

@@ -440,6 +440,7 @@
"single_global_label": "ignore",
"unannotated": "error",
"unconnected_wire_endpoint": "warning",
"undefined_netclass": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"