1
0
mirror of https://github.com/xtacocorex/CHIP_IO synced 2025-07-20 12:53:22 +00:00

Simple updated to the XIO base logic based upon suggestions by fordsford

This commit is contained in:
Robert Wolterman
2016-06-18 15:06:39 -05:00
parent 99193144f1
commit 0f89ae462c

View File

@ -204,7 +204,7 @@ int lookup_gpio_by_key(const char *key)
for (p = table; p->key != NULL; ++p) { for (p = table; p->key != NULL; ++p) {
if (strcmp(p->key, key) == 0) { if (strcmp(p->key, key) == 0) {
// FIGURE OUT IF WE'RE AN XIO PIN USING THE DEFAULT PINS // FIGURE OUT IF WE'RE AN XIO PIN USING THE DEFAULT PINS
if (p->gpio >= OLDXIOBASE) { if (p->gpio >= OLDXIOBASE && p->gpio < OLDXIOBASE+8) {
int gbase = get_xio_base(); int gbase = get_xio_base();
if (gbase != -1) { if (gbase != -1) {
return (gbase + (p->gpio - OLDXIOBASE)); return (gbase + (p->gpio - OLDXIOBASE));
@ -225,7 +225,7 @@ int lookup_gpio_by_name(const char *name)
for (p = table; p->name != NULL; ++p) { for (p = table; p->name != NULL; ++p) {
if (strcmp(p->name, name) == 0) { if (strcmp(p->name, name) == 0) {
// FIGURE OUT IF WE'RE AN XIO PIN USING THE DEFAULT PINS // FIGURE OUT IF WE'RE AN XIO PIN USING THE DEFAULT PINS
if (p->gpio >= OLDXIOBASE) { if (p->gpio >= OLDXIOBASE && p->gpio < OLDXIOBASE+8) {
int gbase = get_xio_base(); int gbase = get_xio_base();
if (gbase != -1) { if (gbase != -1) {
return (gbase + (p->gpio - OLDXIOBASE)); return (gbase + (p->gpio - OLDXIOBASE));