mirror of
https://github.com/xtacocorex/CHIP_IO
synced 2025-07-20 12:53:22 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
c8e4323c27 | |||
1e3e801e60 |
@ -1,3 +1,9 @@
|
||||
0.2.2
|
||||
----
|
||||
* Fixes for Issue #16
|
||||
- Pass SoftPWM setup errors to Python layer (aninternetof)
|
||||
- Updated spwmtest.py to test for this issue
|
||||
|
||||
0.2.1
|
||||
----
|
||||
* Pull request #12 fixes:
|
||||
|
2
setup.py
2
setup.py
@ -20,7 +20,7 @@ classifiers = ['Development Status :: 3 - Alpha',
|
||||
'Topic :: System :: Hardware']
|
||||
|
||||
setup(name = 'CHIP_IO',
|
||||
version = '0.2.1',
|
||||
version = '0.2.2',
|
||||
author = 'Robert Wolterman',
|
||||
author_email = 'robert.wolterman@gmail.com',
|
||||
description = 'A module to control CHIP IO channels',
|
||||
|
@ -241,8 +241,12 @@ int softpwm_start(const char *key, float duty, float freq, int polarity)
|
||||
|
||||
if (get_gpio_number(key, &gpio) < 0)
|
||||
return -1;
|
||||
if (gpio_export(gpio) < 0)
|
||||
return -1;
|
||||
if (gpio_export(gpio) < 0) {
|
||||
char err[2000];
|
||||
snprintf(err, sizeof(err), "Error setting up softpwm on pin %d, maybe already exported? (%s)", gpio, get_error_msg());
|
||||
add_error_msg(err);
|
||||
return -1;
|
||||
}
|
||||
if (gpio_set_direction(gpio, OUTPUT) < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -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.2.1");
|
||||
version = Py_BuildValue("s", "0.2.2");
|
||||
PyModule_AddObject(module, "VERSION", version);
|
||||
}
|
||||
|
@ -80,8 +80,14 @@ static PyObject *py_start_channel(PyObject *self, PyObject *args, PyObject *kwar
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!softpwm_start(key, duty_cycle, frequency, polarity))
|
||||
return NULL;
|
||||
if (softpwm_start(key, duty_cycle, frequency, polarity) < 0)
|
||||
{
|
||||
printf("softpwm_start failed");
|
||||
char err[2000];
|
||||
snprintf(err, sizeof(err), "Error starting softpwm on pin %s (%s)", key, get_error_msg());
|
||||
PyErr_SetString(PyExc_RuntimeError, err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
@ -40,7 +40,18 @@ if __name__ == "__main__":
|
||||
GPIO.cleanup()
|
||||
SPWM.cleanup()
|
||||
|
||||
# ISSUE #16 VERIFICATION
|
||||
try:
|
||||
print("VERIFYING FIX FOR ISSUE #16, GPIO CONFIGURED THAT SPWM WANTS TO USE")
|
||||
GPIO.setup(SPWMGPIO, GPIO.OUT)
|
||||
SPWM.start(SPWMGPIO, 50, 1)
|
||||
except Exception as e:
|
||||
print("EXCEPTION: {}".format(e))
|
||||
print("GPIO CLEANUP")
|
||||
GPIO.cleanup()
|
||||
|
||||
# SETUP SOFTPWM
|
||||
print("STARTING SOFTPWM TEST")
|
||||
SPWM.start(SPWMGPIO, 50, 1)
|
||||
SPWM.set_frequency(SPWMGPIO, 2)
|
||||
|
||||
|
Reference in New Issue
Block a user