galileo: Add board-level abstraction layer for GPIO

This patch adds a HAL for GPIOs so that users of the API can specify
board-level IO pin numbers rather than CPU-level pin numbers.
This commit is contained in:
Michael LeMay 2016-08-22 16:28:58 -07:00
parent 2912559061
commit b17a936bf7
7 changed files with 132 additions and 18 deletions

View file

@ -33,10 +33,11 @@
#include "contiki.h"
#include "sys/ctimer.h"
#include "galileo-gpio.h"
#include "gpio.h"
#define PIN_OUTPUT 5
#define PIN_INPUT 6
#define PIN_OUTPUT 2
#define PIN_INPUT 3
static uint32_t value;
static struct ctimer timer;
@ -51,9 +52,9 @@ timeout(void *data)
/* toggle pin state */
value = !value;
quarkX1000_gpio_write(PIN_OUTPUT, value);
galileo_gpio_write(PIN_OUTPUT, value);
quarkX1000_gpio_read(PIN_INPUT, &value_in);
galileo_gpio_read(PIN_INPUT, &value_in);
if (value == value_in)
printf("GPIO pin value match!\n");