1
0
mirror of https://github.com/xtacocorex/CHIP_IO synced 2025-07-20 04:43:21 +00:00

Adding Python interface to get the base XIO numbers, fixes for gptest.py on the 4.4 kernel CHIPs

This commit is contained in:
Robert Wolterman
2016-07-03 11:49:17 -05:00
parent 92888aaca4
commit 9ee83c0b38
4 changed files with 19 additions and 3 deletions

View File

@ -76,6 +76,6 @@ void define_constants(PyObject *module)
both_edge = Py_BuildValue("i", BOTH_EDGE);
PyModule_AddObject(module, "BOTH", both_edge);
version = Py_BuildValue("s", "0.0.7");
version = Py_BuildValue("s", "0.0.8");
PyModule_AddObject(module, "VERSION", version);
}

View File

@ -546,6 +546,19 @@ static PyObject *py_setwarnings(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
// python function base = get_xio_base()
static PyObject *py_gpio_base(PyObject *self, PyObject *args)
{
unsigned int value;
PyObject *py_value;
value = get_xio_base();
py_value = Py_BuildValue("i", value);
return py_value;
}
// Internal unit tests
extern int num_get_xio_base;
extern pins_t pins_info[];
@ -668,6 +681,7 @@ PyMethodDef gpio_methods[] = {
{"wait_for_edge", py_wait_for_edge, METH_VARARGS, "Wait for an edge.\ngpio - gpio channel\nedge - RISING, FALLING or BOTH"},
{"gpio_function", py_gpio_function, METH_VARARGS, "Return the current GPIO function (IN, OUT, ALT0)\ngpio - gpio channel"},
{"setwarnings", py_setwarnings, METH_VARARGS, "Enable or disable warning messages"},
{"get_gpio_base", py_gpio_base, METH_VARARGS, "Get the XIO base number for sysfs"},
{"selftest", py_selftest, METH_VARARGS, "Internal unit tests"},
{NULL, NULL, 0, NULL}
};