prototype mainboard done!

This commit is contained in:
2025-07-15 11:41:31 -07:00
parent d47641e164
commit 323a11e9ca
8 changed files with 35 additions and 40 deletions

View File

@@ -36,8 +36,8 @@
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Src",
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Middlewares/ST/STM32_USB_Device_Library/Core/Inc",
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Middlewares/ST/STM32_USB_Device_Library/Core/Src",
"/home/kymkim/Projects/CSULB/modular-kbd/firmware/components/mainboard/stmf446retx/Src",
"/home/kymkim/Projects/CSULB/modular-kbd/firmware/components/mainboard/stmf446retx/Inc",
"/home/kymkim/Projects/modular-kbd/firmware/mainboard/stmf446retx/Src",
"/home/kymkim/Projects/modular-kbd/firmware/mainboard/stmf446retx/Inc",
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Drivers/CMSIS/Include",
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Drivers/CMSIS/Device/ST/STM32F4xx/Include",
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Drivers/STM32F4xx_HAL_Driver/Inc",
@@ -128,8 +128,8 @@
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Src",
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Middlewares/ST/STM32_USB_Device_Library/Core/Inc",
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Middlewares/ST/STM32_USB_Device_Library/Core/Src",
"/home/kymkim/Projects/CSULB/modular-kbd/firmware/components/mainboard/stmf446retx/Src",
"/home/kymkim/Projects/CSULB/modular-kbd/firmware/components/mainboard/stmf446retx/Inc",
"/home/kymkim/Projects/modular-kbd/firmware/mainboard/stmf446retx/Src",
"/home/kymkim/Projects/modular-kbd/firmware/mainboard/stmf446retx/Inc",
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Drivers/CMSIS/Include",
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Drivers/CMSIS/Device/ST/STM32F4xx/Include",
"/home/kymkim/.platformio/packages/framework-stm32cubef4/Drivers/STM32F4xx_HAL_Driver/Inc",

View File

@@ -12,7 +12,7 @@
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug",
"executable": "/home/kymkim/Projects/CSULB/modular-kbd/firmware/components/mainboard/stmf446retx/.pio/build/nucleo_f446re/firmware.elf",
"executable": "/home/kymkim/Projects/modular-kbd/firmware/mainboard/stmf446retx/.pio/build/nucleo_f446re/firmware.elf",
"projectEnvName": "nucleo_f446re",
"toolchainBinDir": "/home/kymkim/.platformio/packages/toolchain-gccarmnoneeabi/bin",
"internalConsoleOptions": "openOnSessionStart",
@@ -26,7 +26,7 @@
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug (skip Pre-Debug)",
"executable": "/home/kymkim/Projects/CSULB/modular-kbd/firmware/components/mainboard/stmf446retx/.pio/build/nucleo_f446re/firmware.elf",
"executable": "/home/kymkim/Projects/modular-kbd/firmware/mainboard/stmf446retx/.pio/build/nucleo_f446re/firmware.elf",
"projectEnvName": "nucleo_f446re",
"toolchainBinDir": "/home/kymkim/.platformio/packages/toolchain-gccarmnoneeabi/bin",
"internalConsoleOptions": "openOnSessionStart",
@@ -36,7 +36,7 @@
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug (without uploading)",
"executable": "/home/kymkim/Projects/CSULB/modular-kbd/firmware/components/mainboard/stmf446retx/.pio/build/nucleo_f446re/firmware.elf",
"executable": "/home/kymkim/Projects/modular-kbd/firmware/mainboard/stmf446retx/.pio/build/nucleo_f446re/firmware.elf",
"projectEnvName": "nucleo_f446re",
"toolchainBinDir": "/home/kymkim/.platformio/packages/toolchain-gccarmnoneeabi/bin",
"internalConsoleOptions": "openOnSessionStart",

View File

@@ -57,12 +57,11 @@ void MX_CAN1_Init(void)
CAN_FilterTypeDef canfilterconf;
canfilterconf.FilterActivation = CAN_FILTER_ENABLE;
canfilterconf.FilterBank = 0;
canfilterconf.FilterFIFOAssignment = CAN_FILTER_FIFO1;
canfilterconf.FilterIdHigh = 0x399 << 5;
canfilterconf.FilterIdLow = 0x0000;
canfilterconf.FilterMaskIdHigh = 0x7FF << 5;
canfilterconf.FilterFIFOAssignment = CAN_FILTER_FIFO0;
canfilterconf.FilterIdHigh = 0x100 << 5;
canfilterconf.FilterIdLow = 0x0000;
canfilterconf.FilterMaskIdHigh = 0x7FF << 5; // Exact match mask
canfilterconf.FilterMaskIdLow = 0x0000;
canfilterconf.FilterMode = CAN_FILTERMODE_IDMASK;
canfilterconf.FilterScale = CAN_FILTERSCALE_32BIT;
HAL_CAN_ConfigFilter(&hcan1, &canfilterconf);
/* USER CODE END CAN1_Init 2 */

View File

@@ -33,7 +33,7 @@
typedef struct{
uint8_t MODIFIER;
uint8_t RESERVED;
uint8_t KEYPRESS[13];
uint8_t KEYPRESS[12];
} HIDReportNKRO;
typedef struct{
@@ -134,22 +134,18 @@ int main(void)
while (1)
{
//Keycode Scan
// memset(REPORT.KEYPRESS, 0, 6); // Clear keypresses at the start of each scan for 6 key rollover
// Clear keypresses at the start of each scan for 6 key rollover
/* USER CODE END WHILE */
for(int col = 0; col < COLS; col++){
HAL_GPIO_WritePin(col_pins[col].PORT, col_pins[col].PIN, GPIO_PIN_SET);
HAL_Delay(1);
for(int row = 0; row < ROWS; row++){
if(HAL_GPIO_ReadPin(row_pins[row].PORT, row_pins[row].PIN)){
addHIDReport(matrix[row][col], 1);
}else{
addHIDReport(matrix[row][col], 0);
}
}
HAL_GPIO_WritePin(col_pins[col].PORT, col_pins[col].PIN, GPIO_PIN_RESET);
}
// for(int col = 0; col < COLS; col++){
// HAL_GPIO_WritePin(col_pins[col].PORT, col_pins[col].PIN, GPIO_PIN_SET);
// HAL_Delay(1);
// for(int row = 0; row < ROWS; row++){
// if(HAL_GPIO_ReadPin(row_pins[row].PORT, row_pins[row].PIN)){
// addHIDReport(matrix[row][col], 1);
// }
// }
// HAL_GPIO_WritePin(col_pins[col].PORT, col_pins[col].PIN, GPIO_PIN_RESET);
// }
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&REPORT, sizeof(REPORT));
HAL_Delay(20);
/* USER CODE BEGIN 3 */
@@ -160,7 +156,7 @@ int main(void)
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
{
HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &RxHeader, RxData);
addHIDReport(RxData[0], (RxData[1] & (1 << 7)) ? 1 : 0);
addHIDReport(RxData[0], (RxData[1] & 0x01) ? 1 : 0);
}
/**
* @brief System Clock Configuration