boards: Move led and button definitions to dts for kinetis boards

Adds led and button dts nodes to all kinetis boards and removes the
now unused preprocessor macros from board.h.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This commit is contained in:
Maureen Helm 2018-04-19 12:57:18 -05:00 committed by Kumar Gala
commit c627de1f87
10 changed files with 153 additions and 146 deletions

View file

@ -9,42 +9,4 @@
#include <soc.h> #include <soc.h>
/* 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 */ #endif /* __INC_BOARD_H */

View file

@ -28,6 +28,11 @@
i2c-0 = &i2c0; i2c-0 = &i2c0;
i2c-1 = &i2c1; i2c-1 = &i2c1;
i2c-2 = &i2c2; i2c-2 = &i2c2;
led0 = &green_led;
led1 = &blue_led;
led2 = &red_led;
sw0 = &user_button_3;
sw1 = &user_button_2;
}; };
chosen { chosen {
@ -39,6 +44,36 @@
#endif #endif
zephyr,uart-pipe = &uart0; 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 { &adc0 {

View file

@ -9,42 +9,4 @@
#include <soc.h> #include <soc.h>
/* 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 */ #endif /* __INC_BOARD_H */

View file

@ -11,6 +11,16 @@
uart-0 = &uart0; uart-0 = &uart0;
i2c-0 = &i2c0; i2c-0 = &i2c0;
i2c-1 = &i2c1; 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 { chosen {
@ -18,6 +28,36 @@
zephyr,flash = &flash0; zephyr,flash = &flash0;
zephyr,console = &uart0; 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 { &adc0 {

View file

@ -9,42 +9,4 @@
#include <soc.h> #include <soc.h>
/* 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 */ #endif /* __INC_BOARD_H */

View file

@ -17,6 +17,11 @@
gpio-c = &gpioc; gpio-c = &gpioc;
i2c-0 = &i2c0; i2c-0 = &i2c0;
i2c-1 = &i2c1; i2c-1 = &i2c1;
led0 = &green_led;
led1 = &blue_led;
led2 = &red_led;
sw0 = &user_button_3;
sw1 = &user_button_4;
}; };
chosen { chosen {
@ -24,6 +29,36 @@
zephyr,flash = &flash0; zephyr,flash = &flash0;
zephyr,console = &lpuart0; 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 { &adc0 {

View file

@ -20,26 +20,6 @@
#define BLUE_PWM_NAME CONFIG_FTM_3_NAME #define BLUE_PWM_NAME CONFIG_FTM_3_NAME
#define BLUE_PWM_CHANNEL 5 #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 /* CONFIG_PWM_3 */
#endif /* __INC_BOARD_H */ #endif /* __INC_BOARD_H */

View file

@ -28,6 +28,9 @@
i2c-0 = &i2c0; i2c-0 = &i2c0;
i2c-1 = &i2c1; i2c-1 = &i2c1;
i2c-2 = &i2c2; i2c-2 = &i2c2;
led0 = &green_led;
led1 = &blue_led;
led2 = &red_led;
}; };
chosen { chosen {
@ -39,6 +42,21 @@
#endif #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 { &adc0 {

View file

@ -9,16 +9,4 @@
#include <soc.h> #include <soc.h>
/* 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 */ #endif /* __INC_BOARD_H */

View file

@ -19,6 +19,9 @@
gpio-d = &gpiod; gpio-d = &gpiod;
gpio-e = &gpioe; gpio-e = &gpioe;
i2c-0 = &i2c0; i2c-0 = &i2c0;
led0 = &led_0;
led1 = &led_1;
sw0 = &user_button_1;
}; };
chosen { chosen {
@ -27,6 +30,28 @@
zephyr,console = &uart0; zephyr,console = &uart0;
zephyr,uart-pipe = &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 { &adc0 {