From 1975ce4f7c71aa7903cba160ea81a0902e03fdf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20Le=20Gourri=C3=A9rec?= Date: Fri, 16 Jun 2017 17:42:09 +0200 Subject: [PATCH] samples: gpio: Add support for SensorTag board. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add extra #defines in samples/drivers/gpio to test TI SensorTag board. Signed-off-by: Geoffrey Le GourriƩrec --- samples/drivers/gpio/src/main.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/samples/drivers/gpio/src/main.c b/samples/drivers/gpio/src/main.c index 07ce642339d..b95cb192f68 100644 --- a/samples/drivers/gpio/src/main.c +++ b/samples/drivers/gpio/src/main.c @@ -7,6 +7,18 @@ /** * @file Sample app to utilize GPIO on Arduino 101 and Arduino Due. * + * Sensortag CC2650 - ARM + * -------------------- + * + * LED1 is on DIO_10 + * LED2 is on DIO_15 + * BUTTON1 is on DIO_4 + * BUTTON2 is on DIO_0 + * + * This sample toogles LED1 and wait interrupt on BUTTON1. + * Note that an internet pull-up is set on BUTTON1 as the button + * only drives low when pressed. + * * Arduino 101 - x86 * -------------------- * @@ -122,6 +134,10 @@ #define GPIO_OUT_PIN 8 #define GPIO_INT_PIN 24 #define GPIO_NAME "GPIO_" +#elif defined(CONFIG_SOC_CC2650) +#define GPIO_OUT_PIN 10 +#define GPIO_INT_PIN 4 +#define GPIO_NAME "GPIO_" #endif #if defined(CONFIG_GPIO_DW_0) @@ -163,9 +179,17 @@ void main(void) } /* Setup GPIO input, and triggers on rising edge. */ +#ifdef CONFIG_SOC_CC2650 ret = gpio_pin_configure(gpio_dev, GPIO_INT_PIN, - (GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE - | GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE)); + (GPIO_DIR_IN | GPIO_INT | + GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH | + GPIO_INT_DEBOUNCE | GPIO_PUD_PULL_UP)); +#else + ret = gpio_pin_configure(gpio_dev, GPIO_INT_PIN, + (GPIO_DIR_IN | GPIO_INT | + GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH | + GPIO_INT_DEBOUNCE)); +#endif if (ret) { printk("Error configuring " GPIO_NAME "%d!\n", GPIO_INT_PIN); }