diff options
author | John Klug <john.klug@multitech.com> | 2016-09-30 17:22:00 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2016-09-30 17:22:00 -0500 |
commit | cf9e2ae0c4193f784138e098c929a36a9aaa8854 (patch) | |
tree | a9b66d291b8d852c4e5ed71b709fdabe7d154322 /io-module/gpio.c | |
parent | 670c959a9bdfd4aaae25a6d0c30e31d29b6761de (diff) | |
download | mts-io-cf9e2ae0c4193f784138e098c929a36a9aaa8854.tar.gz mts-io-cf9e2ae0c4193f784138e098c929a36a9aaa8854.tar.bz2 mts-io-cf9e2ae0c4193f784138e098c929a36a9aaa8854.zip |
mts-io driver for Lora-H and additional resets
Diffstat (limited to 'io-module/gpio.c')
-rw-r--r-- | io-module/gpio.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/io-module/gpio.c b/io-module/gpio.c index 4a2d963..9e643a4 100644 --- a/io-module/gpio.c +++ b/io-module/gpio.c @@ -13,6 +13,22 @@ struct gpio_pin *gpio_pin_by_name(const char *name) { return NULL; } +// A GPIO pin number must only occur once. +struct gpio_pin *gpio_pin_by_num(unsigned num) { + int ipin = 0; + while(*(gpio_pins[ipin].name)) { + if (gpio_pins[ipin].pin.gpio == num) { + return &(gpio_pins[ipin]); + } + ipin++; + } + + log_error("pin numbered %u not found", num); + + return NULL; +} + + struct gpio_pin *gpio_pin_by_attr_name(const char *name) { struct gpio_pin *pin; |