diff --git a/boards/arm/ucans32k1sic/doc/index.rst b/boards/arm/ucans32k1sic/doc/index.rst index 1291eeb98904..efeb6911d7e5 100644 --- a/boards/arm/ucans32k1sic/doc/index.rst +++ b/boards/arm/ucans32k1sic/doc/index.rst @@ -49,6 +49,7 @@ GPIO on-chip gpio LPUART on-chip serial LPI2C on-chip i2c LPSPI on-chip spi +FTM on-chip pwm ============ ========== ================================ The default configuration can be found in the Kconfig file @@ -67,15 +68,30 @@ children nodes with the desired pinmux configuration to the singleton node LEDs ---- -The UCANS32K1SIC board has one user RGB LED: - -======================= ============== ===== -Devicetree node Label Pin -======================= ============== ===== -led0 / led1_red LED1_RGB_RED PTD15 -led1 / led1_green LED1_RGB_GREEN PTD16 -led2 / led1_blue LED1_RGB_BLUE PTD0 -======================= ============== ===== +The UCANS32K1SIC board has one user RGB LED that can be used either as a GPIO +LED or as a PWM LED. + +.. table:: RGB LED as GPIO LED + :widths: auto + + =============== ================ =============== ===== + Devicetree node Devicetree alias Label Pin + =============== ================ =============== ===== + led1_red led0 LED1_RGB_RED PTD15 + led1_green led1 LED1_RGB_GREEN PTD16 + led1_blue led2 LED1_RGB_BLUE PTD0 + =============== ================ =============== ===== + +.. table:: RGB LED as PWM LED + :widths: auto + + =============== ======================== ================== ================ + Devicetree node Devicetree alias Label Pin + =============== ======================== ================== ================ + led1_red_pwm pwm-led0 / red-pwm-led LED1_RGB_RED_PWM PTD15 / FTM0_CH0 + led1_green_pwm pwm-led1 / green-pwm-led LED1_RGB_GREEN_PWM PTD16 / FTM0_CH1 + led1_blue_pwm pwm-led2 / blue-pwm-led LED1_RGB_BLUE_PWM PTD0 / FTM0_CH2 + =============== ======================== ================== ================ The user can control the LEDs in any way. An output of ``0`` illuminates the LED. diff --git a/boards/arm/ucans32k1sic/ucans32k1sic-pinctrl.dtsi b/boards/arm/ucans32k1sic/ucans32k1sic-pinctrl.dtsi index d3926d9866e9..b1451d26287d 100644 --- a/boards/arm/ucans32k1sic/ucans32k1sic-pinctrl.dtsi +++ b/boards/arm/ucans32k1sic/ucans32k1sic-pinctrl.dtsi @@ -37,4 +37,27 @@ drive-strength = "low"; }; }; + + ftm0_default: ftm0_default { + group0 { + pinmux = , + , + ; + drive-strength = "low"; + }; + }; + + ftm1_default: ftm1_default { + group0 { + pinmux = ; + drive-strength = "low"; + }; + }; + + ftm2_default: ftm2_default { + group0 { + pinmux = ; + drive-strength = "low"; + }; + }; }; diff --git a/boards/arm/ucans32k1sic/ucans32k1sic.dts b/boards/arm/ucans32k1sic/ucans32k1sic.dts index 49b30d168e28..23a380b4c449 100644 --- a/boards/arm/ucans32k1sic/ucans32k1sic.dts +++ b/boards/arm/ucans32k1sic/ucans32k1sic.dts @@ -7,6 +7,7 @@ /dts-v1/; #include #include +#include #include #include "ucans32k1sic-pinctrl.dtsi" @@ -26,6 +27,13 @@ led0 = &led1_red; led1 = &led1_green; led2 = &led1_blue; + pwm-led0 = &led1_red_pwm; + pwm-led1 = &led1_green_pwm; + pwm-led2 = &led1_blue_pwm; + red-pwm-led = &led1_red_pwm; + green-pwm-led = &led1_green_pwm; + blue-pwm-led = &led1_blue_pwm; + pwm-0 = &ftm0; sw0 = &button_3; i2c-0 = &lpi2c0; }; @@ -47,6 +55,23 @@ }; }; + pwmleds { + compatible = "pwm-leds"; + + led1_red_pwm: led_pwm_0 { + pwms = <&ftm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + label = "LED1_RGB_RED_PWM"; + }; + led1_green_pwm: led_pwm_1 { + pwms = <&ftm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + label = "LED1_RGB_GREEN_PWM"; + }; + led1_blue_pwm: led_pwm_2 { + pwms = <&ftm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + label = "LED1_RGB_BLUE_PWM"; + }; + }; + gpio_keys { compatible = "gpio-keys"; @@ -104,3 +129,28 @@ pinctrl-names = "default"; status = "okay"; }; + +&ftm0 { + compatible = "nxp,kinetis-ftm-pwm"; + pinctrl-0 = <&ftm0_default>; + pinctrl-names = "default"; + prescaler = <128>; + #pwm-cells = <3>; + status = "okay"; +}; + +&ftm1 { + compatible = "nxp,kinetis-ftm-pwm"; + pinctrl-0 = <&ftm1_default>; + pinctrl-names = "default"; + #pwm-cells = <3>; + status = "okay"; +}; + +&ftm2 { + compatible = "nxp,kinetis-ftm-pwm"; + pinctrl-0 = <&ftm2_default>; + pinctrl-names = "default"; + #pwm-cells = <3>; + status = "okay"; +}; diff --git a/boards/arm/ucans32k1sic/ucans32k1sic.yaml b/boards/arm/ucans32k1sic/ucans32k1sic.yaml index 8519980aa60a..fd0b23a40b9d 100644 --- a/boards/arm/ucans32k1sic/ucans32k1sic.yaml +++ b/boards/arm/ucans32k1sic/ucans32k1sic.yaml @@ -17,3 +17,4 @@ supported: - pinctrl - i2c - spi + - pwm