mirror of
https://github.com/xtacocorex/CHIP_IO
synced 2025-07-20 12:53:22 +00:00
Corrects backwards polarity
This commit is contained in:
@ -201,7 +201,7 @@ void *softpwm_thread_toggle(void *key)
|
|||||||
if (duty_local != 0)
|
if (duty_local != 0)
|
||||||
{
|
{
|
||||||
/* Set gpio */
|
/* Set gpio */
|
||||||
if (polarity_local)
|
if (!polarity_local)
|
||||||
gpio_set_value(gpio, HIGH);
|
gpio_set_value(gpio, HIGH);
|
||||||
else
|
else
|
||||||
gpio_set_value(gpio, LOW);
|
gpio_set_value(gpio, LOW);
|
||||||
@ -213,7 +213,7 @@ void *softpwm_thread_toggle(void *key)
|
|||||||
if (duty_local != 100)
|
if (duty_local != 100)
|
||||||
{
|
{
|
||||||
/* Unset gpio */
|
/* Unset gpio */
|
||||||
if (polarity_local)
|
if (!polarity_local)
|
||||||
gpio_set_value(gpio, LOW);
|
gpio_set_value(gpio, LOW);
|
||||||
else
|
else
|
||||||
gpio_set_value(gpio, HIGH);
|
gpio_set_value(gpio, HIGH);
|
||||||
@ -223,7 +223,7 @@ void *softpwm_thread_toggle(void *key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polarity_local)
|
if (!polarity_local)
|
||||||
gpio_set_value(gpio, LOW);
|
gpio_set_value(gpio, LOW);
|
||||||
else
|
else
|
||||||
gpio_set_value(gpio, HIGH);
|
gpio_set_value(gpio, HIGH);
|
||||||
|
@ -50,7 +50,7 @@ static PyObject *py_start_channel(PyObject *self, PyObject *args, PyObject *kwar
|
|||||||
char *channel;
|
char *channel;
|
||||||
float frequency = 2000.0;
|
float frequency = 2000.0;
|
||||||
float duty_cycle = 0.0;
|
float duty_cycle = 0.0;
|
||||||
int polarity = 1;
|
int polarity = 0;
|
||||||
static char *kwlist[] = {"channel", "duty_cycle", "frequency", "polarity", NULL};
|
static char *kwlist[] = {"channel", "duty_cycle", "frequency", "polarity", NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ffi", kwlist, &channel, &duty_cycle, &frequency, &polarity)) {
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ffi", kwlist, &channel, &duty_cycle, &frequency, &polarity)) {
|
||||||
|
Reference in New Issue
Block a user