Skip to content

Commit

Permalink
Updated to latest rpi_ws281x
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Aug 18, 2017
1 parent f95a3fd commit 6f50576
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
@@ -1,4 +1,4 @@
[submodule "library/lib"]
path = library/lib
url = http://github.com/pimoroni/rpi_ws281x
branch = dev
branch = master
2 changes: 1 addition & 1 deletion library/lib
Submodule lib updated from bb8a60 to d6bbae
5 changes: 4 additions & 1 deletion library/rpi_ws281x.py
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.2
# Version 2.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
Expand Down Expand Up @@ -140,6 +140,9 @@ class ws2811_t(_object):
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, ws2811_t, name)
__repr__ = _swig_repr
__swig_setmethods__["render_wait_time"] = _rpi_ws281x.ws2811_t_render_wait_time_set
__swig_getmethods__["render_wait_time"] = _rpi_ws281x.ws2811_t_render_wait_time_get
if _newclass:render_wait_time = _swig_property(_rpi_ws281x.ws2811_t_render_wait_time_get, _rpi_ws281x.ws2811_t_render_wait_time_set)
__swig_setmethods__["device"] = _rpi_ws281x.ws2811_t_device_set
__swig_getmethods__["device"] = _rpi_ws281x.ws2811_t_device_get
if _newclass:device = _swig_property(_rpi_ws281x.ws2811_t_device_get, _rpi_ws281x.ws2811_t_device_set)
Expand Down
154 changes: 128 additions & 26 deletions library/rpi_ws281x_wrap.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.2
* Version 2.0.12
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
Expand Down Expand Up @@ -536,14 +536,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
swig_module_info *iter = start;
do {
if (iter->size) {
size_t l = 0;
size_t r = iter->size - 1;
register size_t l = 0;
register size_t r = iter->size - 1;
do {
/* since l+r >= 0, we can (>> 1) instead (/ 2) */
size_t i = (l + r) >> 1;
register size_t i = (l + r) >> 1;
const char *iname = iter->types[i]->name;
if (iname) {
int compare = strcmp(name, iname);
register int compare = strcmp(name, iname);
if (compare == 0) {
return iter->types[i];
} else if (compare < 0) {
Expand Down Expand Up @@ -587,7 +587,7 @@ SWIG_TypeQueryModule(swig_module_info *start,
of the str field (the human readable name) */
swig_module_info *iter = start;
do {
size_t i = 0;
register size_t i = 0;
for (; i < iter->size; ++i) {
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
return iter->types[i];
Expand All @@ -606,10 +606,10 @@ SWIG_TypeQueryModule(swig_module_info *start,
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
static const char hex[17] = "0123456789abcdef";
const unsigned char *u = (unsigned char *) ptr;
const unsigned char *eu = u + sz;
register const unsigned char *u = (unsigned char *) ptr;
register const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
unsigned char uu = *u;
register unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
}
Expand All @@ -621,11 +621,11 @@ SWIG_PackData(char *c, void *ptr, size_t sz) {
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
unsigned char *u = (unsigned char *) ptr;
const unsigned char *eu = u + sz;
register unsigned char *u = (unsigned char *) ptr;
register const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
char d = *(c++);
unsigned char uu;
register char d = *(c++);
register unsigned char uu;
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
Expand Down Expand Up @@ -1302,7 +1302,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
}
if (!PyTuple_Check(args)) {
if (min <= 1 && max >= 1) {
int i;
register int i;
objs[0] = args;
for (i = 1; i < max; ++i) {
objs[i] = 0;
Expand All @@ -1312,7 +1312,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
return 0;
} else {
Py_ssize_t l = PyTuple_GET_SIZE(args);
register Py_ssize_t l = PyTuple_GET_SIZE(args);
if (l < min) {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
name, (min == max ? "" : "at least "), (int)min, (int)l);
Expand All @@ -1322,7 +1322,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
name, (min == max ? "" : "at most "), (int)max, (int)l);
return 0;
} else {
int i;
register int i;
for (i = 0; i < l; ++i) {
objs[i] = PyTuple_GET_ITEM(args, i);
}
Expand Down Expand Up @@ -2437,7 +2437,7 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
}
} else {
#if PY_VERSION_HEX >= 0x03000000
inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
if (inst) {
PyObject_SetAttr(inst, SWIG_This(), swig_this);
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
Expand Down Expand Up @@ -2949,7 +2949,7 @@ static swig_module_info swig_module = {swig_types, 14, 0, 0, 0, 0};
#endif
#define SWIG_name "_rpi_ws281x"

#define SWIGVERSION 0x030002
#define SWIGVERSION 0x020012
#define SWIG_VERSION SWIGVERSION


Expand Down Expand Up @@ -3232,6 +3232,58 @@ SWIG_From_unsigned_SS_char (unsigned char value)
}


SWIGINTERN int
SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val)
{
int res = SWIG_TypeError;
if (PyLong_Check(obj)) {
unsigned long long v = PyLong_AsUnsignedLongLong(obj);
if (!PyErr_Occurred()) {
if (val) *val = v;
return SWIG_OK;
} else {
PyErr_Clear();
}
} else {
unsigned long v;
res = SWIG_AsVal_unsigned_SS_long (obj,&v);
if (SWIG_IsOK(res)) {
if (val) *val = v;
return res;
}
}
#ifdef SWIG_PYTHON_CAST_MODE
{
const double mant_max = 1LL << DBL_MANT_DIG;
double d;
res = SWIG_AsVal_double (obj,&d);
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) {
if (val) *val = (unsigned long long)(d);
return SWIG_AddCast(res);
}
res = SWIG_TypeError;
}
#endif
return res;
}


SWIGINTERNINLINE PyObject*
SWIG_From_long_SS_long (long long value)
{
return ((value < LONG_MIN) || (value > LONG_MAX)) ?
PyLong_FromLongLong(value) : PyLong_FromLong((long)(value));
}


SWIGINTERNINLINE PyObject*
SWIG_From_unsigned_SS_long_SS_long (unsigned long long value)
{
return (value > LONG_MAX) ?
PyLong_FromUnsignedLongLong(value) : PyLong_FromLong((long)(value));
}


SWIGINTERN int
SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
{
Expand Down Expand Up @@ -3278,11 +3330,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
} else {
#if PY_VERSION_HEX >= 0x03000000
#if PY_VERSION_HEX >= 0x03010000
return PyUnicode_DecodeUTF8(carray, (int)(size), "surrogateescape");
#else
return PyUnicode_FromStringAndSize(carray, (int)(size));
#endif
#else
return PyString_FromStringAndSize(carray, (int)(size));
#endif
Expand Down Expand Up @@ -3954,6 +4002,58 @@ SWIGINTERN PyObject *ws2811_channel_t_swigregister(PyObject *SWIGUNUSEDPARM(self
return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_ws2811_t_render_wait_time_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ws2811_t *arg1 = (ws2811_t *) 0 ;
uint64_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
unsigned long long val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;

if (!PyArg_ParseTuple(args,(char *)"OO:ws2811_t_render_wait_time_set",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ws2811_t_render_wait_time_set" "', argument " "1"" of type '" "ws2811_t *""'");
}
arg1 = (ws2811_t *)(argp1);
ecode2 = SWIG_AsVal_unsigned_SS_long_SS_long(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ws2811_t_render_wait_time_set" "', argument " "2"" of type '" "uint64_t""'");
}
arg2 = (uint64_t)(val2);
if (arg1) (arg1)->render_wait_time = arg2;
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}


SWIGINTERN PyObject *_wrap_ws2811_t_render_wait_time_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ws2811_t *arg1 = (ws2811_t *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
uint64_t result;

if (!PyArg_ParseTuple(args,(char *)"O:ws2811_t_render_wait_time_get",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ws2811_t_render_wait_time_get" "', argument " "1"" of type '" "ws2811_t *""'");
}
arg1 = (ws2811_t *)(argp1);
result = (uint64_t) ((arg1)->render_wait_time);
resultobj = SWIG_From_unsigned_SS_long_SS_long((unsigned long long)(result));
return resultobj;
fail:
return NULL;
}


SWIGINTERN PyObject *_wrap_ws2811_t_device_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ws2811_t *arg1 = (ws2811_t *) 0 ;
Expand Down Expand Up @@ -4187,7 +4287,7 @@ SWIGINTERN PyObject *_wrap_ws2811_t_channel_set(PyObject *SWIGUNUSEDPARM(self),
{
if (arg2) {
size_t ii = 0;
for (; ii < (size_t)RPI_PWM_CHANNELS; ++ii) *(ws2811_channel_t *)&arg1->channel[ii] = *((ws2811_channel_t *)arg2 + ii);
for (; ii < (size_t)RPI_PWM_CHANNELS; ++ii) arg1->channel[ii] = arg2[ii];
} else {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""channel""' of type '""ws2811_channel_t [RPI_PWM_CHANNELS]""'");
}
Expand Down Expand Up @@ -4500,6 +4600,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"new_ws2811_channel_t", _wrap_new_ws2811_channel_t, METH_VARARGS, NULL},
{ (char *)"delete_ws2811_channel_t", _wrap_delete_ws2811_channel_t, METH_VARARGS, NULL},
{ (char *)"ws2811_channel_t_swigregister", ws2811_channel_t_swigregister, METH_VARARGS, NULL},
{ (char *)"ws2811_t_render_wait_time_set", _wrap_ws2811_t_render_wait_time_set, METH_VARARGS, NULL},
{ (char *)"ws2811_t_render_wait_time_get", _wrap_ws2811_t_render_wait_time_get, METH_VARARGS, NULL},
{ (char *)"ws2811_t_device_set", _wrap_ws2811_t_device_set, METH_VARARGS, NULL},
{ (char *)"ws2811_t_device_get", _wrap_ws2811_t_device_get, METH_VARARGS, NULL},
{ (char *)"ws2811_t_rpi_hw_set", _wrap_ws2811_t_rpi_hw_set, METH_VARARGS, NULL},
Expand Down Expand Up @@ -4613,7 +4715,7 @@ static swig_const_info swig_const_table[] = {
* array with the correct data and linking the correct swig_cast_info
* structures together.
*
* The generated swig_type_info structures are assigned statically to an initial
* The generated swig_type_info structures are assigned staticly to an initial
* array. We just loop through that array, and handle each type individually.
* First we lookup if this type has been already loaded, and if so, use the
* loaded structure instead of the generated one. Then we have to fill in the
Expand Down Expand Up @@ -4943,7 +5045,7 @@ extern "C" {
var = var->next;
}
if (res == NULL && !PyErr_Occurred()) {
PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
PyErr_SetString(PyExc_NameError,"Unknown C global variable");
}
return res;
}
Expand All @@ -4960,7 +5062,7 @@ extern "C" {
var = var->next;
}
if (res == 1 && !PyErr_Occurred()) {
PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
PyErr_SetString(PyExc_NameError,"Unknown C global variable");
}
return res;
}
Expand Down

0 comments on commit 6f50576

Please sign in to comment.