diff --git a/boards/arm/frdm_k64f/board.h b/boards/arm/frdm_k64f/board.h index 1b77e4fee17..39d984a6c10 100644 --- a/boards/arm/frdm_k64f/board.h +++ b/boards/arm/frdm_k64f/board.h @@ -9,42 +9,4 @@ #include -/* Push button switch 2 */ -#define SW2_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME -#define SW2_GPIO_PIN 6 - -/* Push button switch 3 */ -#define SW3_GPIO_NAME CONFIG_GPIO_MCUX_PORTA_NAME -#define SW3_GPIO_PIN 4 - -/* Red LED */ -#define RED_GPIO_NAME CONFIG_GPIO_MCUX_PORTB_NAME -#define RED_GPIO_PIN 22 - -/* Green LED */ -#define GREEN_GPIO_NAME CONFIG_GPIO_MCUX_PORTE_NAME -#define GREEN_GPIO_PIN 26 - -/* Blue LED */ -#define BLUE_GPIO_NAME CONFIG_GPIO_MCUX_PORTB_NAME -#define BLUE_GPIO_PIN 21 - -/* LED0. There is no physical LED on the board with this name, so create an - * alias to the green LED to make various samples work. - */ -#define LED0_GPIO_PORT GREEN_GPIO_NAME -#define LED0_GPIO_PIN GREEN_GPIO_PIN - -/* LED1. There is no physical LED on the board with this name, so create an - * alias to the blue LED to make various samples work. - */ -#define LED1_GPIO_PORT BLUE_GPIO_NAME -#define LED1_GPIO_PIN BLUE_GPIO_PIN - -/* Push button switch 0. There is no physical switch on the board with this - * name, so create an alias to SW3 to make the basic button sample work. - */ -#define SW0_GPIO_NAME SW3_GPIO_NAME -#define SW0_GPIO_PIN SW3_GPIO_PIN - #endif /* __INC_BOARD_H */ diff --git a/boards/arm/frdm_k64f/frdm_k64f.dts b/boards/arm/frdm_k64f/frdm_k64f.dts index 1f5670b60f5..323ac48f9b8 100644 --- a/boards/arm/frdm_k64f/frdm_k64f.dts +++ b/boards/arm/frdm_k64f/frdm_k64f.dts @@ -28,6 +28,11 @@ i2c-0 = &i2c0; i2c-1 = &i2c1; i2c-2 = &i2c2; + led0 = &green_led; + led1 = &blue_led; + led2 = &red_led; + sw0 = &user_button_3; + sw1 = &user_button_2; }; chosen { @@ -39,6 +44,36 @@ #endif zephyr,uart-pipe = &uart0; }; + + leds { + compatible = "gpio-leds"; + red_led: led@0 { + gpios = <&gpiob 22 GPIO_INT_ACTIVE_LOW>; + label = "User LD1"; + }; + green_led: led@1 { + gpios = <&gpioe 26 GPIO_INT_ACTIVE_LOW>; + label = "User LD2"; + }; + blue_led: led@2 { + gpios = <&gpiob 21 GPIO_INT_ACTIVE_LOW>; + label = "User LD3"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + user_button_2: button@0 { + label = "User SW2"; + gpios = <&gpioc 6 GPIO_INT_ACTIVE_LOW>; + }; + user_button_3: button@1 { + label = "User SW3"; + gpios = <&gpioa 4 GPIO_INT_ACTIVE_LOW>; + }; + }; }; &adc0 { diff --git a/boards/arm/frdm_kl25z/board.h b/boards/arm/frdm_kl25z/board.h index 1075ed20145..b704de405c1 100644 --- a/boards/arm/frdm_kl25z/board.h +++ b/boards/arm/frdm_kl25z/board.h @@ -9,42 +9,4 @@ #include -/* Push button switch for test purposes */ -#define SW0_TEST_GPIO_NAME CONFIG_GPIO_MCUX_PORTA_NAME -#define SW0_TEST_GPIO_PIN 16 - -/* Push button switch for test purposes */ -#define SW1_TEST_GPIO_NAME CONFIG_GPIO_MCUX_PORTA_NAME -#define SW1_TEST_GPIO_PIN 17 - -/* Red LED */ -#define RED_GPIO_NAME CONFIG_GPIO_MCUX_PORTB_NAME -#define RED_GPIO_PIN 18 - -/* Green LED */ -#define GREEN_GPIO_NAME CONFIG_GPIO_MCUX_PORTB_NAME -#define GREEN_GPIO_PIN 19 - -/* Blue LED */ -#define BLUE_GPIO_NAME CONFIG_GPIO_MCUX_PORTD_NAME -#define BLUE_GPIO_PIN 1 - -/* LED0. There is no physical LED on the board with this name, so create an - * alias to the green LED to make various samples work. - */ -#define LED0_GPIO_PORT GREEN_GPIO_NAME -#define LED0_GPIO_PIN GREEN_GPIO_PIN - -/* LED1. There is no physical LED on the board with this name, so create an - * alias to the blue LED to make various samples work. - */ -#define LED1_GPIO_PORT BLUE_GPIO_NAME -#define LED1_GPIO_PIN BLUE_GPIO_PIN - -/* Push button switch 0. There is no physical switch on the board, - * so an push button must be added to such pins for basic button sample work. - */ -#define SW0_GPIO_NAME SW0_TEST_GPIO_NAME -#define SW0_GPIO_PIN SW0_TEST_GPIO_PIN - #endif /* __INC_BOARD_H */ diff --git a/boards/arm/frdm_kl25z/frdm_kl25z.dts b/boards/arm/frdm_kl25z/frdm_kl25z.dts index 814366ed95a..b5c2b2107e0 100644 --- a/boards/arm/frdm_kl25z/frdm_kl25z.dts +++ b/boards/arm/frdm_kl25z/frdm_kl25z.dts @@ -11,6 +11,16 @@ uart-0 = &uart0; i2c-0 = &i2c0; i2c-1 = &i2c1; + gpio-a = &gpioa; + gpio-b = &gpiob; + gpio-c = &gpioc; + gpio-d = &gpiod; + gpio-e = &gpioe; + led0 = &green_led; + led1 = &blue_led; + led2 = &red_led; + sw0 = &user_button_0; + sw1 = &user_button_1; }; chosen { @@ -18,6 +28,36 @@ zephyr,flash = &flash0; zephyr,console = &uart0; }; + + leds { + compatible = "gpio-leds"; + red_led: led@0 { + gpios = <&gpiob 18 GPIO_INT_ACTIVE_LOW>; + label = "User LD1"; + }; + green_led: led@1 { + gpios = <&gpiob 19 GPIO_INT_ACTIVE_LOW>; + label = "User LD2"; + }; + blue_led: led@2 { + gpios = <&gpiod 1 GPIO_INT_ACTIVE_LOW>; + label = "User LD3"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + user_button_0: button@0 { + label = "User SW0"; + gpios = <&gpioa 16 GPIO_INT_ACTIVE_LOW>; + }; + user_button_1: button@1 { + label = "User SW1"; + gpios = <&gpioa 17 GPIO_INT_ACTIVE_LOW>; + }; + }; }; &adc0 { diff --git a/boards/arm/frdm_kw41z/board.h b/boards/arm/frdm_kw41z/board.h index 8a736d5a26d..b704de405c1 100644 --- a/boards/arm/frdm_kw41z/board.h +++ b/boards/arm/frdm_kw41z/board.h @@ -9,42 +9,4 @@ #include -/* Push button switch 3 */ -#define SW3_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME -#define SW3_GPIO_PIN 4 - -/* Push button switch 4 */ -#define SW4_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME -#define SW4_GPIO_PIN 5 - -/* Red LED */ -#define RED_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME -#define RED_GPIO_PIN 1 - -/* Green LED */ -#define GREEN_GPIO_NAME CONFIG_GPIO_MCUX_PORTA_NAME -#define GREEN_GPIO_PIN 19 - -/* Blue LED */ -#define BLUE_GPIO_NAME CONFIG_GPIO_MCUX_PORTA_NAME -#define BLUE_GPIO_PIN 18 - -/* LED0. There is no physical LED on the board with this name, so create an - * alias to the green LED to make various samples work. - */ -#define LED0_GPIO_PORT GREEN_GPIO_NAME -#define LED0_GPIO_PIN GREEN_GPIO_PIN - -/* LED1. There is no physical LED on the board with this name, so create an - * alias to the blue LED to make various samples work. - */ -#define LED1_GPIO_PORT BLUE_GPIO_NAME -#define LED1_GPIO_PIN BLUE_GPIO_PIN - -/* Push button switch 0. There is no physical switch on the board with this - * name, so create an alias to SW3 to make the basic button sample work. - */ -#define SW0_GPIO_NAME SW3_GPIO_NAME -#define SW0_GPIO_PIN SW3_GPIO_PIN - #endif /* __INC_BOARD_H */ diff --git a/boards/arm/frdm_kw41z/frdm_kw41z.dts b/boards/arm/frdm_kw41z/frdm_kw41z.dts index 12a9abaf417..4003fe207ae 100644 --- a/boards/arm/frdm_kw41z/frdm_kw41z.dts +++ b/boards/arm/frdm_kw41z/frdm_kw41z.dts @@ -17,6 +17,11 @@ gpio-c = &gpioc; i2c-0 = &i2c0; i2c-1 = &i2c1; + led0 = &green_led; + led1 = &blue_led; + led2 = &red_led; + sw0 = &user_button_3; + sw1 = &user_button_4; }; chosen { @@ -24,6 +29,36 @@ zephyr,flash = &flash0; zephyr,console = &lpuart0; }; + + leds { + compatible = "gpio-leds"; + red_led: led@0 { + gpios = <&gpioc 1 GPIO_INT_ACTIVE_LOW>; + label = "User LD1"; + }; + green_led: led@1 { + gpios = <&gpioa 19 GPIO_INT_ACTIVE_LOW>; + label = "User LD2"; + }; + blue_led: led@2 { + gpios = <&gpioa 18 GPIO_INT_ACTIVE_LOW>; + label = "User LD3"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + user_button_3: button@0 { + label = "User SW3"; + gpios = <&gpioc 4 GPIO_INT_ACTIVE_LOW>; + }; + user_button_4: button@1 { + label = "User SW4"; + gpios = <&gpioc 5 GPIO_INT_ACTIVE_LOW>; + }; + }; }; &adc0 { diff --git a/boards/arm/hexiwear_k64/board.h b/boards/arm/hexiwear_k64/board.h index ef49735c5ad..af9a4060905 100644 --- a/boards/arm/hexiwear_k64/board.h +++ b/boards/arm/hexiwear_k64/board.h @@ -20,26 +20,6 @@ #define BLUE_PWM_NAME CONFIG_FTM_3_NAME #define BLUE_PWM_CHANNEL 5 -#else - -/* Red LED */ -#define RED_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME -#define RED_GPIO_PIN 8 - -/* Green LED */ -#define GREEN_GPIO_NAME CONFIG_GPIO_MCUX_PORTD_NAME -#define GREEN_GPIO_PIN 0 - -/* Blue LED */ -#define BLUE_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME -#define BLUE_GPIO_PIN 9 - -/* LED0. There is no physical LED on the board with this name, so create an - * alias to the green LED to make the basic blinky sample work. - */ -#define LED0_GPIO_PORT GREEN_GPIO_NAME -#define LED0_GPIO_PIN GREEN_GPIO_PIN - #endif /* CONFIG_PWM_3 */ #endif /* __INC_BOARD_H */ diff --git a/boards/arm/hexiwear_k64/hexiwear_k64.dts b/boards/arm/hexiwear_k64/hexiwear_k64.dts index 93f28236d29..82cca018020 100644 --- a/boards/arm/hexiwear_k64/hexiwear_k64.dts +++ b/boards/arm/hexiwear_k64/hexiwear_k64.dts @@ -28,6 +28,9 @@ i2c-0 = &i2c0; i2c-1 = &i2c1; i2c-2 = &i2c2; + led0 = &green_led; + led1 = &blue_led; + led2 = &red_led; }; chosen { @@ -39,6 +42,21 @@ #endif }; + leds { + compatible = "gpio-leds"; + red_led: led@0 { + gpios = <&gpioc 8 GPIO_INT_ACTIVE_LOW>; + label = "User LD1"; + }; + green_led: led@1 { + gpios = <&gpiod 0 GPIO_INT_ACTIVE_LOW>; + label = "User LD2"; + }; + blue_led: led@2 { + gpios = <&gpioc 9 GPIO_INT_ACTIVE_LOW>; + label = "User LD3"; + }; + }; }; &adc0 { diff --git a/boards/arm/usb_kw24d512/board.h b/boards/arm/usb_kw24d512/board.h index f30b61cab67..d3d4b76319b 100644 --- a/boards/arm/usb_kw24d512/board.h +++ b/boards/arm/usb_kw24d512/board.h @@ -9,16 +9,4 @@ #include -/* Push button switch (SW1) */ -#define SW0_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME -#define SW0_GPIO_PIN 4 - -/* LED0 (D2) */ -#define LED0_GPIO_PORT CONFIG_GPIO_MCUX_PORTD_NAME -#define LED0_GPIO_PIN 4 - -/* LED1 (D3) */ -#define LED1_GPIO_PORT CONFIG_GPIO_MCUX_PORTD_NAME -#define LED1_GPIO_PIN 5 - #endif /* __INC_BOARD_H */ diff --git a/boards/arm/usb_kw24d512/usb_kw24d512.dts b/boards/arm/usb_kw24d512/usb_kw24d512.dts index 1158e263123..a77d2bfdd0c 100644 --- a/boards/arm/usb_kw24d512/usb_kw24d512.dts +++ b/boards/arm/usb_kw24d512/usb_kw24d512.dts @@ -19,6 +19,9 @@ gpio-d = &gpiod; gpio-e = &gpioe; i2c-0 = &i2c0; + led0 = &led_0; + led1 = &led_1; + sw0 = &user_button_1; }; chosen { @@ -27,6 +30,28 @@ zephyr,console = &uart0; zephyr,uart-pipe = &uart0; }; + + leds { + compatible = "gpio-leds"; + led_0: led@0 { + gpios = <&gpiod 4 GPIO_INT_ACTIVE_LOW>; + label = "User LD1"; + }; + led_1: led@1 { + gpios = <&gpiod 5 GPIO_INT_ACTIVE_LOW>; + label = "User LD2"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + user_button_1: button@0 { + label = "User SW1"; + gpios = <&gpioc 4 GPIO_INT_ACTIVE_LOW>; + }; + }; }; &adc0 {