Skip to content

Commit 284bc9d

Browse files
committed
dts: Rename SW._GPIO_* -> DT_ALIAS_SW._GPIOS_*
We use the following commands to rename any SW._GPIO_{CONTROLLER,PIN,FLAGS} to DT_ALIAS_SW._GPIOS_{CONTROLLER,PIN,FLAGS} git grep -l SW._GPIO_CONTROLLER | xargs sed -i 's/SW\(.\)_GPIO_CONTROLLER/DT_ALIAS_SW\1_GPIOS_CONTROLLER/g' git grep -l SW._GPIO_PIN | xargs sed -i 's/SW\(.\)_GPIO_PIN/DT_ALIAS_SW\1_GPIOS_PIN/g' git grep -l SW._GPIO_FLAGS | xargs sed -i 's/SW\(.\)_GPIO_FLAGS/DT_ALIAS_SW\1_GPIOS_FLAGS/g' Signed-off-by: Kumar Gala <[email protected]>
1 parent b7d4b00 commit 284bc9d

File tree

20 files changed

+197
-196
lines changed

20 files changed

+197
-196
lines changed

boards/arm/warp7_m4/pinmux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static int warp7_m4_pinmux_init(struct device *dev)
2020
IOMUXC_SW_PAD_CTL_PAD_ENET1_RGMII_RD0_DSE(0);
2121
#endif
2222

23-
#ifdef SW0_GPIO_PIN
23+
#ifdef DT_ALIAS_SW0_GPIOS_PIN
2424
IOMUXC_SW_MUX_CTL_PAD_ENET1_RGMII_RD1 =
2525
IOMUXC_SW_MUX_CTL_PAD_ENET1_RGMII_RD1_MUX_MODE(5);
2626
#endif

doc/guides/dts/index.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,15 @@ the format specified by the YAML bindings. For example:
406406
#define DT_GPIO_KEYS_BUTTON_0_GPIOS_FLAGS 0
407407
#define DT_GPIO_KEYS_BUTTON_0_GPIOS_PIN 6
408408
#define DT_GPIO_KEYS_BUTTON_0_LABEL "User SW2"
409-
#define DT_GPIO_KEYS_SW1_GPIOS_CONTROLLER DT_GPIO_KEYS_BUTTON_0_GPIOS_CONTROLLER
410-
#define DT_GPIO_KEYS_SW1_GPIOS_FLAGS DT_GPIO_KEYS_BUTTON_0_GPIOS_FLAGS
411-
#define DT_GPIO_KEYS_SW1_GPIOS_PIN DT_GPIO_KEYS_BUTTON_0_GPIOS_PIN
412-
#define DT_GPIO_KEYS_SW1_LABEL DT_GPIO_KEYS_BUTTON_0_LABEL
413-
#define SW1_GPIO_CONTROLLER DT_GPIO_KEYS_BUTTON_0_GPIOS_CONTROLLER
414-
#define SW1_GPIO_FLAGS DT_GPIO_KEYS_BUTTON_0_GPIOS_FLAGS
415-
#define SW1_GPIO_PIN DT_GPIO_KEYS_BUTTON_0_GPIOS_PIN
416-
#define SW1_LABEL DT_GPIO_KEYS_BUTTON_0_LABEL
409+
410+
#define DT_GPIO_KEYS_SW1_GPIOS_CONTROLLER DT_GPIO_KEYS_BUTTON_0_GPIOS_CONTROLLER
411+
#define DT_GPIO_KEYS_SW1_GPIOS_FLAGS DT_GPIO_KEYS_BUTTON_0_GPIOS_FLAGS
412+
#define DT_GPIO_KEYS_SW1_GPIOS_PIN DT_GPIO_KEYS_BUTTON_0_GPIOS_PIN
413+
#define DT_ALIAS_SW1_GPIOS_CONTROLLE DT_GPIO_KEYS_BUTTON_0_GPIOS_CONTROLLER
414+
#define DT_ALIAS_SW1_GPIOS_FLAGS DT_GPIO_KEYS_BUTTON_0_GPIOS_FLAGS
415+
#define DT_ALIAS_SW1_GPIOS_PIN DT_GPIO_KEYS_BUTTON_0_GPIOS_PIN
416+
#define DT_ALIAS_SW1_LABEL DT_GPIO_KEYS_BUTTON_0_LABEL
417+
417418
418419
Additionally, a file named ``generated_dts_board_fixups.h`` is
419420
generated in the same directory concatenating all board-related fixup files.

