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

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

This commit is contained in:
Robert Wolterman
2016-04-18 19:31:08 -05:00
parent 6e7dd4984c
commit 777fda06a3

View File

@ -269,7 +269,7 @@ static PyObject *py_add_event_callback(PyObject *self, PyObject *args, PyObject
return NULL; return NULL;
// check to ensure gpio is one of the allowed pins // 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"); PyErr_SetString(PyExc_RuntimeError, "Callbacks currently available on AP-EINT1, AP-EINT3, and XIO-P0 to XIO-P7 only");
return NULL; return NULL;
} }
@ -316,7 +316,7 @@ static PyObject *py_add_event_detect(PyObject *self, PyObject *args, PyObject *k
return NULL; return NULL;
// check to ensure gpio is one of the allowed pins // 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"); PyErr_SetString(PyExc_RuntimeError, "Edge Detection currently available on AP-EINT1, AP-EINT3, and XIO-P0 to XIO-P7 only");
return NULL; return NULL;
} }
@ -370,7 +370,7 @@ static PyObject *py_remove_event_detect(PyObject *self, PyObject *args)
return NULL; return NULL;
// check to ensure gpio is one of the allowed pins // 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"); PyErr_SetString(PyExc_RuntimeError, "Edge Detection currently available on AP-EINT1, AP-EINT3, and XIO-P0 to XIO-P7 only");
return NULL; return NULL;
} }
@ -432,7 +432,7 @@ static PyObject *py_wait_for_edge(PyObject *self, PyObject *args)
return NULL; return NULL;
// check to ensure gpio is one of the allowed pins // 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"); PyErr_SetString(PyExc_RuntimeError, "Edge Detection currently available on AP-EINT1, AP-EINT3, and XIO-P0 to XIO-P7 only");
return NULL; return NULL;
} }