Skip to content

Commit c6f4be6

Browse files
committed
nano_matter: add PWM support
1 parent c17630f commit c6f4be6

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ CONFIG_BT_HCI_TX_STACK_SIZE=4096
88

99
CONFIG_FPU=y
1010
CONFIG_I2C=y
11+
CONFIG_PWM=y

variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@
4343
<&gpioc 4 0>, /* 26 Serial Tx */
4444
<&gpioc 5 0>; /* 27 Serial Rx */
4545

46+
builtin-led-gpios = <&gpioc 1 GPIO_ACTIVE_LOW>, /* 22 LED R */
47+
<&gpioc 2 GPIO_ACTIVE_LOW>, /* 23 LED G */
48+
<&gpioc 3 GPIO_ACTIVE_LOW>; /* 24 LED B */
49+
50+
pwm-pin-gpios = <&gpiob 0 0>, /* A0 */
51+
<&gpiob 2 0>, /* A1 */
52+
<&gpiob 5 0>; /* A2 */
53+
54+
pwms = <&timer0_pwm 0 255 PWM_POLARITY_INVERTED>,
55+
<&timer0_pwm 1 255 PWM_POLARITY_INVERTED>,
56+
<&timer0_pwm 2 255 PWM_POLARITY_INVERTED>;
57+
4658
builtin-led-gpios = <&gpioc 1 0>;
4759
serials = <&usart0>;
4860
i2cs = <&i2c0>;
@@ -55,3 +67,23 @@
5567
clock-frequency = <I2C_BITRATE_STANDARD>;
5668
status = "okay";
5769
};
70+
71+
&timer0 {
72+
status = "okay";
73+
74+
timer0_pwm: pwm {
75+
pinctrl-0 = <&timer0_default>;
76+
pinctrl-names = "default";
77+
status = "okay";
78+
};
79+
};
80+
81+
&pinctrl {
82+
timer0_default: timer0_default {
83+
group0 {
84+
pins = <TIMER0_CC0_PB0>, <TIMER0_CC1_PB2>, <TIMER0_CC2_PB5>;
85+
drive-push-pull;
86+
output-high;
87+
};
88+
};
89+
};

variants/arduino_nano_matter_mgm240sd22vna/variant.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@
66
#define SS 10
77
#define SDA 4
88
#define SCL 5
9+
10+
#define LED_BUILTIN_1 23
11+
#define LED_BUILTIN_2 24
12+
#define LED_BUILTIN_ACTIVE (LOW)
13+
#define LED_BUILTIN_INACTIVE (!LED_BUILTIN_ACTIVE)
14+
15+
#define BTN_BUILTIN 25

0 commit comments

Comments
 (0)