samples/basic/button/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ have defined the SW0_* variables.
1818
To use this sample, you will require a board that defines the user switch in its
1919
header file. The :file:`board.h` must define the following variables:
2020

21-
- SW0_GPIO_NAME (or SW0_GPIO_CONTROLLER)
22-
- SW0_GPIO_PIN
21+
- SW0_GPIO_NAME (or DT_ALIAS_SW0_GPIOS_CONTROLLER)
22+
- DT_ALIAS_SW0_GPIOS_PIN
2323

2424
Alternatively, this could also be done by defining 'sw0' alias in the board
2525
device tree description file.

samples/basic/button/src/main.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,42 @@
1111
#include <sys/printk.h>
1212

1313
/* change this to use another GPIO port */
14-
#ifndef SW0_GPIO_CONTROLLER
14+
#ifndef DT_ALIAS_SW0_GPIOS_CONTROLLER
1515
#ifdef SW0_GPIO_NAME
16-
#define SW0_GPIO_CONTROLLER SW0_GPIO_NAME
16+
#define DT_ALIAS_SW0_GPIOS_CONTROLLER SW0_GPIO_NAME
1717
#else
18-
#error SW0_GPIO_NAME or SW0_GPIO_CONTROLLER needs to be set in board.h
18+
#error SW0_GPIO_NAME or DT_ALIAS_SW0_GPIOS_CONTROLLER needs to be set in board.h
1919
#endif
2020
#endif
21-
#define PORT SW0_GPIO_CONTROLLER
21+
#define PORT DT_ALIAS_SW0_GPIOS_CONTROLLER
2222

2323
/* change this to use another GPIO pin */
24-
#ifdef SW0_GPIO_PIN
25-
#define PIN SW0_GPIO_PIN
24+
#ifdef DT_ALIAS_SW0_GPIOS_PIN
25+
#define PIN DT_ALIAS_SW0_GPIOS_PIN
2626
#else
27-
#error SW0_GPIO_PIN needs to be set in board.h
27+
#error DT_ALIAS_SW0_GPIOS_PIN needs to be set in board.h
2828
#endif
2929

3030
/* change to use another GPIO pin interrupt config */
31-
#ifdef SW0_GPIO_FLAGS
32-
#define EDGE (SW0_GPIO_FLAGS | GPIO_INT_EDGE)
31+
#ifdef DT_ALIAS_SW0_GPIOS_FLAGS
32+
#define EDGE (DT_ALIAS_SW0_GPIOS_FLAGS | GPIO_INT_EDGE)
3333
#else
3434
/*
35-
* If SW0_GPIO_FLAGS not defined used default EDGE value.
35+
* If DT_ALIAS_SW0_GPIOS_FLAGS not defined used default EDGE value.
3636
* Change this to use a different interrupt trigger
3737
*/
3838
#define EDGE (GPIO_INT_EDGE | GPIO_INT_ACTIVE_LOW)
3939
#endif
4040

4141
/* change this to enable pull-up/pull-down */
42-
#ifndef SW0_GPIO_FLAGS
43-
#ifdef SW0_GPIO_PIN_PUD
44-
#define SW0_GPIO_FLAGS SW0_GPIO_PIN_PUD
42+
#ifndef DT_ALIAS_SW0_GPIOS_FLAGS
43+
#ifdef DT_ALIAS_SW0_GPIOS_PIN_PUD
44+
#define DT_ALIAS_SW0_GPIOS_FLAGS DT_ALIAS_SW0_GPIOS_PIN_PUD
4545
#else
46-
#define SW0_GPIO_FLAGS 0
46+
#define DT_ALIAS_SW0_GPIOS_FLAGS 0
4747
#endif
4848
#endif
49-
#define PULL_UP SW0_GPIO_FLAGS
49+
#define PULL_UP DT_ALIAS_SW0_GPIOS_FLAGS
5050

5151
/* Sleep time */
5252
#define SLEEP_TIME 500

