Skip to content

Commit 07a976e

Browse files
authored
Merge pull request #13 from bcmi-labs/rgb-pins
unoq: Add RGB pins to Uno Q variant
2 parents 8fec86c + 6928d6c commit 07a976e

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

cores/arduino/Arduino.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
#undef DIGITAL_PIN_CHECK_UNIQUE
3838
#endif
3939

40+
// Helper macro to get Arduino pin number from device tree alias
41+
#define DIGITAL_PIN_GPIOS_FIND_NODE(node) \
42+
DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(node, gpios, 0)), \
43+
DT_PHA_BY_IDX(node, gpios, 0, pin))
44+
4045
#ifndef LED_BUILTIN
4146

4247
/* Return the index of it if matched, oterwise return 0 */

variants/b_u585i_iot02a_stm32u585xx/b_u585i_iot02a_stm32u585xx.overlay

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,40 @@
1111
zephyr,bt-hci = &usart1; // TODO remove
1212
zephyr,camera = &dcmi;
1313
};
14+
15+
leds {
16+
compatible = "gpio-leds";
17+
18+
led3_red: led3_red {
19+
gpios = <&gpioh 10 GPIO_ACTIVE_LOW>;
20+
label = "RGB LED 3 Red";
21+
};
22+
23+
led3_green: led3_green {
24+
gpios = <&gpioh 11 GPIO_ACTIVE_LOW>;
25+
label = "RGB LED 3 Green";
26+
};
27+
28+
led3_blue: led3_blue {
29+
gpios = <&gpioh 12 GPIO_ACTIVE_LOW>;
30+
label = "RGB LED 3 Blue";
31+
};
32+
33+
led4_red: led4_red {
34+
gpios = <&gpioh 13 GPIO_ACTIVE_LOW>;
35+
label = "RGB LED 4 Red";
36+
};
37+
38+
led4_green: led4_green {
39+
gpios = <&gpioh 14 GPIO_ACTIVE_LOW>;
40+
label = "RGB LED 4 Green";
41+
};
42+
43+
led4_blue: led4_blue {
44+
gpios = <&gpioh 15 GPIO_ACTIVE_LOW>;
45+
label = "RGB LED 4 Blue";
46+
};
47+
};
1448
};
1549

1650

variants/b_u585i_iot02a_stm32u585xx/variant.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@
1919
#define AR_INTERNAL1V8 4
2020
#define AR_EXTERNAL 5
2121
#define AR_INTERNAL AR_INTERNAL2V5
22+
23+
// RGB LEDs Pin Map
24+
#define LED3_R DIGITAL_PIN_GPIOS_FIND_NODE(DT_NODELABEL(led3_red))
25+
#define LED3_G DIGITAL_PIN_GPIOS_FIND_NODE(DT_NODELABEL(led3_green))
26+
#define LED3_B DIGITAL_PIN_GPIOS_FIND_NODE(DT_NODELABEL(led3_blue))
27+
28+
#define LED4_R DIGITAL_PIN_GPIOS_FIND_NODE(DT_NODELABEL(led4_red))
29+
#define LED4_G DIGITAL_PIN_GPIOS_FIND_NODE(DT_NODELABEL(led4_green))
30+
#define LED4_B DIGITAL_PIN_GPIOS_FIND_NODE(DT_NODELABEL(led4_blue))

0 commit comments

Comments
 (0)