Commit 162b6e4b authored by Erwan Gouriou's avatar Erwan Gouriou Committed by Kumar Gala
Browse files

samples: Allow use of "CONTROLLER" postfix for LED and GPIO



Rework samples using LED and GPIO to enforce use of "CONTROLLER"
as LED and PGIO postifx.
Change impact all samples that could be run by boards yet moved to
GPIO node generations, which is only STM32 for now

Signed-off-by: default avatarErwan Gouriou <erwan.gouriou@linaro.org>
parent 69beec87
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ have defined the LED0\_* variables in :file:`board.h`.

The :file:`board.h` must define the following variables:

- LED0_GPIO_PORT
- LED0_GPIO_NAME (or LED0_GPIO_CONTROLLER)
- LED0_GPIO_PIN


+5 −1
Original line number Diff line number Diff line
@@ -10,7 +10,11 @@
#include <gpio.h>

/* Change this if you have an LED connected to a custom port */
#define LED_PORT	LED0_GPIO_PORT
#ifndef LED0_GPIO_CONTROLLER
#define LED0_GPIO_CONTROLLER 	LED0_GPIO_PORT
#endif

#define LED_PORT LED0_GPIO_CONTROLLER

/* Change this if you have an LED connected to a custom pin */
#define LED	LED0_GPIO_PIN
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ have defined the SW0_* variable in board.h
To use this sample, you will require a board that defines the user switch in its
header file. The :file:`board.h` must define the following variables:

- SW0_GPIO_NAME
- SW0_GPIO_NAME (or SW0_GPIO_CONTROLLER)
- SW0_GPIO_PIN

The following boards currently define the above variables:
+5 −2
Original line number Diff line number Diff line
@@ -12,11 +12,14 @@
#include <misc/printk.h>

/* change this to use another GPIO port */
#ifndef SW0_GPIO_CONTROLLER
#ifdef SW0_GPIO_NAME
#define PORT	SW0_GPIO_NAME
#define SW0_GPIO_CONTROLLER SW0_GPIO_NAME
#else
#error SW0_GPIO_NAME needs to be set in board.h
#error SW0_GPIO_NAME or SW0_GPIO_CONTROLLER needs to be set in board.h
#endif
#endif
#define PORT	SW0_GPIO_CONTROLLER

/* change this to use another GPIO pin */
#ifdef SW0_GPIO_PIN
+10 −2
Original line number Diff line number Diff line
@@ -19,8 +19,16 @@
#define PRIORITY 7

/* Change this if you have an LED connected to a custom port */
#define PORT0   LED0_GPIO_PORT
#define PORT1   LED1_GPIO_PORT
#ifndef LED0_GPIO_CONTROLLER
#define LED0_GPIO_CONTROLLER 	LED0_GPIO_PORT
#endif
#ifndef LED1_GPIO_CONTROLLER
#define LED1_GPIO_CONTROLLER 	LED1_GPIO_PORT
#endif

#define PORT0	 LED0_GPIO_CONTROLLER
#define PORT1	 LED1_GPIO_CONTROLLER


/* Change this if you have an LED connected to a custom pin */
#define LED0    LED0_GPIO_PIN
Loading