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

software servo! this implements and will close #41. also fixed issue with softpwm cleanup(), update to version 0.4.0

This commit is contained in:
Robert Wolterman
2017-02-07 04:17:09 +00:00
parent cd85e2b5eb
commit 6bd2e61450
12 changed files with 760 additions and 31 deletions

View File

@ -43,29 +43,11 @@ static PyObject *py_toggle_debug(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
// python function cleanup(channel=None)
// python function cleanup()
static PyObject *py_cleanup(PyObject *self, PyObject *args)
{
// unexport the PWM
char key[8];
char *channel = NULL;
clear_error_msg();
// Channel is optional
if (!PyArg_ParseTuple(args, "|s", &channel))
return NULL;
// The !channel fixes issue #50
if (channel == NULL || strcmp(channel, "\0") == 0) {
softpwm_cleanup();
return NULL;
} else {
if (!get_key(channel, key)) {
softpwm_cleanup();
}
softpwm_disable(key);
}
softpwm_cleanup();
Py_RETURN_NONE;
}