From 777fda06a3e20808c9bbb215f207ec112db77518 Mon Sep 17 00:00:00 2001 From: Robert Wolterman Date: Mon, 18 Apr 2016 19:31:08 -0500 Subject: [PATCH] Fixing issue #2, edge detection for the XIO pins now works, simple logic issue in the if statement for throwing errors if gpio number is bad --- source/py_gpio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/py_gpio.c b/source/py_gpio.c index 510ddf1..2d0676f 100644 --- a/source/py_gpio.c +++ b/source/py_gpio.c @@ -269,7 +269,7 @@ static PyObject *py_add_event_callback(PyObject *self, PyObject *args, PyObject return NULL; // check to ensure gpio is one of the allowed pins - if (gpio != 35 && gpio != 193 && (gpio <= 415 && gpio >= 408)) { + if (gpio != 35 && gpio != 193 && !(gpio <= 415 && gpio >= 408)) { PyErr_SetString(PyExc_RuntimeError, "Callbacks currently available on AP-EINT1, AP-EINT3, and XIO-P0 to XIO-P7 only"); return NULL; } @@ -316,7 +316,7 @@ static PyObject *py_add_event_detect(PyObject *self, PyObject *args, PyObject *k return NULL; // check to ensure gpio is one of the allowed pins - if (gpio != 35 && gpio != 193 && (gpio <= 415 && gpio >= 408)) { + if (gpio != 35 && gpio != 193 && !(gpio <= 415 && gpio >= 408)) { PyErr_SetString(PyExc_RuntimeError, "Edge Detection currently available on AP-EINT1, AP-EINT3, and XIO-P0 to XIO-P7 only"); return NULL; } @@ -370,7 +370,7 @@ static PyObject *py_remove_event_detect(PyObject *self, PyObject *args) return NULL; // check to ensure gpio is one of the allowed pins - if (gpio != 35 && gpio != 193 && (gpio <= 415 && gpio >= 408)) { + if (gpio != 35 && gpio != 193 && !(gpio <= 415 && gpio >= 408)) { PyErr_SetString(PyExc_RuntimeError, "Edge Detection currently available on AP-EINT1, AP-EINT3, and XIO-P0 to XIO-P7 only"); return NULL; } @@ -432,7 +432,7 @@ static PyObject *py_wait_for_edge(PyObject *self, PyObject *args) return NULL; // check to ensure gpio is one of the allowed pins - if (gpio != 35 && gpio != 193 && (gpio <= 415 && gpio >= 408)) { + if (gpio != 35 && gpio != 193 && !(gpio <= 415 && gpio >= 408)) { PyErr_SetString(PyExc_RuntimeError, "Edge Detection currently available on AP-EINT1, AP-EINT3, and XIO-P0 to XIO-P7 only"); return NULL; }