From c2e9c1fa49d5d2671b23fa49de42b70b296052bc Mon Sep 17 00:00:00 2001 From: Dimitris Tassopoulos Date: Sun, 7 Jun 2020 21:34:45 +0200 Subject: [PATCH] boards: nucleo_f401re: added pwm-led0 Added onboard led to the devicetree to be supported also with pwm-led0 Signed-off-by: Dimitris Tassopoulos --- boards/arm/nucleo_f401re/nucleo_f401re.dts | 8 ++++++++ boards/arm/nucleo_f401re/pinmux.c | 2 +- drivers/pinmux/stm32/pinmux_stm32f4.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/boards/arm/nucleo_f401re/nucleo_f401re.dts b/boards/arm/nucleo_f401re/nucleo_f401re.dts index ff50828bc04..2610d7890ce 100644 --- a/boards/arm/nucleo_f401re/nucleo_f401re.dts +++ b/boards/arm/nucleo_f401re/nucleo_f401re.dts @@ -29,6 +29,13 @@ }; }; + pwmleds { + compatible = "pwm-leds"; + green_pwm_led: green_pwm_led { + pwms = <&pwm2 1 0>; + }; + }; + gpio_keys { compatible = "gpio-keys"; user_button: button { @@ -40,6 +47,7 @@ aliases { led0 = &green_led_2; sw0 = &user_button; + pwm-led0 = &green_pwm_led; }; }; diff --git a/boards/arm/nucleo_f401re/pinmux.c b/boards/arm/nucleo_f401re/pinmux.c index 8970e2bc1c3..966fbdd195a 100644 --- a/boards/arm/nucleo_f401re/pinmux.c +++ b/boards/arm/nucleo_f401re/pinmux.c @@ -23,7 +23,7 @@ static const struct pin_config pinconf[] = { {STM32_PIN_PA3, STM32F4_PINMUX_FUNC_PA3_USART2_RX}, #endif #if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm2), okay) && CONFIG_PWM - {STM32_PIN_PA0, STM32F4_PINMUX_FUNC_PA0_PWM2_CH1}, + {STM32_PIN_PA5, STM32F4_PINMUX_FUNC_PA5_PWM2_CH1}, #endif #if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) && CONFIG_I2C {STM32_PIN_PB8, STM32F4_PINMUX_FUNC_PB8_I2C1_SCL}, diff --git a/drivers/pinmux/stm32/pinmux_stm32f4.h b/drivers/pinmux/stm32/pinmux_stm32f4.h index c72f1b97800..f2eb0d3478f 100644 --- a/drivers/pinmux/stm32/pinmux_stm32f4.h +++ b/drivers/pinmux/stm32/pinmux_stm32f4.h @@ -77,6 +77,8 @@ #define STM32F4_PINMUX_FUNC_PA4_ADC12_IN4 \ STM32_MODER_ANALOG_MODE +#define STM32F4_PINMUX_FUNC_PA5_PWM2_CH1 \ + (STM32_PINMUX_ALT_FUNC_1 | STM32_PUSHPULL_PULLUP) #define STM32F4_PINMUX_FUNC_PA5_SPI1_SCK \ (STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL | \ STM32_OSPEEDR_VERY_HIGH_SPEED)