boards: stm32f411e_disco: Add pwm to drive green led

This enables the fade_led example to work with this board.

Signed-off-by: Pauli Salmenrinne <susundberg@gmail.com>
This commit is contained in:
Pauli Salmenrinne 2019-12-04 17:53:23 +02:00 committed by Maureen Helm
parent 537f3332f0
commit ca6eee5444
5 changed files with 33 additions and 1 deletions

View file

@ -13,6 +13,14 @@ if UART_CONSOLE
config UART_2
default y
if PWM
config PWM_STM32_4
default y
endif # PWM
endif # UART_CONSOLE
endif # BOARD_STM32F411E_DISCO

View file

@ -83,6 +83,8 @@ hardware features:
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| PWM | on-chip | pwm |
+-----------+------------+-------------------------------------+
Other hardware features are not yet supported on Zephyr porting.
@ -103,7 +105,7 @@ Default Zephyr Peripheral Mapping:
- UART_2_TX : PA2
- UART_2_RX : PA3
- LD3 : PD13
- LD4 : PD12
- LD4 : PD12 (PWM4 CH1)
- LD5 : PD14
- LD6 : PD15

View file

@ -18,6 +18,9 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA2, STM32F4_PINMUX_FUNC_PA2_USART2_TX},
{STM32_PIN_PA3, STM32F4_PINMUX_FUNC_PA3_USART2_RX},
#endif /* CONFIG_UART_2 */
#ifdef CONFIG_PWM_STM32_4
{STM32_PIN_PD12, STM32F4_PINMUX_FUNC_PD12_PWM4_CH1 },
#endif /* CONFIG_PWM_STM32_4 */
};
static int pinmux_stm32_init(struct device *port)

View file

@ -38,6 +38,13 @@
};
};
pwmleds {
compatible = "pwm-leds";
green_pwm_led: green_pwm_led {
pwms = <&{/soc/timers@40000800/pwm} 1 0>;
};
};
gpio_keys {
compatible = "gpio-keys";
user_button: button {
@ -52,9 +59,19 @@
led2 = &red_led_5;
led3 = &blue_led_6;
sw0 = &user_button;
pwm-led0 = &green_pwm_led;
};
};
&timers4 {
status = "okay";
pwm {
status = "okay";
};
};
&usart2 {
current-speed = <115200>;
status = "okay";

View file

@ -407,6 +407,8 @@
#define STM32F4_PINMUX_FUNC_PD12_USART3_RTS \
(STM32_PINMUX_ALT_FUNC_7 | STM32_OPENDRAIN_PULLUP)
#define STM32F4_PINMUX_FUNC_PD12_PWM4_CH1 \
(STM32_PINMUX_ALT_FUNC_2 | STM32_PUSHPULL_NOPULL)
#define STM32F4_PINMUX_FUNC_PD14_PWM4_CH3 \
(STM32_PINMUX_ALT_FUNC_2 | STM32_PUSHPULL_NOPULL)