From 9e44c5dca0d99596fc47bf8027cb644939f3eaf5 Mon Sep 17 00:00:00 2001 From: Drew Fustini Date: Fri, 23 Mar 2018 04:39:28 +0000 Subject: [PATCH] add alternate name for pin P8_19 (issue #239) Allow P8_19 to be referenced as GPIO0_22. Add temporary debugging output to test. --- source/common.c | 8 ++++++++ source/py_gpio.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/common.c b/source/common.c index e8fbbec..23f4f5f 100644 --- a/source/common.c +++ b/source/common.c @@ -94,6 +94,7 @@ pins_t table[] = { { "GPIO0_27", "P8_17", 27, -1, -1}, { "GPIO2_1", "P8_18", 65, -1, -1}, { "EHRPWM2A", "P8_19", 22, 4, -1}, + { "GPIO0_22", "P8_19", 22, 4, -1}, { "GPIO1_31", "P8_20", 63, -1, -1}, { "GPIO1_30", "P8_21", 62, -1, -1}, { "GPIO1_5", "P8_22", 37, -1, -1}, @@ -302,22 +303,26 @@ pwm_t pwm_table[] = { int lookup_gpio_by_key(const char *key) { pins_t *p; + fprintf(stderr, "DEBUG: lookup_gpio_by_key(): key=%s\n", key); for (p = table; p->key != NULL; ++p) { if (strcmp(p->key, key) == 0) { return p->gpio; } } + fprintf(stderr, "DEBUG: lookup_gpio_by_key(): return 0\n"); return 0; } int lookup_gpio_by_name(const char *name) { pins_t *p; + fprintf(stderr, "DEBUG: lookup_gpio_by_name(): name=%s\n", name); for (p = table; p->name != NULL; ++p) { if (strcmp(p->name, name) == 0) { return p->gpio; } } + fprintf(stderr, "DEBUG: lookup_gpio_by_name(): return 0\n"); return 0; } @@ -400,6 +405,7 @@ BBIO_err get_pwm_key_by_name(const char *name, char *key) BBIO_err get_gpio_number(const char *key, unsigned int *gpio) { + fprintf(stderr, "DEBUG: get_gpio_number(): key=%s\n", key); *gpio = lookup_gpio_by_key(key); if (!*gpio) { @@ -407,9 +413,11 @@ BBIO_err get_gpio_number(const char *key, unsigned int *gpio) } if (!*gpio) { + fprintf(stderr, "DEBUG: get_gpio_number(): return BBIO_INVARG\n"); return BBIO_INVARG; } + fprintf(stderr, "DEBUG: get_gpio_number(): return BBIO_OK\n"); return BBIO_OK; } diff --git a/source/py_gpio.c b/source/py_gpio.c index a954652..60db9e6 100644 --- a/source/py_gpio.c +++ b/source/py_gpio.c @@ -108,7 +108,7 @@ static PyObject *py_setup_channel(__attribute__ ((unused)) PyObject *self, PyObj return NULL; } - + fprintf(stderr, "DEBUG: py_gpio.c: channel=%s\n", channel); err = get_gpio_number(channel, &gpio); if (err != BBIO_OK) return NULL; @@ -597,7 +597,7 @@ PyMODINIT_FUNC initGPIO(void) define_constants(module); - initlog(LOG_INFO, NULL, BBIO_LOG_OPTION); + initlog(LOG_DEBUG, NULL, BBIO_LOG_OPTION); if (!PyEval_ThreadsInitialized()) PyEval_InitThreads(); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy