some config changes
This commit is contained in:
16
firmware/core/Core/.vscode/c_cpp_properties.json
vendored
Normal file
16
firmware/core/Core/.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"version": 4,
|
||||
"configurations": [
|
||||
{
|
||||
/**
|
||||
* ms-vscode.cmake-tools plugin should be installed.
|
||||
*
|
||||
* It provides data for C/C++ plugin,
|
||||
* such as include paths, browse paths, defines, etc.
|
||||
*/
|
||||
"name": "STM32",
|
||||
"configurationProvider": "ms-vscode.cmake-tools",
|
||||
"intelliSenseMode": "${default}"
|
||||
}
|
||||
]
|
||||
}
|
||||
19
firmware/core/Core/.vscode/extensions.json
vendored
Normal file
19
firmware/core/Core/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"ms-vscode.cpptools", // (dependencies to ms-vscode.cpptools-extension-pack)
|
||||
"ms-vscode.cpptools-themes", // (dependencies to ms-vscode.cpptools-extension-pack)
|
||||
"ms-vscode.cmake-tools", // (dependencies to ms-vscode.cpptools-extension-pack)
|
||||
"twxs.cmake", // (dependencies to ms-vscode.cpptools-extension-pack)
|
||||
"ms-vscode.cpptools-extension-pack", // Provides CMake and C++ file coloring, completion & support
|
||||
"dan-c-underwood.arm", // Provides syntax highlighting for the Arm Assembly language
|
||||
"zixuanwang.linkerscript", // Provides syntax highlighting for linker scripts
|
||||
"ms-vscode.hexeditor", // Provides hex editor fo viewing & anipulating files in their raw hexadecimal representation
|
||||
"trond-snekvik.gnu-mapfiles", // Provides syntax highlighting and symbol listing for GNU linker .map files
|
||||
"jeff-hykin.better-cpp-syntax", // Provides syntax highlighting for C++
|
||||
"marus25.cortex-debug", // Provides debug support on Arm Cortex-M
|
||||
"mcu-debug.debug-tracker-vscode", // Dependencies to "marus25.cortex-debug"
|
||||
"mcu-debug.memory-view", // Dependencies to "marus25.cortex-debug"
|
||||
"mcu-debug.peripheral-viewer", // Dependencies to "marus25.cortex-debug"
|
||||
"mcu-debug.rtos-views" // Dependencies to "marus25.cortex-debug"
|
||||
]
|
||||
}
|
||||
61
firmware/core/Core/.vscode/launch.json
vendored
Normal file
61
firmware/core/Core/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Build & Debug Microcontroller - ST-Link",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"type": "cortex-debug",
|
||||
"executable": "${command:cmake.launchTargetPath}",
|
||||
// Let CMake extension decide executable: "${command:cmake.launchTargetPath}"
|
||||
// Or fixed file path: "${workspaceFolder}/path/to/filename.elf"
|
||||
"request": "launch",
|
||||
"servertype": "stlink",
|
||||
"device": "STM32F446RETx", //MCU used
|
||||
"interface": "swd",
|
||||
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
|
||||
"runToEntryPoint": "main",
|
||||
"svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32F446.svd",
|
||||
"v1": false, //Change it depending on ST Link version
|
||||
"serverpath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",
|
||||
"stm32cubeprogrammer":"${config:STM32VSCodeExtension.cubeCLT.path}/STM32CubeProgrammer/bin",
|
||||
"stlinkPath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",
|
||||
"armToolchainPath": "${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin",
|
||||
"gdbPath":"${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin/arm-none-eabi-gdb",
|
||||
"serverArgs": [
|
||||
"-m","0",
|
||||
],
|
||||
//"preLaunchTask": "Build + Flash"
|
||||
/* If you use external loader, add additional arguments */
|
||||
//"serverArgs": ["--extload", "path/to/ext/loader.stldr"],
|
||||
},
|
||||
{
|
||||
"name": "Attach to Microcontroller - ST-Link",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"type": "cortex-debug",
|
||||
"executable": "${command:cmake.launchTargetPath}",
|
||||
// Let CMake extension decide executable: "${command:cmake.launchTargetPath}"
|
||||
// Or fixed file path: "${workspaceFolder}/path/to/filename.elf"
|
||||
"request": "attach",
|
||||
"servertype": "stlink",
|
||||
"device": "STM32F446RETx", //MCU used
|
||||
"interface": "swd",
|
||||
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
|
||||
"runToEntryPoint": "main",
|
||||
"svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32F446.svd",
|
||||
"v1": false, //Change it depending on ST Link version
|
||||
"serverpath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",
|
||||
"stm32cubeprogrammer":"${config:STM32VSCodeExtension.cubeCLT.path}/STM32CubeProgrammer/bin",
|
||||
"stlinkPath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",
|
||||
"armToolchainPath": "${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin",
|
||||
"gdbPath":"${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin/arm-none-eabi-gdb",
|
||||
"serverArgs": [
|
||||
"-m","0",
|
||||
],
|
||||
/* If you use external loader, add additional arguments */
|
||||
//"serverArgs": ["--extload", "path/to/ext/loader.stldr"],
|
||||
}
|
||||
]
|
||||
}
|
||||
62
firmware/core/Core/.vscode/tasks.json
vendored
Normal file
62
firmware/core/Core/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"windows": {
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "cmd.exe",
|
||||
"args": ["/d", "/c"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "CubeProg: Flash project (SWD)",
|
||||
"command": "STM32_Programmer_CLI",
|
||||
"args": [
|
||||
"--connect",
|
||||
"port=swd",
|
||||
"--download",
|
||||
"${command:cmake.launchTargetPath}",
|
||||
// Let CMake extension decide executable: "${command:cmake.launchTargetPath}",
|
||||
"-hardRst", // Hardware reset - if rst pin is connected
|
||||
"-rst", // Software reset (backup)
|
||||
"--start" // Start execution
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Build + Flash",
|
||||
"dependsOrder": "sequence",
|
||||
"dependsOn": [
|
||||
"CMake: clean rebuild",
|
||||
"CubeProg: Flash project (SWD)",
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "cmake",
|
||||
"label": "CMake: clean rebuild",
|
||||
"command": "cleanRebuild",
|
||||
"targets": [
|
||||
"all"
|
||||
],
|
||||
"preset": "${command:cmake.activeBuildPresetName}",
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"detail": "CMake template clean rebuild task"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "CubeProg: List all available communication interfaces",
|
||||
"command": "STM32_Programmer_CLI",
|
||||
"args": ["--list"],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
61
firmware/core/Core/CMakePresets.json
Normal file
61
firmware/core/Core/CMakePresets.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"toolchainFile": "${sourceDir}/cmake/gcc-arm-none-eabi.cmake",
|
||||
"cacheVariables": {
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"inherits": "default",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "relWithDebInfo",
|
||||
"inherits": "default",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"inherits": "default",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "minSizeRel",
|
||||
"inherits": "default",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "MinSizeRel"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "debug",
|
||||
"configurePreset": "debug"
|
||||
},
|
||||
{
|
||||
"name": "relWithDebInfo",
|
||||
"configurePreset": "relWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"configurePreset": "release"
|
||||
},
|
||||
{
|
||||
"name": "minSizeRel",
|
||||
"configurePreset": "minSizeRel"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -29,6 +29,14 @@ typedef struct{
|
||||
uint8_t KEYPRESS[12];
|
||||
} HIDReportNKRO;
|
||||
|
||||
typedef struct{
|
||||
uint8_t MODIFIER;
|
||||
uint8_t RESERVED;
|
||||
uint8_t KEYPRESS[6]; // for 6 Key Rollover, changed index to 6.
|
||||
} HIDReport6KRO;
|
||||
|
||||
extern USBD_HandleTypeDef hUsbDeviceFS;
|
||||
|
||||
DMA_QUEUE RxQueue;
|
||||
uint8_t DMA_RX_BUFFER_N[4];
|
||||
uint8_t DMA_RX_BUFFER_E[4];
|
||||
@@ -84,7 +92,12 @@ int main(void)
|
||||
MX_USART2_UART_Init();
|
||||
MX_USB_DEVICE_Init();
|
||||
|
||||
CURRENT_MODE = MODE_INACTIVE;
|
||||
CURRENT_MODE = MODE_MASTER;
|
||||
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_RESET);
|
||||
|
||||
while (1)
|
||||
{
|
||||
@@ -176,22 +189,28 @@ int main(void)
|
||||
break;
|
||||
|
||||
case MODE_MASTER:
|
||||
DMA_Queue_Init(&RxQueue);
|
||||
// DMA_Queue_Init(&RxQueue);
|
||||
|
||||
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);
|
||||
}
|
||||
//Send USB Report
|
||||
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&USB_REPORT, sizeof(USB_REPORT));
|
||||
// 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);
|
||||
// }
|
||||
// //Send USB Report
|
||||
// USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&USB_REPORT, sizeof(USB_REPORT));
|
||||
|
||||
HAL_Delay(20);
|
||||
// HAL_Delay(20);
|
||||
addHIDReport(KEY_A, 1);
|
||||
HAL_Delay(500);
|
||||
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&USB_REPORT, sizeof(USB_REPORT));
|
||||
addHIDReport(KEY_A, 0);
|
||||
HAL_Delay(500);
|
||||
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&USB_REPORT, sizeof(USB_REPORT));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -575,6 +594,14 @@ static void MX_GPIO_Init(void)
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_5; // PA5
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; // Push-pull output
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL; // No pull-up/down
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET); // Turn LED off initially
|
||||
|
||||
/* USER CODE BEGIN MX_GPIO_Init_2 */
|
||||
|
||||
/* USER CODE END MX_GPIO_Init_2 */
|
||||
|
||||
Reference in New Issue
Block a user