boards: frdm_mcxc242: Add pwm support

frdm_mcxc242 has tpm ip for pwm generation, but it is not enabled.
Configure and enable it. Add pwmleds definition and disable it,
as leds and pwmleds are mutually exclusive.
Update board documentation.

Signed-off-by: Michal Smola <michal.smola@nxp.com>
This commit is contained in:
Michal Smola 2024-09-10 08:10:46 +02:00 committed by Fabio Baltieri
parent 3cfcfa7947
commit 9e8a8db9dc
4 changed files with 56 additions and 1 deletions

View file

@ -66,6 +66,8 @@ The ``frdm_mcxc242`` board target supports the following hardware features:
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| PWM | on-chip | pwm |
+-----------+------------+-------------------------------------+
Targets available

View file

@ -25,4 +25,20 @@
slew-rate = "fast";
};
};
pinmux_tpm1: pinmux_tpm1 {
group0 {
pinmux = <TPM1_CH0_PTA12>,
<TPM1_CH1_PTA13>;
drive-strength = "low";
slew-rate = "slow";
};
};
pinmux_tpm2: pinmux_tpm2 {
group0 {
pinmux = <TPM2_CH0_PTB18>,
<TPM2_CH1_PTB19>;
drive-strength = "low";
slew-rate = "slow";
};
};
};

View file

@ -17,10 +17,17 @@
aliases {
led0 = &red_led;
led1 = &green_led;
led2 = &red_led;
led2 = &blue_led;
pwm-led0 = &red_pwm_led;
pwm-led1 = &green_pwm_led;
pwm-led2 = &blue_pwm_led;
red-pwm-led = &red_pwm_led;
green-pwm-led = &green_pwm_led;
blue-pwm-led = &blue_pwm_led;
sw0 = &user_button_2;
sw1 = &user_button_3;
accel0 = &fxls8974;
pwm-0 = &tpm1;
};
chosen {
@ -46,6 +53,23 @@
};
};
pwmleds {
compatible = "pwm-leds";
status = "disabled";
red_pwm_led: pwm_led_0 {
pwms = <&tpm2 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
label = "PWM Red LED";
};
green_pwm_led: pwm_led_1 {
pwms = <&tpm2 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
label = "PWM Green LED";
};
blue_pwm_led: pwm_led_2 {
pwms = <&tpm1 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
label = "PWM Blue LED";
};
};
gpio_keys {
compatible = "gpio-keys";
user_button_2: button_2 {
@ -111,3 +135,15 @@ i2c1: &i2c1 {
int2-gpios = <&gpioc 3 GPIO_ACTIVE_LOW>;
};
};
&tpm1 {
status = "okay";
pinctrl-0 = <&pinmux_tpm1>;
pinctrl-names = "default";
};
&tpm2 {
status = "okay";
pinctrl-0 = <&pinmux_tpm2>;
pinctrl-names = "default";
};

View file

@ -17,6 +17,7 @@ toolchain:
supported:
- gpio
- i2c
- pwm
testing:
ignore_tags:
- net