boards: arm: nrf51_pca10028: use dts for LED and button configuration

The LEDs, buttons and necessary aliases are now configured via dts.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
This commit is contained in:
Emanuele Di Santo 2018-08-21 15:43:51 +02:00 committed by Kumar Gala
commit e84709e169
3 changed files with 55 additions and 36 deletions

View file

@ -10,40 +10,4 @@
#include <soc.h>
/* Push button switch 0 */
#define SW0_GPIO_PIN 17
#define SW0_GPIO_NAME CONFIG_GPIO_P0_DEV_NAME
#define SW0_GPIO_PIN_PUD GPIO_PUD_PULL_UP
/* Push button switch 1 */
#define SW1_GPIO_PIN 18
#define SW1_GPIO_NAME CONFIG_GPIO_P0_DEV_NAME
#define SW1_GPIO_PIN_PUD GPIO_PUD_PULL_UP
/* Push button switch 2 */
#define SW2_GPIO_PIN 19
#define SW2_GPIO_NAME CONFIG_GPIO_P0_DEV_NAME
#define SW2_GPIO_PIN_PUD GPIO_PUD_PULL_UP
/* Push button switch 3 */
#define SW3_GPIO_PIN 20
#define SW3_GPIO_NAME CONFIG_GPIO_P0_DEV_NAME
#define SW3_GPIO_PIN_PUD GPIO_PUD_PULL_UP
/* Onboard GREEN LED 0 */
#define LED0_GPIO_PIN 21
#define LED0_GPIO_PORT CONFIG_GPIO_P0_DEV_NAME
/* Onboard GREEN LED 1 */
#define LED1_GPIO_PIN 22
#define LED1_GPIO_PORT CONFIG_GPIO_P0_DEV_NAME
/* Onboard GREEN LED 2 */
#define LED2_GPIO_PIN 23
#define LED2_GPIO_PORT CONFIG_GPIO_P0_DEV_NAME
/* Onboard GREEN LED 3 */
#define LED3_GPIO_PIN 24
#define LED3_GPIO_PORT CONFIG_GPIO_P0_DEV_NAME
#endif /* __INC_BOARD_H */

View file

@ -20,6 +20,60 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
leds {
compatible = "gpio-leds";
led0: led@0 {
gpios = <&gpio0 21 GPIO_INT_ACTIVE_LOW>;
label = "Green LED 0";
};
led1: led@1 {
gpios = <&gpio0 22 GPIO_INT_ACTIVE_LOW>;
label = "Green LED 1";
};
led2: led@2 {
gpios = <&gpio0 23 GPIO_INT_ACTIVE_LOW>;
label = "Green LED 2";
};
led3: led@3 {
gpios = <&gpio0 24 GPIO_INT_ACTIVE_LOW>;
label = "Green LED 3";
};
};
buttons {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
button0: button@0 {
gpios = <&gpio0 17 GPIO_PUD_PULL_UP>;
label = "Push button switch 0";
};
button1: button@1 {
gpios = <&gpio0 18 GPIO_PUD_PULL_UP>;
label = "Push button switch 1";
};
button2: button@2 {
gpios = <&gpio0 19 GPIO_PUD_PULL_UP>;
label = "Push button switch 2";
};
button3: button@3 {
gpios = <&gpio0 20 GPIO_PUD_PULL_UP>;
label = "Push button switch 3";
};
};
/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0;
led1 = &led1;
led2 = &led2;
led3 = &led3;
sw0 = &button0;
sw1 = &button1;
sw2 = &button2;
sw3 = &button3;
};
};
&gpiote {

View file

@ -1,5 +1,6 @@
#include <arm/armv6-m.dtsi>
#include <dt-bindings/i2c/i2c.h>
#include <dt-bindings/gpio/gpio.h>
#include <nordic/mem.h>
/ {