diff options
Diffstat (limited to 'teensy/hal_gpio.c')
| -rw-r--r-- | teensy/hal_gpio.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/teensy/hal_gpio.c b/teensy/hal_gpio.c index 218560e29..e65d03410 100644 --- a/teensy/hal_gpio.c +++ b/teensy/hal_gpio.c @@ -17,7 +17,6 @@ void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init) if ((GPIO_Init->Pin & bitmask) == 0) { continue; } - volatile uint32_t *port_pcr = GPIO_PIN_TO_PORT_PCR(GPIOx, position); /*--------------------- GPIO Mode Configuration ------------------------*/ @@ -50,6 +49,8 @@ void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init) /* Check the Speed parameter */ assert_param(IS_GPIO_SPEED(GPIO_Init->Speed)); + *port_pcr |= PORT_PCR_DSE; + /* Configure the IO Speed */ if (GPIO_Init->Speed > GPIO_SPEED_MEDIUM) { *port_pcr &= ~PORT_PCR_SRE; @@ -59,10 +60,12 @@ void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init) /* Configure the IO Output Type */ if (GPIO_Init->Mode & GPIO_OUTPUT_TYPE) { - *port_pcr |= PORT_PCR_ODE; + *port_pcr |= PORT_PCR_ODE; // OD } else { - *port_pcr &= ~PORT_PCR_ODE; + *port_pcr &= ~PORT_PCR_ODE; // PP } + } else { + *port_pcr &= ~PORT_PCR_DSE; } /* Activate the Pull-up or Pull down resistor for the current IO */ |
