ws2812 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/examples/cat.rb +85 -0
- data/ext/ws2812/extconf.rb +0 -13
- data/ext/ws2812/lowlevel_wrap.c +142 -102
- data/ext/ws2812/mailbox.c +10 -4
- data/ext/ws2812/mailbox.h +6 -0
- data/ext/ws2812/ws2811.c +7 -1
- data/ext/ws2812/ws2811.h +1 -0
- data/lib/ws2812.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a2138c68a351d27224a3858e46fdba32ed1d880
|
|
4
|
+
data.tar.gz: 782eaa7080c172cb1070b8f082e63b61ab0a0f41
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f6b90b4d822e6c904ddd44a1505d06647cd3c65ffa90d2fdfc5aa335671efbe4b5e0207b72367841da454ebbba7fdc56eddf82d61dfa20a616ab4c89293fe396
|
|
7
|
+
data.tar.gz: 49c2fa315148cf9c1c933ef1c459fd6abc7a030f91e272a7e722a337ddba5a0df31fbbea6576f5cd451dee67693dc66c8049dae22f311e1bf6c55367f543c07b
|
data/Rakefile
CHANGED
|
@@ -12,7 +12,7 @@ spec = Gem::Specification.new do |s|
|
|
|
12
12
|
s.date = '2015-05-03'
|
|
13
13
|
s.summary = 'Ruby wrapper around WS2812 LED driver for Raspberry Pi'
|
|
14
14
|
s.description = 'Gem that encapsulates modified RPi ws281x library from UnicornHat to help drive your WS2812 led chain (or matrix) from RaspberryPi'
|
|
15
|
-
s.authors = ['Michal Jirků', 'Pimoroni', 'Richard Hirst', 'Jeremy Garff', 'Philip Howard']
|
|
15
|
+
s.authors = ['Michal Jirků', 'Pimoroni', 'Richard Hirst', 'Jeremy Garff', 'Philip Howard', 'Daniel Hollands']
|
|
16
16
|
s.email = 'box@wejn.org'
|
|
17
17
|
s.files = `git ls-files -z`.split("\x0")
|
|
18
18
|
s.homepage = 'https://github.com/wejn/ws2812'
|
data/examples/cat.rb
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# Author: Daniel Hollands
|
|
4
|
+
# Source: https://gist.github.com/LimeBlast/74db06b0123fa70ba6d2
|
|
5
|
+
#
|
|
6
|
+
$:.unshift(File.expand_path('../../lib', __FILE__))
|
|
7
|
+
require 'ws2812'
|
|
8
|
+
|
|
9
|
+
def display(array, colours)
|
|
10
|
+
$hat.clear false
|
|
11
|
+
array.each_with_index do |row, x|
|
|
12
|
+
row.each_with_index do |value, y|
|
|
13
|
+
$hat[x, y] = colours[value]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
$hat.show
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Init
|
|
20
|
+
$hat = Ws2812::UnicornHAT.new
|
|
21
|
+
|
|
22
|
+
$hat.rotation = 90
|
|
23
|
+
$hat.clear
|
|
24
|
+
|
|
25
|
+
# sourced from http://atariage.com/forums/topic/169238-free-sprites-for-the-taking/
|
|
26
|
+
cat = [
|
|
27
|
+
[
|
|
28
|
+
[0, 1, 1, 1, 0, 0, 0, 0], #1
|
|
29
|
+
[1, 0, 0, 0, 0, 0, 0, 0], #0
|
|
30
|
+
[0, 1, 1, 0, 0, 0, 1, 0], #2
|
|
31
|
+
[0, 0, 1, 1, 1, 0, 1, 1], #3
|
|
32
|
+
[0, 0, 1, 1, 1, 1, 1, 1], #4
|
|
33
|
+
[0, 1, 1, 1, 1, 1, 0, 0], #5
|
|
34
|
+
[1, 0, 1, 0, 1, 1, 1, 1], #6
|
|
35
|
+
[0, 0, 0, 1, 0, 0, 1, 0], #7
|
|
36
|
+
].reverse,
|
|
37
|
+
[
|
|
38
|
+
[0, 0, 1, 1, 0, 0, 0, 0], #1
|
|
39
|
+
[0, 1, 0, 0, 1, 0, 0, 0], #0
|
|
40
|
+
[0, 1, 0, 0, 0, 0, 0, 0], #2
|
|
41
|
+
[0, 0, 1, 1, 1, 0, 1, 0], #3
|
|
42
|
+
[0, 0, 1, 1, 1, 1, 1, 1], #4
|
|
43
|
+
[0, 1, 1, 1, 1, 1, 1, 1], #5
|
|
44
|
+
[0, 1, 0, 1, 0, 1, 0, 0], #6
|
|
45
|
+
[0, 0, 1, 0, 1, 1, 0, 0], #7
|
|
46
|
+
].reverse,
|
|
47
|
+
[
|
|
48
|
+
[0, 0, 0, 0, 0, 0, 0, 0], #1
|
|
49
|
+
[0, 1, 1, 0, 0, 0, 0, 0], #0
|
|
50
|
+
[1, 0, 0, 1, 0, 0, 1, 0], #2
|
|
51
|
+
[0, 1, 1, 1, 1, 0, 1, 1], #3
|
|
52
|
+
[0, 0, 1, 1, 1, 1, 1, 1], #4
|
|
53
|
+
[0, 0, 1, 1, 1, 1, 1, 0], #5
|
|
54
|
+
[0, 1, 1, 0, 1, 1, 0, 1], #6
|
|
55
|
+
[0, 1, 0, 0, 0, 0, 0, 0], #7
|
|
56
|
+
].reverse,
|
|
57
|
+
[
|
|
58
|
+
[0, 0, 0, 1, 0, 0, 0, 0], #1
|
|
59
|
+
[0, 1, 1, 0, 0, 0, 1, 0], #0
|
|
60
|
+
[1, 0, 0, 1, 0, 0, 1, 1], #2
|
|
61
|
+
[0, 1, 1, 1, 1, 1, 1, 1], #3
|
|
62
|
+
[0, 0, 1, 1, 1, 1, 0, 0], #4
|
|
63
|
+
[0, 1, 1, 1, 1, 1, 1, 1], #5
|
|
64
|
+
[0, 1, 0, 1, 0, 1, 1, 0], #6
|
|
65
|
+
[1, 0, 0, 0, 0, 0, 0, 1], #7
|
|
66
|
+
].reverse
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
colours = [
|
|
70
|
+
Ws2812::Color.new(0, 0, 0),
|
|
71
|
+
Ws2812::Color.new(214, 135, 23)
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
puts "Hit ^C to terminate"
|
|
75
|
+
|
|
76
|
+
begin
|
|
77
|
+
cat.cycle do |frame|
|
|
78
|
+
display frame, colours
|
|
79
|
+
sleep 0.1
|
|
80
|
+
end
|
|
81
|
+
rescue Interrupt
|
|
82
|
+
# ignored
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
$hat.clear
|
data/ext/ws2812/extconf.rb
CHANGED
|
@@ -9,16 +9,3 @@ unless FileTest.exists?(File.dirname(__FILE__) + '/lowlevel_wrap.c')
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
create_makefile 'ws2812/lowlevel'
|
|
12
|
-
|
|
13
|
-
File.open('Makefile', 'at') do |mk|
|
|
14
|
-
mk.puts <<EOF
|
|
15
|
-
clean: clean-rpilowlevel
|
|
16
|
-
distclean: distclean-rpilowlevel
|
|
17
|
-
|
|
18
|
-
clean-rpilowlevel:
|
|
19
|
-
rm -f Makefile
|
|
20
|
-
|
|
21
|
-
distclean-rpilowlevel:
|
|
22
|
-
rm -f *_wrap.c
|
|
23
|
-
EOF
|
|
24
|
-
end
|
data/ext/ws2812/lowlevel_wrap.c
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* ----------------------------------------------------------------------------
|
|
2
2
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
|
3
|
-
* Version 2.0.
|
|
4
|
-
*
|
|
5
|
-
* This file is not intended to be easily readable and contains a number of
|
|
3
|
+
* Version 2.0.7
|
|
4
|
+
*
|
|
5
|
+
* This file is not intended to be easily readable and contains a number of
|
|
6
6
|
* coding conventions designed to improve portability and efficiency. Do not make
|
|
7
|
-
* changes to this file unless you know what you are doing--modify the SWIG
|
|
8
|
-
* interface file instead.
|
|
7
|
+
* changes to this file unless you know what you are doing--modify the SWIG
|
|
8
|
+
* interface file instead.
|
|
9
9
|
* ----------------------------------------------------------------------------- */
|
|
10
10
|
|
|
11
11
|
#define SWIGRUBY
|
|
@@ -41,28 +41,28 @@
|
|
|
41
41
|
#ifndef SWIGUNUSED
|
|
42
42
|
# if defined(__GNUC__)
|
|
43
43
|
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
|
44
|
-
# define SWIGUNUSED __attribute__ ((__unused__))
|
|
44
|
+
# define SWIGUNUSED __attribute__ ((__unused__))
|
|
45
45
|
# else
|
|
46
46
|
# define SWIGUNUSED
|
|
47
47
|
# endif
|
|
48
48
|
# elif defined(__ICC)
|
|
49
|
-
# define SWIGUNUSED __attribute__ ((__unused__))
|
|
49
|
+
# define SWIGUNUSED __attribute__ ((__unused__))
|
|
50
50
|
# else
|
|
51
|
-
# define SWIGUNUSED
|
|
51
|
+
# define SWIGUNUSED
|
|
52
52
|
# endif
|
|
53
53
|
#endif
|
|
54
54
|
|
|
55
55
|
#ifndef SWIG_MSC_UNSUPPRESS_4505
|
|
56
56
|
# if defined(_MSC_VER)
|
|
57
57
|
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
|
|
58
|
-
# endif
|
|
58
|
+
# endif
|
|
59
59
|
#endif
|
|
60
60
|
|
|
61
61
|
#ifndef SWIGUNUSEDPARM
|
|
62
62
|
# ifdef __cplusplus
|
|
63
63
|
# define SWIGUNUSEDPARM(p)
|
|
64
64
|
# else
|
|
65
|
-
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
|
65
|
+
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
|
66
66
|
# endif
|
|
67
67
|
#endif
|
|
68
68
|
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
# define SWIGSTDCALL __stdcall
|
|
106
106
|
# else
|
|
107
107
|
# define SWIGSTDCALL
|
|
108
|
-
# endif
|
|
108
|
+
# endif
|
|
109
109
|
#endif
|
|
110
110
|
|
|
111
111
|
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
|
@@ -150,28 +150,28 @@
|
|
|
150
150
|
#ifndef SWIGUNUSED
|
|
151
151
|
# if defined(__GNUC__)
|
|
152
152
|
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
|
153
|
-
# define SWIGUNUSED __attribute__ ((__unused__))
|
|
153
|
+
# define SWIGUNUSED __attribute__ ((__unused__))
|
|
154
154
|
# else
|
|
155
155
|
# define SWIGUNUSED
|
|
156
156
|
# endif
|
|
157
157
|
# elif defined(__ICC)
|
|
158
|
-
# define SWIGUNUSED __attribute__ ((__unused__))
|
|
158
|
+
# define SWIGUNUSED __attribute__ ((__unused__))
|
|
159
159
|
# else
|
|
160
|
-
# define SWIGUNUSED
|
|
160
|
+
# define SWIGUNUSED
|
|
161
161
|
# endif
|
|
162
162
|
#endif
|
|
163
163
|
|
|
164
164
|
#ifndef SWIG_MSC_UNSUPPRESS_4505
|
|
165
165
|
# if defined(_MSC_VER)
|
|
166
166
|
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
|
|
167
|
-
# endif
|
|
167
|
+
# endif
|
|
168
168
|
#endif
|
|
169
169
|
|
|
170
170
|
#ifndef SWIGUNUSEDPARM
|
|
171
171
|
# ifdef __cplusplus
|
|
172
172
|
# define SWIGUNUSEDPARM(p)
|
|
173
173
|
# else
|
|
174
|
-
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
|
174
|
+
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
|
175
175
|
# endif
|
|
176
176
|
#endif
|
|
177
177
|
|
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
# define SWIGSTDCALL __stdcall
|
|
215
215
|
# else
|
|
216
216
|
# define SWIGSTDCALL
|
|
217
|
-
# endif
|
|
217
|
+
# endif
|
|
218
218
|
#endif
|
|
219
219
|
|
|
220
220
|
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
|
|
253
253
|
creating a static or dynamic library from the SWIG runtime code.
|
|
254
254
|
In 99.9% of the cases, SWIG just needs to declare them as 'static'.
|
|
255
|
-
|
|
255
|
+
|
|
256
256
|
But only do this if strictly necessary, ie, if you have problems
|
|
257
257
|
with your compiler or suchlike.
|
|
258
258
|
*/
|
|
@@ -278,16 +278,16 @@
|
|
|
278
278
|
#define SWIG_POINTER_OWN 0x1
|
|
279
279
|
|
|
280
280
|
|
|
281
|
-
/*
|
|
281
|
+
/*
|
|
282
282
|
Flags/methods for returning states.
|
|
283
|
-
|
|
284
|
-
The SWIG conversion methods, as ConvertPtr, return an integer
|
|
283
|
+
|
|
284
|
+
The SWIG conversion methods, as ConvertPtr, return an integer
|
|
285
285
|
that tells if the conversion was successful or not. And if not,
|
|
286
286
|
an error code can be returned (see swigerrors.swg for the codes).
|
|
287
|
-
|
|
287
|
+
|
|
288
288
|
Use the following macros/flags to set or process the returning
|
|
289
289
|
states.
|
|
290
|
-
|
|
290
|
+
|
|
291
291
|
In old versions of SWIG, code such as the following was usually written:
|
|
292
292
|
|
|
293
293
|
if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
|
|
@@ -320,23 +320,23 @@
|
|
|
320
320
|
} else {
|
|
321
321
|
// fail code
|
|
322
322
|
}
|
|
323
|
-
|
|
323
|
+
|
|
324
324
|
I.e., now SWIG_ConvertPtr can return new objects and you can
|
|
325
325
|
identify the case and take care of the deallocation. Of course that
|
|
326
326
|
also requires SWIG_ConvertPtr to return new result values, such as
|
|
327
327
|
|
|
328
|
-
int SWIG_ConvertPtr(obj, ptr,...) {
|
|
329
|
-
if (<obj is ok>) {
|
|
330
|
-
if (<need new object>) {
|
|
331
|
-
*ptr = <ptr to new allocated object>;
|
|
332
|
-
return SWIG_NEWOBJ;
|
|
333
|
-
} else {
|
|
334
|
-
*ptr = <ptr to old object>;
|
|
335
|
-
return SWIG_OLDOBJ;
|
|
336
|
-
}
|
|
337
|
-
} else {
|
|
338
|
-
return SWIG_BADOBJ;
|
|
339
|
-
}
|
|
328
|
+
int SWIG_ConvertPtr(obj, ptr,...) {
|
|
329
|
+
if (<obj is ok>) {
|
|
330
|
+
if (<need new object>) {
|
|
331
|
+
*ptr = <ptr to new allocated object>;
|
|
332
|
+
return SWIG_NEWOBJ;
|
|
333
|
+
} else {
|
|
334
|
+
*ptr = <ptr to old object>;
|
|
335
|
+
return SWIG_OLDOBJ;
|
|
336
|
+
}
|
|
337
|
+
} else {
|
|
338
|
+
return SWIG_BADOBJ;
|
|
339
|
+
}
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
|
|
@@ -350,17 +350,17 @@
|
|
|
350
350
|
int fooi(int);
|
|
351
351
|
|
|
352
352
|
and you call
|
|
353
|
-
|
|
353
|
+
|
|
354
354
|
food(1) // cast rank '1' (1 -> 1.0)
|
|
355
355
|
fooi(1) // cast rank '0'
|
|
356
356
|
|
|
357
357
|
just use the SWIG_AddCast()/SWIG_CheckState()
|
|
358
358
|
*/
|
|
359
359
|
|
|
360
|
-
#define SWIG_OK (0)
|
|
360
|
+
#define SWIG_OK (0)
|
|
361
361
|
#define SWIG_ERROR (-1)
|
|
362
362
|
#define SWIG_IsOK(r) (r >= 0)
|
|
363
|
-
#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
|
|
363
|
+
#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
|
|
364
364
|
|
|
365
365
|
/* The CastRankLimit says how many bits are used for the cast rank */
|
|
366
366
|
#define SWIG_CASTRANKLIMIT (1 << 8)
|
|
@@ -391,14 +391,14 @@
|
|
|
391
391
|
# endif
|
|
392
392
|
# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
|
|
393
393
|
# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
|
|
394
|
-
SWIGINTERNINLINE int SWIG_AddCast(int r) {
|
|
394
|
+
SWIGINTERNINLINE int SWIG_AddCast(int r) {
|
|
395
395
|
return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
|
|
396
396
|
}
|
|
397
|
-
SWIGINTERNINLINE int SWIG_CheckState(int r) {
|
|
398
|
-
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
|
|
397
|
+
SWIGINTERNINLINE int SWIG_CheckState(int r) {
|
|
398
|
+
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
|
|
399
399
|
}
|
|
400
400
|
#else /* no cast-rank mode */
|
|
401
|
-
# define SWIG_AddCast
|
|
401
|
+
# define SWIG_AddCast
|
|
402
402
|
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
|
|
403
403
|
#endif
|
|
404
404
|
|
|
@@ -442,7 +442,7 @@ typedef struct swig_module_info {
|
|
|
442
442
|
void *clientdata; /* Language specific module data */
|
|
443
443
|
} swig_module_info;
|
|
444
444
|
|
|
445
|
-
/*
|
|
445
|
+
/*
|
|
446
446
|
Compare two type names skipping the space characters, therefore
|
|
447
447
|
"char*" == "char *" and "Class<int>" == "Class<int >", etc.
|
|
448
448
|
|
|
@@ -462,18 +462,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
|
|
|
462
462
|
|
|
463
463
|
/*
|
|
464
464
|
Check type equivalence in a name list like <name1>|<name2>|...
|
|
465
|
-
Return 0 if equal,
|
|
465
|
+
Return 0 if not equal, 1 if equal
|
|
466
466
|
*/
|
|
467
467
|
SWIGRUNTIME int
|
|
468
|
-
|
|
469
|
-
int equiv =
|
|
468
|
+
SWIG_TypeEquiv(const char *nb, const char *tb) {
|
|
469
|
+
int equiv = 0;
|
|
470
470
|
const char* te = tb + strlen(tb);
|
|
471
471
|
const char* ne = nb;
|
|
472
|
-
while (equiv
|
|
472
|
+
while (!equiv && *ne) {
|
|
473
473
|
for (nb = ne; *ne; ++ne) {
|
|
474
474
|
if (*ne == '|') break;
|
|
475
475
|
}
|
|
476
|
-
equiv = SWIG_TypeNameComp(nb, ne, tb, te);
|
|
476
|
+
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
|
|
477
477
|
if (*ne) ++ne;
|
|
478
478
|
}
|
|
479
479
|
return equiv;
|
|
@@ -481,13 +481,24 @@ SWIG_TypeCmp(const char *nb, const char *tb) {
|
|
|
481
481
|
|
|
482
482
|
/*
|
|
483
483
|
Check type equivalence in a name list like <name1>|<name2>|...
|
|
484
|
-
Return 0 if
|
|
484
|
+
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
|
|
485
485
|
*/
|
|
486
486
|
SWIGRUNTIME int
|
|
487
|
-
|
|
488
|
-
|
|
487
|
+
SWIG_TypeCompare(const char *nb, const char *tb) {
|
|
488
|
+
int equiv = 0;
|
|
489
|
+
const char* te = tb + strlen(tb);
|
|
490
|
+
const char* ne = nb;
|
|
491
|
+
while (!equiv && *ne) {
|
|
492
|
+
for (nb = ne; *ne; ++ne) {
|
|
493
|
+
if (*ne == '|') break;
|
|
494
|
+
}
|
|
495
|
+
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
|
|
496
|
+
if (*ne) ++ne;
|
|
497
|
+
}
|
|
498
|
+
return equiv;
|
|
489
499
|
}
|
|
490
500
|
|
|
501
|
+
|
|
491
502
|
/*
|
|
492
503
|
Check the typename
|
|
493
504
|
*/
|
|
@@ -515,7 +526,7 @@ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
|
|
|
515
526
|
return 0;
|
|
516
527
|
}
|
|
517
528
|
|
|
518
|
-
/*
|
|
529
|
+
/*
|
|
519
530
|
Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
|
|
520
531
|
*/
|
|
521
532
|
SWIGRUNTIME swig_cast_info *
|
|
@@ -550,7 +561,7 @@ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
|
|
|
550
561
|
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
|
|
551
562
|
}
|
|
552
563
|
|
|
553
|
-
/*
|
|
564
|
+
/*
|
|
554
565
|
Dynamic pointer casting. Down an inheritance hierarchy
|
|
555
566
|
*/
|
|
556
567
|
SWIGRUNTIME swig_type_info *
|
|
@@ -594,7 +605,7 @@ SWIG_TypePrettyName(const swig_type_info *type) {
|
|
|
594
605
|
return type->name;
|
|
595
606
|
}
|
|
596
607
|
|
|
597
|
-
/*
|
|
608
|
+
/*
|
|
598
609
|
Set the clientdata field for a type
|
|
599
610
|
*/
|
|
600
611
|
SWIGRUNTIME void
|
|
@@ -602,14 +613,14 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
|
|
602
613
|
swig_cast_info *cast = ti->cast;
|
|
603
614
|
/* if (ti->clientdata == clientdata) return; */
|
|
604
615
|
ti->clientdata = clientdata;
|
|
605
|
-
|
|
616
|
+
|
|
606
617
|
while (cast) {
|
|
607
618
|
if (!cast->converter) {
|
|
608
619
|
swig_type_info *tc = cast->type;
|
|
609
620
|
if (!tc->clientdata) {
|
|
610
621
|
SWIG_TypeClientData(tc, clientdata);
|
|
611
622
|
}
|
|
612
|
-
}
|
|
623
|
+
}
|
|
613
624
|
cast = cast->next;
|
|
614
625
|
}
|
|
615
626
|
}
|
|
@@ -618,18 +629,18 @@ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
|
|
|
618
629
|
SWIG_TypeClientData(ti, clientdata);
|
|
619
630
|
ti->owndata = 1;
|
|
620
631
|
}
|
|
621
|
-
|
|
632
|
+
|
|
622
633
|
/*
|
|
623
634
|
Search for a swig_type_info structure only by mangled name
|
|
624
635
|
Search is a O(log #types)
|
|
625
|
-
|
|
626
|
-
We start searching at module start, and finish searching when start == end.
|
|
636
|
+
|
|
637
|
+
We start searching at module start, and finish searching when start == end.
|
|
627
638
|
Note: if start == end at the beginning of the function, we go all the way around
|
|
628
639
|
the circular list.
|
|
629
640
|
*/
|
|
630
641
|
SWIGRUNTIME swig_type_info *
|
|
631
|
-
SWIG_MangledTypeQueryModule(swig_module_info *start,
|
|
632
|
-
swig_module_info *end,
|
|
642
|
+
SWIG_MangledTypeQueryModule(swig_module_info *start,
|
|
643
|
+
swig_module_info *end,
|
|
633
644
|
const char *name) {
|
|
634
645
|
swig_module_info *iter = start;
|
|
635
646
|
do {
|
|
@@ -638,11 +649,11 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
|
|
|
638
649
|
register size_t r = iter->size - 1;
|
|
639
650
|
do {
|
|
640
651
|
/* since l+r >= 0, we can (>> 1) instead (/ 2) */
|
|
641
|
-
register size_t i = (l + r) >> 1;
|
|
652
|
+
register size_t i = (l + r) >> 1;
|
|
642
653
|
const char *iname = iter->types[i]->name;
|
|
643
654
|
if (iname) {
|
|
644
655
|
register int compare = strcmp(name, iname);
|
|
645
|
-
if (compare == 0) {
|
|
656
|
+
if (compare == 0) {
|
|
646
657
|
return iter->types[i];
|
|
647
658
|
} else if (compare < 0) {
|
|
648
659
|
if (i) {
|
|
@@ -667,14 +678,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
|
|
|
667
678
|
Search for a swig_type_info structure for either a mangled name or a human readable name.
|
|
668
679
|
It first searches the mangled names of the types, which is a O(log #types)
|
|
669
680
|
If a type is not found it then searches the human readable names, which is O(#types).
|
|
670
|
-
|
|
671
|
-
We start searching at module start, and finish searching when start == end.
|
|
681
|
+
|
|
682
|
+
We start searching at module start, and finish searching when start == end.
|
|
672
683
|
Note: if start == end at the beginning of the function, we go all the way around
|
|
673
684
|
the circular list.
|
|
674
685
|
*/
|
|
675
686
|
SWIGRUNTIME swig_type_info *
|
|
676
|
-
SWIG_TypeQueryModule(swig_module_info *start,
|
|
677
|
-
swig_module_info *end,
|
|
687
|
+
SWIG_TypeQueryModule(swig_module_info *start,
|
|
688
|
+
swig_module_info *end,
|
|
678
689
|
const char *name) {
|
|
679
690
|
/* STEP 1: Search the name field using binary search */
|
|
680
691
|
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
|
|
@@ -693,12 +704,12 @@ SWIG_TypeQueryModule(swig_module_info *start,
|
|
|
693
704
|
iter = iter->next;
|
|
694
705
|
} while (iter != end);
|
|
695
706
|
}
|
|
696
|
-
|
|
707
|
+
|
|
697
708
|
/* neither found a match */
|
|
698
709
|
return 0;
|
|
699
710
|
}
|
|
700
711
|
|
|
701
|
-
/*
|
|
712
|
+
/*
|
|
702
713
|
Pack binary data into a string
|
|
703
714
|
*/
|
|
704
715
|
SWIGRUNTIME char *
|
|
@@ -714,7 +725,7 @@ SWIG_PackData(char *c, void *ptr, size_t sz) {
|
|
|
714
725
|
return c;
|
|
715
726
|
}
|
|
716
727
|
|
|
717
|
-
/*
|
|
728
|
+
/*
|
|
718
729
|
Unpack binary data from a string
|
|
719
730
|
*/
|
|
720
731
|
SWIGRUNTIME const char *
|
|
@@ -728,21 +739,21 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|
|
728
739
|
uu = ((d - '0') << 4);
|
|
729
740
|
else if ((d >= 'a') && (d <= 'f'))
|
|
730
741
|
uu = ((d - ('a'-10)) << 4);
|
|
731
|
-
else
|
|
742
|
+
else
|
|
732
743
|
return (char *) 0;
|
|
733
744
|
d = *(c++);
|
|
734
745
|
if ((d >= '0') && (d <= '9'))
|
|
735
746
|
uu |= (d - '0');
|
|
736
747
|
else if ((d >= 'a') && (d <= 'f'))
|
|
737
748
|
uu |= (d - ('a'-10));
|
|
738
|
-
else
|
|
749
|
+
else
|
|
739
750
|
return (char *) 0;
|
|
740
751
|
*u = uu;
|
|
741
752
|
}
|
|
742
753
|
return c;
|
|
743
754
|
}
|
|
744
755
|
|
|
745
|
-
/*
|
|
756
|
+
/*
|
|
746
757
|
Pack 'void *' into a string buffer.
|
|
747
758
|
*/
|
|
748
759
|
SWIGRUNTIME char *
|
|
@@ -802,18 +813,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
|
|
|
802
813
|
#endif
|
|
803
814
|
|
|
804
815
|
/* Errors in SWIG */
|
|
805
|
-
#define SWIG_UnknownError -1
|
|
806
|
-
#define SWIG_IOError -2
|
|
807
|
-
#define SWIG_RuntimeError -3
|
|
808
|
-
#define SWIG_IndexError -4
|
|
809
|
-
#define SWIG_TypeError -5
|
|
810
|
-
#define SWIG_DivisionByZero -6
|
|
811
|
-
#define SWIG_OverflowError -7
|
|
812
|
-
#define SWIG_SyntaxError -8
|
|
813
|
-
#define SWIG_ValueError -9
|
|
816
|
+
#define SWIG_UnknownError -1
|
|
817
|
+
#define SWIG_IOError -2
|
|
818
|
+
#define SWIG_RuntimeError -3
|
|
819
|
+
#define SWIG_IndexError -4
|
|
820
|
+
#define SWIG_TypeError -5
|
|
821
|
+
#define SWIG_DivisionByZero -6
|
|
822
|
+
#define SWIG_OverflowError -7
|
|
823
|
+
#define SWIG_SyntaxError -8
|
|
824
|
+
#define SWIG_ValueError -9
|
|
814
825
|
#define SWIG_SystemError -10
|
|
815
826
|
#define SWIG_AttributeError -11
|
|
816
|
-
#define SWIG_MemoryError -12
|
|
827
|
+
#define SWIG_MemoryError -12
|
|
817
828
|
#define SWIG_NullReferenceError -13
|
|
818
829
|
|
|
819
830
|
|
|
@@ -1363,7 +1374,7 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
|
|
|
1363
1374
|
|
|
1364
1375
|
/* Runtime API */
|
|
1365
1376
|
|
|
1366
|
-
#define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule(
|
|
1377
|
+
#define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
|
|
1367
1378
|
#define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
|
|
1368
1379
|
|
|
1369
1380
|
|
|
@@ -1699,7 +1710,7 @@ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
|
|
|
1699
1710
|
}
|
|
1700
1711
|
|
|
1701
1712
|
SWIGRUNTIME swig_module_info *
|
|
1702
|
-
SWIG_Ruby_GetModule(void
|
|
1713
|
+
SWIG_Ruby_GetModule(void)
|
|
1703
1714
|
{
|
|
1704
1715
|
VALUE pointer;
|
|
1705
1716
|
swig_module_info *ret = 0;
|
|
@@ -1739,7 +1750,7 @@ SWIG_Ruby_SetModule(swig_module_info *pointer)
|
|
|
1739
1750
|
SWIGINTERN
|
|
1740
1751
|
int SWIG_Ruby_isCallable( VALUE proc )
|
|
1741
1752
|
{
|
|
1742
|
-
if ( rb_respond_to( proc, swig_call_id ) )
|
|
1753
|
+
if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
|
|
1743
1754
|
return 1;
|
|
1744
1755
|
return 0;
|
|
1745
1756
|
}
|
|
@@ -1752,7 +1763,7 @@ int SWIG_Ruby_isCallable( VALUE proc )
|
|
|
1752
1763
|
SWIGINTERN
|
|
1753
1764
|
int SWIG_Ruby_arity( VALUE proc, int minimal )
|
|
1754
1765
|
{
|
|
1755
|
-
if ( rb_respond_to( proc, swig_arity_id ) )
|
|
1766
|
+
if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
|
|
1756
1767
|
{
|
|
1757
1768
|
VALUE num = rb_funcall( proc, swig_arity_id, 0 );
|
|
1758
1769
|
int arity = NUM2INT(num);
|
|
@@ -1806,7 +1817,7 @@ static VALUE mLowlevel;
|
|
|
1806
1817
|
#define SWIG_RUBY_THREAD_END_BLOCK
|
|
1807
1818
|
|
|
1808
1819
|
|
|
1809
|
-
#define SWIGVERSION
|
|
1820
|
+
#define SWIGVERSION 0x020007
|
|
1810
1821
|
#define SWIG_VERSION SWIGVERSION
|
|
1811
1822
|
|
|
1812
1823
|
|
|
@@ -2657,6 +2668,31 @@ fail:
|
|
|
2657
2668
|
}
|
|
2658
2669
|
|
|
2659
2670
|
|
|
2671
|
+
SWIGINTERN VALUE
|
|
2672
|
+
_wrap_ws2811_dma_error_get(VALUE self) {
|
|
2673
|
+
VALUE _val;
|
|
2674
|
+
|
|
2675
|
+
_val = SWIG_From_unsigned_SS_int((unsigned int)(ws2811_dma_error));
|
|
2676
|
+
return _val;
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
|
|
2680
|
+
SWIGINTERN VALUE
|
|
2681
|
+
_wrap_ws2811_dma_error_set(VALUE self, VALUE _val) {
|
|
2682
|
+
{
|
|
2683
|
+
unsigned int val;
|
|
2684
|
+
int res = SWIG_AsVal_unsigned_SS_int(_val, &val);
|
|
2685
|
+
if (!SWIG_IsOK(res)) {
|
|
2686
|
+
SWIG_exception_fail(SWIG_ArgError(res), "in variable '""ws2811_dma_error""' of type '""uint32_t""'");
|
|
2687
|
+
}
|
|
2688
|
+
ws2811_dma_error = (uint32_t)(val);
|
|
2689
|
+
}
|
|
2690
|
+
return _val;
|
|
2691
|
+
fail:
|
|
2692
|
+
return Qnil;
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2695
|
+
|
|
2660
2696
|
SWIGINTERN VALUE
|
|
2661
2697
|
_wrap_ws2811_wait(int argc, VALUE *argv, VALUE self) {
|
|
2662
2698
|
ws2811_t *arg1 = (ws2811_t *) 0 ;
|
|
@@ -2849,18 +2885,18 @@ static swig_cast_info *swig_cast_initial[] = {
|
|
|
2849
2885
|
|
|
2850
2886
|
/* -----------------------------------------------------------------------------
|
|
2851
2887
|
* Type initialization:
|
|
2852
|
-
* This problem is tough by the requirement that no dynamic
|
|
2853
|
-
* memory is used. Also, since swig_type_info structures store pointers to
|
|
2888
|
+
* This problem is tough by the requirement that no dynamic
|
|
2889
|
+
* memory is used. Also, since swig_type_info structures store pointers to
|
|
2854
2890
|
* swig_cast_info structures and swig_cast_info structures store pointers back
|
|
2855
|
-
* to swig_type_info structures, we need some lookup code at initialization.
|
|
2856
|
-
* The idea is that swig generates all the structures that are needed.
|
|
2857
|
-
* The runtime then collects these partially filled structures.
|
|
2858
|
-
* The SWIG_InitializeModule function takes these initial arrays out of
|
|
2891
|
+
* to swig_type_info structures, we need some lookup code at initialization.
|
|
2892
|
+
* The idea is that swig generates all the structures that are needed.
|
|
2893
|
+
* The runtime then collects these partially filled structures.
|
|
2894
|
+
* The SWIG_InitializeModule function takes these initial arrays out of
|
|
2859
2895
|
* swig_module, and does all the lookup, filling in the swig_module.types
|
|
2860
2896
|
* array with the correct data and linking the correct swig_cast_info
|
|
2861
2897
|
* structures together.
|
|
2862
2898
|
*
|
|
2863
|
-
* The generated swig_type_info structures are assigned staticly to an initial
|
|
2899
|
+
* The generated swig_type_info structures are assigned staticly to an initial
|
|
2864
2900
|
* array. We just loop through that array, and handle each type individually.
|
|
2865
2901
|
* First we lookup if this type has been already loaded, and if so, use the
|
|
2866
2902
|
* loaded structure instead of the generated one. Then we have to fill in the
|
|
@@ -2870,17 +2906,17 @@ static swig_cast_info *swig_cast_initial[] = {
|
|
|
2870
2906
|
* a column is one of the swig_cast_info structures for that type.
|
|
2871
2907
|
* The cast_initial array is actually an array of arrays, because each row has
|
|
2872
2908
|
* a variable number of columns. So to actually build the cast linked list,
|
|
2873
|
-
* we find the array of casts associated with the type, and loop through it
|
|
2909
|
+
* we find the array of casts associated with the type, and loop through it
|
|
2874
2910
|
* adding the casts to the list. The one last trick we need to do is making
|
|
2875
2911
|
* sure the type pointer in the swig_cast_info struct is correct.
|
|
2876
2912
|
*
|
|
2877
|
-
* First off, we lookup the cast->type name to see if it is already loaded.
|
|
2913
|
+
* First off, we lookup the cast->type name to see if it is already loaded.
|
|
2878
2914
|
* There are three cases to handle:
|
|
2879
2915
|
* 1) If the cast->type has already been loaded AND the type we are adding
|
|
2880
2916
|
* casting info to has not been loaded (it is in this module), THEN we
|
|
2881
2917
|
* replace the cast->type pointer with the type pointer that has already
|
|
2882
2918
|
* been loaded.
|
|
2883
|
-
* 2) If BOTH types (the one we are adding casting info to, and the
|
|
2919
|
+
* 2) If BOTH types (the one we are adding casting info to, and the
|
|
2884
2920
|
* cast->type) are loaded, THEN the cast info has already been loaded by
|
|
2885
2921
|
* the previous module so we just ignore it.
|
|
2886
2922
|
* 3) Finally, if cast->type has not already been loaded, then we add that
|
|
@@ -2906,6 +2942,8 @@ SWIG_InitializeModule(void *clientdata) {
|
|
|
2906
2942
|
swig_module_info *module_head, *iter;
|
|
2907
2943
|
int found, init;
|
|
2908
2944
|
|
|
2945
|
+
clientdata = clientdata;
|
|
2946
|
+
|
|
2909
2947
|
/* check to see if the circular list has been setup, if not, set it up */
|
|
2910
2948
|
if (swig_module.next==0) {
|
|
2911
2949
|
/* Initialize the swig_module */
|
|
@@ -2943,7 +2981,7 @@ SWIG_InitializeModule(void *clientdata) {
|
|
|
2943
2981
|
module_head->next = &swig_module;
|
|
2944
2982
|
}
|
|
2945
2983
|
|
|
2946
|
-
/* When multiple
|
|
2984
|
+
/* When multiple interpeters are used, a module could have already been initialized in
|
|
2947
2985
|
a different interpreter, but not yet have a pointer in this interpreter.
|
|
2948
2986
|
In this case, we do not want to continue adding types... everything should be
|
|
2949
2987
|
set up already */
|
|
@@ -2957,7 +2995,7 @@ SWIG_InitializeModule(void *clientdata) {
|
|
|
2957
2995
|
swig_type_info *type = 0;
|
|
2958
2996
|
swig_type_info *ret;
|
|
2959
2997
|
swig_cast_info *cast;
|
|
2960
|
-
|
|
2998
|
+
|
|
2961
2999
|
#ifdef SWIGRUNTIME_DEBUG
|
|
2962
3000
|
printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
|
|
2963
3001
|
#endif
|
|
@@ -2984,7 +3022,7 @@ SWIG_InitializeModule(void *clientdata) {
|
|
|
2984
3022
|
/* Insert casting types */
|
|
2985
3023
|
cast = swig_module.cast_initial[i];
|
|
2986
3024
|
while (cast->type) {
|
|
2987
|
-
|
|
3025
|
+
|
|
2988
3026
|
/* Don't need to add information already in the list */
|
|
2989
3027
|
ret = 0;
|
|
2990
3028
|
#ifdef SWIGRUNTIME_DEBUG
|
|
@@ -3141,6 +3179,8 @@ SWIGEXPORT void Init_lowlevel(void) {
|
|
|
3141
3179
|
rb_define_singleton_method(mLowlevel, "ws2811_direct_colors", _wrap_ws2811_direct_colors_get, 0);
|
|
3142
3180
|
rb_define_singleton_method(mLowlevel, "ws2811_direct_colors=", _wrap_ws2811_direct_colors_set, 1);
|
|
3143
3181
|
rb_define_module_function(mLowlevel, "ws2811_render", _wrap_ws2811_render, -1);
|
|
3182
|
+
rb_define_singleton_method(mLowlevel, "ws2811_dma_error", _wrap_ws2811_dma_error_get, 0);
|
|
3183
|
+
rb_define_singleton_method(mLowlevel, "ws2811_dma_error=", _wrap_ws2811_dma_error_set, 1);
|
|
3144
3184
|
rb_define_module_function(mLowlevel, "ws2811_wait", _wrap_ws2811_wait, -1);
|
|
3145
3185
|
rb_define_module_function(mLowlevel, "ws2811_led_get", _wrap_ws2811_led_get, -1);
|
|
3146
3186
|
rb_define_module_function(mLowlevel, "ws2811_led_set", _wrap_ws2811_led_set, -1);
|
data/ext/ws2812/mailbox.c
CHANGED
|
@@ -101,7 +101,8 @@ static int mbox_property(int file_desc, void *buf)
|
|
|
101
101
|
ret_val = ioctl(fd, IOCTL_MBOX_PROPERTY, buf);
|
|
102
102
|
|
|
103
103
|
if (ret_val < 0) {
|
|
104
|
-
printf("ioctl_set_msg failed, errno %d: %m\n", errno);
|
|
104
|
+
// printf("ioctl_set_msg failed, errno %d: %m\n", errno);
|
|
105
|
+
// XXX: this is apparently the only error, so why would we bother anyone?
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
#ifdef DEBUG
|
|
@@ -267,6 +268,9 @@ unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigne
|
|
|
267
268
|
return p[5];
|
|
268
269
|
}
|
|
269
270
|
|
|
271
|
+
// mbox_open errors go here
|
|
272
|
+
int mbox_errno = MBOX_ERRNO_OK;
|
|
273
|
+
|
|
270
274
|
int mbox_open(void) {
|
|
271
275
|
int file_desc;
|
|
272
276
|
char filename[64];
|
|
@@ -277,17 +281,19 @@ int mbox_open(void) {
|
|
|
277
281
|
file_desc = open(filename, 0);
|
|
278
282
|
|
|
279
283
|
if( file_desc < 0 ){
|
|
280
|
-
printf("Failed to open %s, trying old method.\n", filename);
|
|
284
|
+
// printf("Failed to open %s, trying old method.\n", filename);
|
|
281
285
|
sprintf(filename, "/dev/mailbox-%d", getpid());
|
|
282
286
|
unlink(filename);
|
|
283
287
|
if (mknod(filename, S_IFCHR|0600, makedev(100, 0)) < 0) {
|
|
284
|
-
printf("Failed to create mailbox device %s: %m\n", filename);
|
|
288
|
+
// printf("Failed to create mailbox device %s: %m\n", filename);
|
|
289
|
+
mbox_errno = MBOX_ERRNO_CANT_MKNOD;
|
|
285
290
|
return -1;
|
|
286
291
|
}
|
|
287
292
|
file_desc = open(filename, 0);
|
|
288
293
|
}
|
|
289
294
|
if (file_desc < 0) {
|
|
290
|
-
|
|
295
|
+
mbox_errno = MBOX_ERRNO_CANT_OPEN;
|
|
296
|
+
// printf("Can't open device file %s: %m\n", filename);
|
|
291
297
|
//unlink(filename);
|
|
292
298
|
return -1;
|
|
293
299
|
}
|
data/ext/ws2812/mailbox.h
CHANGED
|
@@ -30,6 +30,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
30
30
|
#define MAJOR_NUM 100
|
|
31
31
|
#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *)
|
|
32
32
|
|
|
33
|
+
#define MBOX_ERRNO_OK 0
|
|
34
|
+
#define MBOX_ERRNO_CANT_MKNOD 1
|
|
35
|
+
#define MBOX_ERRNO_CANT_OPEN 2
|
|
36
|
+
// mbox_open errors go here
|
|
37
|
+
extern int mbox_errno;
|
|
38
|
+
|
|
33
39
|
int mbox_open(void);
|
|
34
40
|
void mbox_close(int file_desc);
|
|
35
41
|
|
data/ext/ws2812/ws2811.c
CHANGED
|
@@ -561,6 +561,11 @@ void ws2811_fini(ws2811_t *ws2811)
|
|
|
561
561
|
ws2811_cleanup(ws2811);
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
+
/**
|
|
565
|
+
* Contains any errors from executing ws2811_wait
|
|
566
|
+
*/
|
|
567
|
+
uint32_t ws2811_dma_error = 0;
|
|
568
|
+
|
|
564
569
|
/**
|
|
565
570
|
* Wait for any executing DMA operation to complete before returning.
|
|
566
571
|
*
|
|
@@ -580,7 +585,8 @@ int ws2811_wait(ws2811_t *ws2811)
|
|
|
580
585
|
|
|
581
586
|
if (dma->cs & RPI_DMA_CS_ERROR)
|
|
582
587
|
{
|
|
583
|
-
fprintf(stderr, "DMA Error: %08x\n", dma->debug);
|
|
588
|
+
// fprintf(stderr, "DMA Error: %08x\n", dma->debug);
|
|
589
|
+
ws2811_dma_error = dma->debug;
|
|
584
590
|
return -1;
|
|
585
591
|
}
|
|
586
592
|
|
data/ext/ws2812/ws2811.h
CHANGED
|
@@ -61,6 +61,7 @@ int ws2811_init(ws2811_t *ws2811); //< Initialize buffers/hardware
|
|
|
61
61
|
void ws2811_fini(ws2811_t *ws2811); //< Tear it all down
|
|
62
62
|
extern uint8_t ws2811_direct_colors; //< Set to non-zero to bypass "brightness" [gamma correction] altogether (default is 0)
|
|
63
63
|
int ws2811_render(ws2811_t *ws2811); //< Send LEDs off to hardware
|
|
64
|
+
extern uint32_t ws2811_dma_error; //< DMA errors from ws2811_wait go here
|
|
64
65
|
int ws2811_wait(ws2811_t *ws2811); //< Wait for DMA completion
|
|
65
66
|
|
|
66
67
|
|
data/lib/ws2812.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ws2812
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michal Jirků
|
|
@@ -9,6 +9,7 @@ authors:
|
|
|
9
9
|
- Richard Hirst
|
|
10
10
|
- Jeremy Garff
|
|
11
11
|
- Philip Howard
|
|
12
|
+
- Daniel Hollands
|
|
12
13
|
autorequire:
|
|
13
14
|
bindir: bin
|
|
14
15
|
cert_chain: []
|
|
@@ -56,6 +57,7 @@ files:
|
|
|
56
57
|
- Rakefile
|
|
57
58
|
- examples/basic.rb
|
|
58
59
|
- examples/binaryclock.rb
|
|
60
|
+
- examples/cat.rb
|
|
59
61
|
- examples/digiclock.rb
|
|
60
62
|
- examples/gamma-vs-direct.rb
|
|
61
63
|
- examples/unicornhat-test.rb
|