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:
parent
2912559061
commit
b17a936bf7
7 changed files with 132 additions and 18 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue