add button handling
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
struct narf52_gpio narf_led_1 = {
|
||||
// LEDs
|
||||
const struct narf52_gpio narf_led_1 = {
|
||||
.pin_number = 17,
|
||||
.dir = NARF_GPIO_DIR_OUT,
|
||||
.input = NARF_GPIO_PIN_INPUT_DISCONNECT,
|
||||
@@ -15,13 +16,13 @@ struct narf52_gpio narf_led_1 = {
|
||||
.sense = NARF_GPIO_PIN_NOSENSE,
|
||||
};
|
||||
|
||||
struct driver led_1 = {
|
||||
const struct driver led_1 = {
|
||||
.name = "LED_1",
|
||||
.fp = &gpio_fp,
|
||||
.dev = (void *)&narf_led_1,
|
||||
};
|
||||
|
||||
struct narf52_gpio narf_led_2 = {
|
||||
const struct narf52_gpio narf_led_2 = {
|
||||
.pin_number = 18,
|
||||
.dir = NARF_GPIO_DIR_OUT,
|
||||
.input = NARF_GPIO_PIN_INPUT_DISCONNECT,
|
||||
@@ -30,13 +31,13 @@ struct narf52_gpio narf_led_2 = {
|
||||
.sense = NARF_GPIO_PIN_NOSENSE,
|
||||
};
|
||||
|
||||
struct driver led_2 = {
|
||||
const struct driver led_2 = {
|
||||
.name = "LED_2",
|
||||
.fp = &gpio_fp,
|
||||
.dev = (void *)&narf_led_2,
|
||||
};
|
||||
|
||||
struct narf52_gpio narf_led_3 = {
|
||||
const struct narf52_gpio narf_led_3 = {
|
||||
.pin_number = 19,
|
||||
.dir = NARF_GPIO_DIR_OUT,
|
||||
.input = NARF_GPIO_PIN_INPUT_DISCONNECT,
|
||||
@@ -45,13 +46,13 @@ struct narf52_gpio narf_led_3 = {
|
||||
.sense = NARF_GPIO_PIN_NOSENSE,
|
||||
};
|
||||
|
||||
struct driver led_3 = {
|
||||
const struct driver led_3 = {
|
||||
.name = "LED_3",
|
||||
.fp = &gpio_fp,
|
||||
.dev = (void *)&narf_led_3,
|
||||
};
|
||||
|
||||
struct narf52_gpio narf_led_4 = {
|
||||
const struct narf52_gpio narf_led_4 = {
|
||||
.pin_number = 20,
|
||||
.dir = NARF_GPIO_DIR_OUT,
|
||||
.input = NARF_GPIO_PIN_INPUT_DISCONNECT,
|
||||
@@ -60,10 +61,71 @@ struct narf52_gpio narf_led_4 = {
|
||||
.sense = NARF_GPIO_PIN_NOSENSE,
|
||||
};
|
||||
|
||||
struct driver led_4 = {
|
||||
const struct driver led_4 = {
|
||||
.name = "LED_4",
|
||||
.fp = &gpio_fp,
|
||||
.dev = (void *)&narf_led_4,
|
||||
};
|
||||
|
||||
// BUTTONs
|
||||
const struct narf52_gpio narf_button_1 = {
|
||||
.pin_number = 13,
|
||||
.dir = NARF_GPIO_DIR_IN,
|
||||
.input = NARF_GPIO_PIN_INPUT_CONNECT,
|
||||
.pull = NARF_GPIO_PIN_PULLUP,
|
||||
.drive = NARF_GPIO_PIN_S0S1,
|
||||
.sense = NARF_GPIO_PIN_NOSENSE,
|
||||
};
|
||||
|
||||
const struct driver button_1 = {
|
||||
.name = "BUTTON_1",
|
||||
.fp = &gpio_fp,
|
||||
.dev = (void *)&narf_button_1,
|
||||
};
|
||||
|
||||
const struct narf52_gpio narf_button_2 = {
|
||||
.pin_number = 14,
|
||||
.dir = NARF_GPIO_DIR_IN,
|
||||
.input = NARF_GPIO_PIN_INPUT_CONNECT,
|
||||
.pull = NARF_GPIO_PIN_PULLUP,
|
||||
.drive = NARF_GPIO_PIN_S0S1,
|
||||
.sense = NARF_GPIO_PIN_NOSENSE,
|
||||
};
|
||||
|
||||
const struct driver button_2 = {
|
||||
.name = "BUTTON_2",
|
||||
.fp = &gpio_fp,
|
||||
.dev = (void *)&narf_button_2,
|
||||
};
|
||||
|
||||
const struct narf52_gpio narf_button_3 = {
|
||||
.pin_number = 15,
|
||||
.dir = NARF_GPIO_DIR_IN,
|
||||
.input = NARF_GPIO_PIN_INPUT_CONNECT,
|
||||
.pull = NARF_GPIO_PIN_PULLUP,
|
||||
.drive = NARF_GPIO_PIN_S0S1,
|
||||
.sense = NARF_GPIO_PIN_NOSENSE,
|
||||
};
|
||||
|
||||
const struct driver button_3 = {
|
||||
.name = "BUTTON_3",
|
||||
.fp = &gpio_fp,
|
||||
.dev = (void *)&narf_button_3,
|
||||
};
|
||||
|
||||
const struct narf52_gpio narf_button_4 = {
|
||||
.pin_number = 16,
|
||||
.dir = NARF_GPIO_DIR_IN,
|
||||
.input = NARF_GPIO_PIN_INPUT_CONNECT,
|
||||
.pull = NARF_GPIO_PIN_PULLUP,
|
||||
.drive = NARF_GPIO_PIN_S0S1,
|
||||
.sense = NARF_GPIO_PIN_NOSENSE,
|
||||
};
|
||||
|
||||
const struct driver button_4 = {
|
||||
.name = "BUTTON_4",
|
||||
.fp = &gpio_fp,
|
||||
.dev = (void *)&narf_button_4,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user