Commit c627de1f authored by Maureen Helm's avatar Maureen Helm Committed by Kumar Gala
Browse files

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: default avatarMaureen Helm <maureen.helm@nxp.com>
parent 22955b83
Loading
Loading
Loading
Loading
+0 −38
Original line number Diff line number Diff line
@@ -9,42 +9,4 @@

#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 */
+35 −0
Original line number Diff line number Diff line
@@ -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 {
+0 −38
Original line number Diff line number Diff line
@@ -9,42 +9,4 @@

#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 */
+40 −0
Original line number Diff line number Diff line
@@ -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 {
+0 −38
Original line number Diff line number Diff line
@@ -9,42 +9,4 @@

#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 */
Loading