Skip to content

Commit

Permalink
v0.6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Pako2 authored Aug 22, 2021
1 parent f7472b6 commit f2d1abb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void define_constants(PyObject *module)
bthree = Py_BuildValue("i", THREE);
PyModule_AddObject(module, "THREE", bthree);

version = Py_BuildValue("s", "0.6.5");
version = Py_BuildValue("s", "0.6.6");
PyModule_AddObject(module, "VERSION", version);

PyModule_AddObject(module, "PA", Py_BuildValue("i", 0));
Expand Down
24 changes: 22 additions & 2 deletions source/py_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,31 @@ static PyObject *py_input_gpio(PyObject *self, PyObject *args)
PyErr_SetString(PyExc_RuntimeError, "You must setup() the GPIO channel first");
return NULL;
}

// Pako2 ADDED START //
if (check_gpio_priv())
return NULL;
if(gpio_function(gpio) == 6){
if (OPiGPIODebug)
printf("H3 - edge detect on pin is enabled!\n");
char fName[64];
struct stat s;
sprintf(fName, "/sys/class/gpio/gpio%d", gpio);
if(stat(fName, &s) == -1) {
if (gpio_export(gpio) != 0) {
PyErr_SetString(PyExc_RuntimeError, "Pin export failed");
return NULL;
}
}
if (gpio_get_value(gpio)==1) {
value = Py_BuildValue("i", HIGH);
} else {
value = Py_BuildValue("i", LOW);
}
return value;
}
// Pako2 ADDED END //

if (input_gpio(gpio)) {
if (input_gpio(gpio)) {
value = Py_BuildValue("i", HIGH);
} else {
value = Py_BuildValue("i", LOW);
Expand Down

0 comments on commit f2d1abb

Please sign in to comment.