Skip to content

Commit 426c9cb

Browse files
larsgkcarlescufi
authored andcommitted
pwm: Add PWM support for nRF5340 Audio DK RGB LED
Adding PWM support for the center RGB LED to allow for fancy disco lights, suitable for an audio development kit. Signed-off-by: Lars Knudsen <[email protected]>
1 parent 6dc20d5 commit 426c9cb

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_common-pinctrl.dtsi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@
6666
};
6767
};
6868

69+
pwm0_default: pwm0_default {
70+
group1 {
71+
psels = <NRF_PSEL(PWM_OUT0, 0, 7)>,
72+
<NRF_PSEL(PWM_OUT1, 0, 25)>,
73+
<NRF_PSEL(PWM_OUT2, 0, 26)>;
74+
};
75+
};
76+
77+
pwm0_sleep: pwm0_sleep {
78+
group1 {
79+
psels = <NRF_PSEL(PWM_OUT0, 0, 7)>,
80+
<NRF_PSEL(PWM_OUT1, 0, 25)>,
81+
<NRF_PSEL(PWM_OUT2, 0, 26)>;
82+
low-power-enable;
83+
};
84+
};
85+
6986
spi4_default: spi4_default {
7087
group1 {
7188
psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,

boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@
2929
compatible = "nordic,npm1100";
3030
nordic,iset-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
3131
};
32+
33+
pwmleds {
34+
compatible = "pwm-leds";
35+
rgb1_red_pwm_led: pwm_led_0 {
36+
pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
37+
};
38+
rgb1_green_pwm_led: pwm_led_1 {
39+
pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
40+
};
41+
rgb1_blue_pwm_led: pwm_led_2 {
42+
pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
43+
};
44+
};
45+
46+
aliases {
47+
pwm-led0 = &rgb1_red_pwm_led;
48+
pwm-led1 = &rgb1_green_pwm_led;
49+
pwm-led2 = &rgb1_blue_pwm_led;
50+
red-pwm-led = &rgb1_red_pwm_led;
51+
green-pwm-led = &rgb1_green_pwm_led;
52+
blue-pwm-led = &rgb1_blue_pwm_led;
53+
};
3254
};
3355

3456
&adc {
@@ -140,6 +162,9 @@
140162

141163
&pwm0 {
142164
status = "okay";
165+
pinctrl-0 = <&pwm0_default>;
166+
pinctrl-1 = <&pwm0_sleep>;
167+
pinctrl-names = "default", "sleep";
143168
};
144169

145170
&timer0 {

0 commit comments

Comments
 (0)