samples/bluetooth/mesh/src/microbit.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ static void configure_button(void)
3030
{
3131
static struct gpio_callback button_cb;
3232

33-
gpio = device_get_binding(SW0_GPIO_CONTROLLER);
33+
gpio = device_get_binding(DT_ALIAS_SW0_GPIOS_CONTROLLER);
3434

35-
gpio_pin_configure(gpio, SW0_GPIO_PIN,
35+
gpio_pin_configure(gpio, DT_ALIAS_SW0_GPIOS_PIN,
3636
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
3737
GPIO_INT_ACTIVE_LOW));
3838

39-
gpio_init_callback(&button_cb, button_pressed, BIT(SW0_GPIO_PIN));
39+
gpio_init_callback(&button_cb, button_pressed, BIT(DT_ALIAS_SW0_GPIOS_PIN));
4040

4141
gpio_add_callback(gpio, &button_cb);
4242
}
@@ -52,7 +52,7 @@ void board_output_number(bt_mesh_output_action_t action, u32_t number)
5252

5353
oob_number = number;
5454

55-
gpio_pin_enable_callback(gpio, SW0_GPIO_PIN);
55+
gpio_pin_enable_callback(gpio, DT_ALIAS_SW0_GPIOS_PIN);
5656

5757
mb_display_image(disp, MB_DISPLAY_MODE_DEFAULT, K_FOREVER, &arrow, 1);
5858
}
@@ -67,7 +67,7 @@ void board_prov_complete(void)
6767
{ 0, 1, 1, 1, 0 });
6868

6969

70-
gpio_pin_disable_callback(gpio, SW0_GPIO_PIN);
70+
gpio_pin_disable_callback(gpio, DT_ALIAS_SW0_GPIOS_PIN);
7171

7272
mb_display_image(disp, MB_DISPLAY_MODE_DEFAULT, K_SECONDS(10),
7373
&arrow, 1);

