mirror of
https://github.com/odriverobotics/ODrive.git
synced 2025-12-17 14:34:15 +08:00
enable GPIO clocks on demand
This commit is contained in:
4
Firmware/.vscode/launch.json
vendored
4
Firmware/.vscode/launch.json
vendored
@@ -32,7 +32,7 @@
|
||||
"openOCDLaunchCommands": [
|
||||
"reset_config none separate"
|
||||
],
|
||||
"svdFile": "${workspaceRoot}/Board/v4/STM32F7x.svd",
|
||||
"svdFile": "${workspaceRoot}/Private/v4/STM32F722.svd",
|
||||
"cwd": "${workspaceRoot}"
|
||||
},
|
||||
{
|
||||
@@ -85,7 +85,7 @@
|
||||
"interface/stlink.cfg",
|
||||
"target/stm32f7x.cfg",
|
||||
],
|
||||
"svdFile": "${workspaceRoot}/Board/v4/STM32F722.svd",
|
||||
"svdFile": "${workspaceRoot}/Private/v4/STM32F722.svd",
|
||||
"cwd": "${workspaceRoot}"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -43,8 +43,25 @@ IRQn_Type get_irq_number(uint16_t pin_number) {
|
||||
|
||||
|
||||
bool Stm32Gpio::config(uint32_t mode, uint32_t pull, uint32_t speed) {
|
||||
if (!port_)
|
||||
if (port_ == GPIOA) {
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
} else if (port_ == GPIOB) {
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
} else if (port_ == GPIOC) {
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
} else if (port_ == GPIOD) {
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
} else if (port_ == GPIOE) {
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
} else if (port_ == GPIOF) {
|
||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||
} else if (port_ == GPIOG) {
|
||||
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||
} else if (port_ == GPIOH) {
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t position = get_pin_number();
|
||||
|
||||
|
||||
Submodule Firmware/Private updated: aeae8a9cea...3ad39794bb
Reference in New Issue
Block a user