boards: arm: gd32f450i_eval: enable pwm support

Enable timer1 and its pwm node. The board does not directly have any LED
connected to a PWM output. However, following the official
"TIMER_Breath_LED" example, user can bridge PB10 (TIMER1_CH2) to PE2
(LED1) to run quick samples such as samples/basic/blinky_pwm.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2021-12-12 23:56:59 +01:00 committed by Maureen Helm
commit 4d7e099215
4 changed files with 31 additions and 0 deletions

View file

@ -68,6 +68,9 @@ The board configuration supports the following hardware features:
* - NVIC
- N/A
- :dtcompatible:`arm,v7m-nvic`
* - PWM
- :kconfig:`CONFIG_PWM`
- :dtcompatible:`gd,gd32-pwm`
* - SYSTICK
- N/A
- N/A

View file

@ -17,4 +17,10 @@
pinmux = <DAC_OUT0_PA4>;
};
};
pwm1_default: pwm1_default {
group1 {
pinmux = <TIMER1_CH2_PB10>;
};
};
};

View file

@ -51,10 +51,20 @@
};
};
pwmleds {
compatible = "pwm-leds";
/* NOTE: bridge TIMER1_CH2 (PB10) and LED1 (PE2) */
pwm_led: pwm_led {
pwms = <&pwm1 2 PWM_POLARITY_NORMAL>;
};
};
aliases {
led0 = &led1;
led1 = &led2;
sw0 = &user_key;
pwm-led0 = &pwm_led;
};
};
@ -90,3 +100,13 @@
pinctrl-0 = <&dac_default>;
pinctrl-names = "default";
};
&timer1 {
status = "okay";
pwm1: pwm {
status = "okay";
pinctrl-0 = <&pwm1_default>;
pinctrl-names = "default";
};
};

View file

@ -11,3 +11,5 @@ toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- pwm