boards: arm: nrf52832_pca10040: use dts for LED and button config

The LEDs, buttons and necessary aliases are now configured via dts.
This commit breaks the sample under samples/boards/nrf52/power_mgr.

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

View file

@ -9,40 +9,4 @@
#include <soc.h> #include <soc.h>
/* Push button switch 0 */
#define SW0_GPIO_PIN 13
#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 14
#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 15
#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 16
#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 17
#define LED0_GPIO_PORT CONFIG_GPIO_P0_DEV_NAME
/* Onboard GREEN LED 1 */
#define LED1_GPIO_PIN 18
#define LED1_GPIO_PORT CONFIG_GPIO_P0_DEV_NAME
/* Onboard GREEN LED 2 */
#define LED2_GPIO_PIN 19
#define LED2_GPIO_PORT CONFIG_GPIO_P0_DEV_NAME
/* Onboard GREEN LED 3 */
#define LED3_GPIO_PIN 20
#define LED3_GPIO_PORT CONFIG_GPIO_P0_DEV_NAME
#endif /* __INC_BOARD_H */ #endif /* __INC_BOARD_H */

View file

@ -21,6 +21,60 @@
zephyr,sram = &sram0; zephyr,sram = &sram0;
zephyr,flash = &flash0; zephyr,flash = &flash0;
}; };
leds {
compatible = "gpio-leds";
led0: led@0 {
gpios = <&gpio0 17 GPIO_INT_ACTIVE_LOW>;
label = "Green LED 0";
};
led1: led@1 {
gpios = <&gpio0 18 GPIO_INT_ACTIVE_LOW>;
label = "Green LED 1";
};
led2: led@2 {
gpios = <&gpio0 19 GPIO_INT_ACTIVE_LOW>;
label = "Green LED 2";
};
led3: led@3 {
gpios = <&gpio0 20 GPIO_INT_ACTIVE_LOW>;
label = "Green LED 3";
};
};
buttons {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
button0: button@0 {
gpios = <&gpio0 13 GPIO_PUD_PULL_UP>;
label = "Push button switch 0";
};
button1: button@1 {
gpios = <&gpio0 14 GPIO_PUD_PULL_UP>;
label = "Push button switch 1";
};
button2: button@2 {
gpios = <&gpio0 15 GPIO_PUD_PULL_UP>;
label = "Push button switch 2";
};
button3: button@3 {
gpios = <&gpio0 16 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;
};
}; };
&adc { &adc {

View file

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