samples/bluetooth/mesh_demo/src/microbit.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static void button_pressed(struct device *dev, struct gpio_callback *cb,
4646
{
4747
struct mb_display *disp = mb_display_get();
4848

49-
if (pins & BIT(SW0_GPIO_PIN)) {
49+
if (pins & BIT(DT_ALIAS_SW0_GPIOS_PIN)) {
5050
k_work_submit(&button_work);
5151
} else {
5252
u16_t target = board_set_target();
@@ -227,21 +227,21 @@ static void configure_button(void)
227227

228228
k_work_init(&button_work, button_send_pressed);
229229

230-
gpio = device_get_binding(SW0_GPIO_CONTROLLER);
230+
gpio = device_get_binding(DT_ALIAS_SW0_GPIOS_CONTROLLER);
231231

232-
gpio_pin_configure(gpio, SW0_GPIO_PIN,
232+
gpio_pin_configure(gpio, DT_ALIAS_SW0_GPIOS_PIN,
233233
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
234234
GPIO_INT_ACTIVE_LOW));
235-
gpio_pin_configure(gpio, SW1_GPIO_PIN,
235+
gpio_pin_configure(gpio, DT_ALIAS_SW1_GPIOS_PIN,
236236
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
237237
GPIO_INT_ACTIVE_LOW));
238238

239239
gpio_init_callback(&button_cb, button_pressed,
240-
BIT(SW0_GPIO_PIN) | BIT(SW1_GPIO_PIN));
240+
BIT(DT_ALIAS_SW0_GPIOS_PIN) | BIT(DT_ALIAS_SW1_GPIOS_PIN));
241241
gpio_add_callback(gpio, &button_cb);
242242

243-
gpio_pin_enable_callback(gpio, SW0_GPIO_PIN);
244-
gpio_pin_enable_callback(gpio, SW1_GPIO_PIN);
243+
gpio_pin_enable_callback(gpio, DT_ALIAS_SW0_GPIOS_PIN);
244+
gpio_pin_enable_callback(gpio, DT_ALIAS_SW1_GPIOS_PIN);
245245
}
246246

247247
void board_init(u16_t *addr)

samples/boards/bbc_microbit/pong/src/main.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static void button_pressed(struct device *dev, struct gpio_callback *cb,
395395
u32_t pins)
396396
{
397397
/* Filter out spurious presses */
398-
if (pins & BIT(SW0_GPIO_PIN)) {
398+
if (pins & BIT(DT_ALIAS_SW0_GPIOS_PIN)) {
399399
printk("A pressed\n");
400400
if (k_uptime_delta(&a_timestamp) < K_MSEC(100)) {
401401
printk("Too quick A presses\n");
@@ -423,7 +423,7 @@ static void button_pressed(struct device *dev, struct gpio_callback *cb,
423423
return;
424424
}
425425

426-
if (pins & BIT(SW0_GPIO_PIN)) {
426+
if (pins & BIT(DT_ALIAS_SW0_GPIOS_PIN)) {
427427
if (select) {
428428
pong_select_change();
429429
return;
@@ -486,20 +486,20 @@ static void configure_buttons(void)
486486
static struct gpio_callback button_cb;
487487
struct device *gpio;
488488

489-
gpio = device_get_binding(SW0_GPIO_CONTROLLER);
489+
gpio = device_get_binding(DT_ALIAS_SW0_GPIOS_CONTROLLER);
490490

491-
gpio_pin_configure(gpio, SW0_GPIO_PIN,
491+
gpio_pin_configure(gpio, DT_ALIAS_SW0_GPIOS_PIN,
492492
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
493493
GPIO_INT_ACTIVE_LOW));
494-
gpio_pin_configure(gpio, SW1_GPIO_PIN,
494+
gpio_pin_configure(gpio, DT_ALIAS_SW1_GPIOS_PIN,
495495
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
496496
GPIO_INT_ACTIVE_LOW));
497497
gpio_init_callback(&button_cb, button_pressed,
498-
BIT(SW0_GPIO_PIN) | BIT(SW1_GPIO_PIN));
498+
BIT(DT_ALIAS_SW0_GPIOS_PIN) | BIT(DT_ALIAS_SW1_GPIOS_PIN));
499499
gpio_add_callback(gpio, &button_cb);
500500

501-
gpio_pin_enable_callback(gpio, SW0_GPIO_PIN);
502-
gpio_pin_enable_callback(gpio, SW1_GPIO_PIN);
501+
gpio_pin_enable_callback(gpio, DT_ALIAS_SW0_GPIOS_PIN);
502+
gpio_pin_enable_callback(gpio, DT_ALIAS_SW1_GPIOS_PIN);
503503
}
504504

505505
void main(void)

samples/boards/bbc_microbit/sound/src/main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void button_pressed(struct device *dev, struct gpio_callback *cb,
5757

5858
beep_active = true;
5959

60-
if (pins & BIT(SW0_GPIO_PIN)) {
60+
if (pins & BIT(DT_ALIAS_SW0_GPIOS_PIN)) {
6161
printk("A pressed\n");
6262
if (period < PERIOD_MAX) {
6363
period += 50U;
@@ -82,16 +82,16 @@ void main(void)
8282
{
8383
static struct gpio_callback button_cb;
8484

85-
gpio = device_get_binding(SW0_GPIO_CONTROLLER);
85+
gpio = device_get_binding(DT_ALIAS_SW0_GPIOS_CONTROLLER);
8686

87-
gpio_pin_configure(gpio, SW0_GPIO_PIN,
87+
gpio_pin_configure(gpio, DT_ALIAS_SW0_GPIOS_PIN,
8888
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
8989
GPIO_INT_ACTIVE_LOW));
90-
gpio_pin_configure(gpio, SW1_GPIO_PIN,
90+
gpio_pin_configure(gpio, DT_ALIAS_SW1_GPIOS_PIN,
9191
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
9292
GPIO_INT_ACTIVE_LOW));
9393
gpio_init_callback(&button_cb, button_pressed,
94-
BIT(SW0_GPIO_PIN) | BIT(SW1_GPIO_PIN));
94+
BIT(DT_ALIAS_SW0_GPIOS_PIN) | BIT(DT_ALIAS_SW1_GPIOS_PIN));
9595
gpio_add_callback(gpio, &button_cb);
9696

9797
pwm = device_get_binding(CONFIG_PWM_NRF5_SW_0_DEV_NAME);
@@ -100,6 +100,6 @@ void main(void)
100100
/* Notify with a beep that we've started */
101101
k_work_submit(&beep_work);
102102

103-
gpio_pin_enable_callback(gpio, SW0_GPIO_PIN);
104-
gpio_pin_enable_callback(gpio, SW1_GPIO_PIN);
103+
gpio_pin_enable_callback(gpio, DT_ALIAS_SW0_GPIOS_PIN);
104+
gpio_pin_enable_callback(gpio, DT_ALIAS_SW1_GPIOS_PIN);
105105
}

samples/boards/nrf52/mesh/onoff-app/src/main.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,10 @@ static u8_t dev_uuid[16] = { 0xdd, 0xdd };
419419
static uint8_t pin_to_sw(uint32_t pin_pos)
420420
{
421421
switch (pin_pos) {
422-
case BIT(SW0_GPIO_PIN): return 0;
423-
case BIT(SW1_GPIO_PIN): return 1;
424-
case BIT(SW2_GPIO_PIN): return 2;
425-
case BIT(SW3_GPIO_PIN): return 3;
422+
case BIT(DT_ALIAS_SW0_GPIOS_PIN): return 0;
423+
case BIT(DT_ALIAS_SW1_GPIOS_PIN): return 1;
424+
case BIT(DT_ALIAS_SW2_GPIOS_PIN): return 2;
425+
case BIT(DT_ALIAS_SW3_GPIOS_PIN): return 3;
426426
}
427427

428428
printk("No match for GPIO pin 0x%08x\n", pin_pos);
@@ -612,27 +612,27 @@ void main(void)
612612
/* Initialize button count timer */
613613
k_timer_init(&sw.button_timer, button_cnt_timer, NULL);
614614

615-
sw_device = device_get_binding(SW0_GPIO_CONTROLLER);
616-
gpio_pin_configure(sw_device, SW0_GPIO_PIN,
615+
sw_device = device_get_binding(DT_ALIAS_SW0_GPIOS_CONTROLLER);
616+
gpio_pin_configure(sw_device, DT_ALIAS_SW0_GPIOS_PIN,
617617
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
618618
GPIO_INT_ACTIVE_LOW | GPIO_PUD_PULL_UP));
619-
gpio_pin_configure(sw_device, SW1_GPIO_PIN,
619+
gpio_pin_configure(sw_device, DT_ALIAS_SW1_GPIOS_PIN,
620620
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
621621
GPIO_INT_ACTIVE_LOW | GPIO_PUD_PULL_UP));
622-
gpio_pin_configure(sw_device, SW2_GPIO_PIN,
622+
gpio_pin_configure(sw_device, DT_ALIAS_SW2_GPIOS_PIN,
623623
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
624624
GPIO_INT_ACTIVE_LOW | GPIO_PUD_PULL_UP));
625-
gpio_pin_configure(sw_device, SW3_GPIO_PIN,
625+
gpio_pin_configure(sw_device, DT_ALIAS_SW3_GPIOS_PIN,
626626
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
627627
GPIO_INT_ACTIVE_LOW | GPIO_PUD_PULL_UP));
628628
gpio_init_callback(&button_cb, button_pressed,
629-
BIT(SW0_GPIO_PIN) | BIT(SW1_GPIO_PIN) |
630-
BIT(SW2_GPIO_PIN) | BIT(SW3_GPIO_PIN));
629+
BIT(DT_ALIAS_SW0_GPIOS_PIN) | BIT(DT_ALIAS_SW1_GPIOS_PIN) |
630+
BIT(DT_ALIAS_SW2_GPIOS_PIN) | BIT(DT_ALIAS_SW3_GPIOS_PIN));
631631
gpio_add_callback(sw_device, &button_cb);
632-
gpio_pin_enable_callback(sw_device, SW0_GPIO_PIN);
633-
gpio_pin_enable_callback(sw_device, SW1_GPIO_PIN);
634-
gpio_pin_enable_callback(sw_device, SW2_GPIO_PIN);
635-
gpio_pin_enable_callback(sw_device, SW3_GPIO_PIN);
632+
gpio_pin_enable_callback(sw_device, DT_ALIAS_SW0_GPIOS_PIN);
633+
gpio_pin_enable_callback(sw_device, DT_ALIAS_SW1_GPIOS_PIN);
634+
gpio_pin_enable_callback(sw_device, DT_ALIAS_SW2_GPIOS_PIN);
635+
gpio_pin_enable_callback(sw_device, DT_ALIAS_SW3_GPIOS_PIN);
636636

637637
/* Initialize LED's */
638638
init_led(0, LED0_GPIO_CONTROLLER, LED0_GPIO_PIN);

samples/boards/nrf52/mesh/onoff_level_lighting_vnd_app/src/app_gpio.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,39 +50,39 @@ void app_gpio_init(void)
5050

5151
k_work_init(&button_work, publish);
5252

53-
button_device[0] = device_get_binding(SW0_GPIO_CONTROLLER);
54-
gpio_pin_configure(button_device[0], SW0_GPIO_PIN,
53+
button_device[0] = device_get_binding(DT_ALIAS_SW0_GPIOS_CONTROLLER);
54+
gpio_pin_configure(button_device[0], DT_ALIAS_SW0_GPIOS_PIN,
5555
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
5656
GPIO_PUD_PULL_UP |
5757
GPIO_INT_DEBOUNCE | GPIO_INT_ACTIVE_LOW));
58-
gpio_init_callback(&button_cb[0], button_pressed, BIT(SW0_GPIO_PIN));
58+
gpio_init_callback(&button_cb[0], button_pressed, BIT(DT_ALIAS_SW0_GPIOS_PIN));
5959
gpio_add_callback(button_device[0], &button_cb[0]);
60-
gpio_pin_enable_callback(button_device[0], SW0_GPIO_PIN);
60+
gpio_pin_enable_callback(button_device[0], DT_ALIAS_SW0_GPIOS_PIN);
6161

62-
button_device[1] = device_get_binding(SW1_GPIO_CONTROLLER);
63-
gpio_pin_configure(button_device[1], SW1_GPIO_PIN,
62+
button_device[1] = device_get_binding(DT_ALIAS_SW1_GPIOS_CONTROLLER);
63+
gpio_pin_configure(button_device[1], DT_ALIAS_SW1_GPIOS_PIN,
6464
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
6565
GPIO_PUD_PULL_UP |
6666
GPIO_INT_DEBOUNCE | GPIO_INT_ACTIVE_LOW));
67-
gpio_init_callback(&button_cb[1], button_pressed, BIT(SW1_GPIO_PIN));
67+
gpio_init_callback(&button_cb[1], button_pressed, BIT(DT_ALIAS_SW1_GPIOS_PIN));
6868
gpio_add_callback(button_device[1], &button_cb[1]);
69-
gpio_pin_enable_callback(button_device[1], SW1_GPIO_PIN);
69+
gpio_pin_enable_callback(button_device[1], DT_ALIAS_SW1_GPIOS_PIN);
7070

71-
button_device[2] = device_get_binding(SW2_GPIO_CONTROLLER);
72-
gpio_pin_configure(button_device[2], SW2_GPIO_PIN,
71+
button_device[2] = device_get_binding(DT_ALIAS_SW2_GPIOS_CONTROLLER);
72+
gpio_pin_configure(button_device[2], DT_ALIAS_SW2_GPIOS_PIN,
7373
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
7474
GPIO_PUD_PULL_UP |
7575
GPIO_INT_DEBOUNCE | GPIO_INT_ACTIVE_LOW));
76-
gpio_init_callback(&button_cb[2], button_pressed, BIT(SW2_GPIO_PIN));
76+
gpio_init_callback(&button_cb[2], button_pressed, BIT(DT_ALIAS_SW2_GPIOS_PIN));
7777
gpio_add_callback(button_device[2], &button_cb[2]);
78-
gpio_pin_enable_callback(button_device[2], SW2_GPIO_PIN);
78+
gpio_pin_enable_callback(button_device[2], DT_ALIAS_SW2_GPIOS_PIN);
7979

80-
button_device[3] = device_get_binding(SW3_GPIO_CONTROLLER);
81-
gpio_pin_configure(button_device[3], SW3_GPIO_PIN,
80+
button_device[3] = device_get_binding(DT_ALIAS_SW3_GPIOS_CONTROLLER);
81+
gpio_pin_configure(button_device[3], DT_ALIAS_SW3_GPIOS_PIN,
8282
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
8383
GPIO_PUD_PULL_UP |
8484
GPIO_INT_DEBOUNCE | GPIO_INT_ACTIVE_LOW));
85-
gpio_init_callback(&button_cb[3], button_pressed, BIT(SW3_GPIO_PIN));
85+
gpio_init_callback(&button_cb[3], button_pressed, BIT(DT_ALIAS_SW3_GPIOS_PIN));
8686
gpio_add_callback(button_device[3], &button_cb[3]);
87-
gpio_pin_enable_callback(button_device[3], SW3_GPIO_PIN);
87+
gpio_pin_enable_callback(button_device[3], DT_ALIAS_SW3_GPIOS_PIN);
8888
}

0 commit comments

Comments
 (0)