1
1
# This file was automatically generated by SWIG (http://www.swig.org).
2
- # Version 2 .0.12
2
+ # Version 4 .0.2
3
3
#
4
4
# Do not make changes to this file unless you know what you are doing--modify
5
5
# the SWIG interface file instead.
6
6
7
+ from sys import version_info as _swig_python_version_info
7
8
9
+ if _swig_python_version_info < (2 , 7 , 0 ):
10
+ raise RuntimeError ("Python 2.7 or later required" )
8
11
9
-
10
-
11
- from sys import version_info
12
- if version_info >= (2 ,6 ,0 ):
13
- def swig_import_helper ():
14
- from os .path import dirname
15
- import imp
16
- fp = None
17
- try :
18
- fp , pathname , description = imp .find_module ('_rpi_ws281x' , [dirname (__file__ )])
19
- except ImportError :
20
- import _rpi_ws281x
21
- return _rpi_ws281x
22
- if fp is not None :
23
- try :
24
- _mod = imp .load_module ('_rpi_ws281x' , fp , pathname , description )
25
- finally :
26
- fp .close ()
27
- return _mod
28
- _rpi_ws281x = swig_import_helper ()
29
- del swig_import_helper
12
+ # Import the low-level C/C++ module
13
+ if __package__ or "." in __name__ :
14
+ from . import _rpi_ws281x
30
15
else :
31
16
import _rpi_ws281x
32
- del version_info
17
+
33
18
try :
34
- _swig_property = property
35
- except NameError :
36
- pass # Python < 2.2 doesn't have 'property'.
37
- def _swig_setattr_nondynamic (self ,class_type ,name ,value ,static = 1 ):
38
- if (name == "thisown" ): return self .this .own (value )
39
- if (name == "this" ):
40
- if type (value ).__name__ == 'SwigPyObject' :
41
- self .__dict__ [name ] = value
42
- return
43
- method = class_type .__swig_setmethods__ .get (name ,None )
44
- if method : return method (self ,value )
45
- if (not static ):
46
- self .__dict__ [name ] = value
47
- else :
48
- raise AttributeError ("You cannot add attributes to %s" % self )
49
-
50
- def _swig_setattr (self ,class_type ,name ,value ):
51
- return _swig_setattr_nondynamic (self ,class_type ,name ,value ,0 )
52
-
53
- def _swig_getattr (self ,class_type ,name ):
54
- if (name == "thisown" ): return self .this .own ()
55
- method = class_type .__swig_getmethods__ .get (name ,None )
56
- if method : return method (self )
57
- raise AttributeError (name )
19
+ import builtins as __builtin__
20
+ except ImportError :
21
+ import __builtin__
22
+
58
23
59
24
def _swig_repr (self ):
60
- try : strthis = "proxy of " + self .this .__repr__ ()
61
- except : strthis = ""
62
- return "<%s.%s; %s >" % (self .__class__ .__module__ , self .__class__ .__name__ , strthis ,)
25
+ try :
26
+ strthis = "proxy of " + self .this .__repr__ ()
27
+ except __builtin__ .Exception :
28
+ strthis = ""
29
+ return "<%s.%s; %s >" % (
30
+ self .__class__ .__module__ ,
31
+ self .__class__ .__name__ ,
32
+ strthis ,
33
+ )
63
34
64
- try :
65
- _object = object
66
- _newclass = 1
67
- except AttributeError :
68
- class _object : pass
69
- _newclass = 0
35
+
36
+ def _swig_setattr_nondynamic_instance_variable (set ):
37
+ def set_instance_attr (self , name , value ):
38
+ if name == "thisown" :
39
+ self .this .own (value )
40
+ elif name == "this" :
41
+ set (self , name , value )
42
+ elif hasattr (self , name ) and isinstance (getattr (type (self ), name ), property ):
43
+ set (self , name , value )
44
+ else :
45
+ raise AttributeError ("You cannot add instance attributes to %s" % self )
46
+
47
+ return set_instance_attr
48
+
49
+
50
+ def _swig_setattr_nondynamic_class_variable (set ):
51
+ def set_class_attr (cls , name , value ):
52
+ if hasattr (cls , name ) and not isinstance (getattr (cls , name ), property ):
53
+ set (cls , name , value )
54
+ else :
55
+ raise AttributeError ("You cannot add class attributes to %s" % cls )
56
+
57
+ return set_class_attr
58
+
59
+
60
+ def _swig_add_metaclass (metaclass ):
61
+ """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
62
+
63
+ def wrapper (cls ):
64
+ return metaclass (cls .__name__ , cls .__bases__ , cls .__dict__ .copy ())
65
+
66
+ return wrapper
67
+
68
+
69
+ class _SwigNonDynamicMeta (type ):
70
+ """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
71
+
72
+ __setattr__ = _swig_setattr_nondynamic_class_variable (type .__setattr__ )
70
73
71
74
72
75
WS2811_TARGET_FREQ = _rpi_ws281x .WS2811_TARGET_FREQ
@@ -86,86 +89,85 @@ class _object : pass
86
89
WS2812_STRIP = _rpi_ws281x .WS2812_STRIP
87
90
SK6812_STRIP = _rpi_ws281x .SK6812_STRIP
88
91
SK6812W_STRIP = _rpi_ws281x .SK6812W_STRIP
89
- class ws2811_channel_t (_object ):
90
- __swig_setmethods__ = {}
91
- __setattr__ = lambda self , name , value : _swig_setattr (self , ws2811_channel_t , name , value )
92
- __swig_getmethods__ = {}
93
- __getattr__ = lambda self , name : _swig_getattr (self , ws2811_channel_t , name )
92
+
93
+
94
+ class ws2811_channel_t (object ):
95
+ thisown = property (
96
+ lambda x : x .this .own (), lambda x , v : x .this .own (v ), doc = "The membership flag"
97
+ )
94
98
__repr__ = _swig_repr
95
- __swig_setmethods__ ["gpionum" ] = _rpi_ws281x .ws2811_channel_t_gpionum_set
96
- __swig_getmethods__ ["gpionum" ] = _rpi_ws281x .ws2811_channel_t_gpionum_get
97
- if _newclass :gpionum = _swig_property (_rpi_ws281x .ws2811_channel_t_gpionum_get , _rpi_ws281x .ws2811_channel_t_gpionum_set )
98
- __swig_setmethods__ ["invert" ] = _rpi_ws281x .ws2811_channel_t_invert_set
99
- __swig_getmethods__ ["invert" ] = _rpi_ws281x .ws2811_channel_t_invert_get
100
- if _newclass :invert = _swig_property (_rpi_ws281x .ws2811_channel_t_invert_get , _rpi_ws281x .ws2811_channel_t_invert_set )
101
- __swig_setmethods__ ["count" ] = _rpi_ws281x .ws2811_channel_t_count_set
102
- __swig_getmethods__ ["count" ] = _rpi_ws281x .ws2811_channel_t_count_get
103
- if _newclass :count = _swig_property (_rpi_ws281x .ws2811_channel_t_count_get , _rpi_ws281x .ws2811_channel_t_count_set )
104
- __swig_setmethods__ ["strip_type" ] = _rpi_ws281x .ws2811_channel_t_strip_type_set
105
- __swig_getmethods__ ["strip_type" ] = _rpi_ws281x .ws2811_channel_t_strip_type_get
106
- if _newclass :strip_type = _swig_property (_rpi_ws281x .ws2811_channel_t_strip_type_get , _rpi_ws281x .ws2811_channel_t_strip_type_set )
107
- __swig_setmethods__ ["leds" ] = _rpi_ws281x .ws2811_channel_t_leds_set
108
- __swig_getmethods__ ["leds" ] = _rpi_ws281x .ws2811_channel_t_leds_get
109
- if _newclass :leds = _swig_property (_rpi_ws281x .ws2811_channel_t_leds_get , _rpi_ws281x .ws2811_channel_t_leds_set )
110
- __swig_setmethods__ ["brightness" ] = _rpi_ws281x .ws2811_channel_t_brightness_set
111
- __swig_getmethods__ ["brightness" ] = _rpi_ws281x .ws2811_channel_t_brightness_get
112
- if _newclass :brightness = _swig_property (_rpi_ws281x .ws2811_channel_t_brightness_get , _rpi_ws281x .ws2811_channel_t_brightness_set )
113
- __swig_setmethods__ ["wshift" ] = _rpi_ws281x .ws2811_channel_t_wshift_set
114
- __swig_getmethods__ ["wshift" ] = _rpi_ws281x .ws2811_channel_t_wshift_get
115
- if _newclass :wshift = _swig_property (_rpi_ws281x .ws2811_channel_t_wshift_get , _rpi_ws281x .ws2811_channel_t_wshift_set )
116
- __swig_setmethods__ ["rshift" ] = _rpi_ws281x .ws2811_channel_t_rshift_set
117
- __swig_getmethods__ ["rshift" ] = _rpi_ws281x .ws2811_channel_t_rshift_get
118
- if _newclass :rshift = _swig_property (_rpi_ws281x .ws2811_channel_t_rshift_get , _rpi_ws281x .ws2811_channel_t_rshift_set )
119
- __swig_setmethods__ ["gshift" ] = _rpi_ws281x .ws2811_channel_t_gshift_set
120
- __swig_getmethods__ ["gshift" ] = _rpi_ws281x .ws2811_channel_t_gshift_get
121
- if _newclass :gshift = _swig_property (_rpi_ws281x .ws2811_channel_t_gshift_get , _rpi_ws281x .ws2811_channel_t_gshift_set )
122
- __swig_setmethods__ ["bshift" ] = _rpi_ws281x .ws2811_channel_t_bshift_set
123
- __swig_getmethods__ ["bshift" ] = _rpi_ws281x .ws2811_channel_t_bshift_get
124
- if _newclass :bshift = _swig_property (_rpi_ws281x .ws2811_channel_t_bshift_get , _rpi_ws281x .ws2811_channel_t_bshift_set )
125
- __swig_setmethods__ ["gamma" ] = _rpi_ws281x .ws2811_channel_t_gamma_set
126
- __swig_getmethods__ ["gamma" ] = _rpi_ws281x .ws2811_channel_t_gamma_get
127
- if _newclass :gamma = _swig_property (_rpi_ws281x .ws2811_channel_t_gamma_get , _rpi_ws281x .ws2811_channel_t_gamma_set )
128
- def __init__ (self ):
129
- this = _rpi_ws281x .new_ws2811_channel_t ()
130
- try : self .this .append (this )
131
- except : self .this = this
99
+ gpionum = property (
100
+ _rpi_ws281x .ws2811_channel_t_gpionum_get ,
101
+ _rpi_ws281x .ws2811_channel_t_gpionum_set ,
102
+ )
103
+ invert = property (
104
+ _rpi_ws281x .ws2811_channel_t_invert_get , _rpi_ws281x .ws2811_channel_t_invert_set
105
+ )
106
+ count = property (
107
+ _rpi_ws281x .ws2811_channel_t_count_get , _rpi_ws281x .ws2811_channel_t_count_set
108
+ )
109
+ strip_type = property (
110
+ _rpi_ws281x .ws2811_channel_t_strip_type_get ,
111
+ _rpi_ws281x .ws2811_channel_t_strip_type_set ,
112
+ )
113
+ leds = property (
114
+ _rpi_ws281x .ws2811_channel_t_leds_get , _rpi_ws281x .ws2811_channel_t_leds_set
115
+ )
116
+ brightness = property (
117
+ _rpi_ws281x .ws2811_channel_t_brightness_get ,
118
+ _rpi_ws281x .ws2811_channel_t_brightness_set ,
119
+ )
120
+ wshift = property (
121
+ _rpi_ws281x .ws2811_channel_t_wshift_get , _rpi_ws281x .ws2811_channel_t_wshift_set
122
+ )
123
+ rshift = property (
124
+ _rpi_ws281x .ws2811_channel_t_rshift_get , _rpi_ws281x .ws2811_channel_t_rshift_set
125
+ )
126
+ gshift = property (
127
+ _rpi_ws281x .ws2811_channel_t_gshift_get , _rpi_ws281x .ws2811_channel_t_gshift_set
128
+ )
129
+ bshift = property (
130
+ _rpi_ws281x .ws2811_channel_t_bshift_get , _rpi_ws281x .ws2811_channel_t_bshift_set
131
+ )
132
+ gamma = property (
133
+ _rpi_ws281x .ws2811_channel_t_gamma_get , _rpi_ws281x .ws2811_channel_t_gamma_set
134
+ )
135
+
136
+ def __init__ (self ):
137
+ _rpi_ws281x .ws2811_channel_t_swiginit (self , _rpi_ws281x .new_ws2811_channel_t ())
138
+
132
139
__swig_destroy__ = _rpi_ws281x .delete_ws2811_channel_t
133
- __del__ = lambda self : None ;
134
- ws2811_channel_t_swigregister = _rpi_ws281x .ws2811_channel_t_swigregister
135
- ws2811_channel_t_swigregister (ws2811_channel_t )
136
-
137
- class ws2811_t (_object ):
138
- __swig_setmethods__ = {}
139
- __setattr__ = lambda self , name , value : _swig_setattr (self , ws2811_t , name , value )
140
- __swig_getmethods__ = {}
141
- __getattr__ = lambda self , name : _swig_getattr (self , ws2811_t , name )
140
+
141
+
142
+ # Register ws2811_channel_t in _rpi_ws281x:
143
+ _rpi_ws281x .ws2811_channel_t_swigregister (ws2811_channel_t )
144
+
145
+
146
+ class ws2811_t (object ):
147
+ thisown = property (
148
+ lambda x : x .this .own (), lambda x , v : x .this .own (v ), doc = "The membership flag"
149
+ )
142
150
__repr__ = _swig_repr
143
- __swig_setmethods__ ["render_wait_time" ] = _rpi_ws281x .ws2811_t_render_wait_time_set
144
- __swig_getmethods__ ["render_wait_time" ] = _rpi_ws281x .ws2811_t_render_wait_time_get
145
- if _newclass :render_wait_time = _swig_property (_rpi_ws281x .ws2811_t_render_wait_time_get , _rpi_ws281x .ws2811_t_render_wait_time_set )
146
- __swig_setmethods__ ["device" ] = _rpi_ws281x .ws2811_t_device_set
147
- __swig_getmethods__ ["device" ] = _rpi_ws281x .ws2811_t_device_get
148
- if _newclass :device = _swig_property (_rpi_ws281x .ws2811_t_device_get , _rpi_ws281x .ws2811_t_device_set )
149
- __swig_setmethods__ ["rpi_hw" ] = _rpi_ws281x .ws2811_t_rpi_hw_set
150
- __swig_getmethods__ ["rpi_hw" ] = _rpi_ws281x .ws2811_t_rpi_hw_get
151
- if _newclass :rpi_hw = _swig_property (_rpi_ws281x .ws2811_t_rpi_hw_get , _rpi_ws281x .ws2811_t_rpi_hw_set )
152
- __swig_setmethods__ ["freq" ] = _rpi_ws281x .ws2811_t_freq_set
153
- __swig_getmethods__ ["freq" ] = _rpi_ws281x .ws2811_t_freq_get
154
- if _newclass :freq = _swig_property (_rpi_ws281x .ws2811_t_freq_get , _rpi_ws281x .ws2811_t_freq_set )
155
- __swig_setmethods__ ["dmanum" ] = _rpi_ws281x .ws2811_t_dmanum_set
156
- __swig_getmethods__ ["dmanum" ] = _rpi_ws281x .ws2811_t_dmanum_get
157
- if _newclass :dmanum = _swig_property (_rpi_ws281x .ws2811_t_dmanum_get , _rpi_ws281x .ws2811_t_dmanum_set )
158
- __swig_setmethods__ ["channel" ] = _rpi_ws281x .ws2811_t_channel_set
159
- __swig_getmethods__ ["channel" ] = _rpi_ws281x .ws2811_t_channel_get
160
- if _newclass :channel = _swig_property (_rpi_ws281x .ws2811_t_channel_get , _rpi_ws281x .ws2811_t_channel_set )
161
- def __init__ (self ):
162
- this = _rpi_ws281x .new_ws2811_t ()
163
- try : self .this .append (this )
164
- except : self .this = this
151
+ render_wait_time = property (
152
+ _rpi_ws281x .ws2811_t_render_wait_time_get ,
153
+ _rpi_ws281x .ws2811_t_render_wait_time_set ,
154
+ )
155
+ device = property (_rpi_ws281x .ws2811_t_device_get , _rpi_ws281x .ws2811_t_device_set )
156
+ rpi_hw = property (_rpi_ws281x .ws2811_t_rpi_hw_get , _rpi_ws281x .ws2811_t_rpi_hw_set )
157
+ freq = property (_rpi_ws281x .ws2811_t_freq_get , _rpi_ws281x .ws2811_t_freq_set )
158
+ dmanum = property (_rpi_ws281x .ws2811_t_dmanum_get , _rpi_ws281x .ws2811_t_dmanum_set )
159
+ channel = property (
160
+ _rpi_ws281x .ws2811_t_channel_get , _rpi_ws281x .ws2811_t_channel_set
161
+ )
162
+
163
+ def __init__ (self ):
164
+ _rpi_ws281x .ws2811_t_swiginit (self , _rpi_ws281x .new_ws2811_t ())
165
+
165
166
__swig_destroy__ = _rpi_ws281x .delete_ws2811_t
166
- __del__ = lambda self : None ;
167
- ws2811_t_swigregister = _rpi_ws281x .ws2811_t_swigregister
168
- ws2811_t_swigregister (ws2811_t )
167
+
168
+
169
+ # Register ws2811_t in _rpi_ws281x:
170
+ _rpi_ws281x .ws2811_t_swigregister (ws2811_t )
169
171
170
172
WS2811_SUCCESS = _rpi_ws281x .WS2811_SUCCESS
171
173
WS2811_ERROR_GENERIC = _rpi_ws281x .WS2811_ERROR_GENERIC
@@ -184,37 +186,38 @@ def __init__(self):
184
186
WS2811_ERROR_SPI_TRANSFER = _rpi_ws281x .WS2811_ERROR_SPI_TRANSFER
185
187
WS2811_RETURN_STATE_COUNT = _rpi_ws281x .WS2811_RETURN_STATE_COUNT
186
188
187
- def ws2811_init (* args ):
188
- return _rpi_ws281x .ws2811_init (* args )
189
- ws2811_init = _rpi_ws281x .ws2811_init
190
189
191
- def ws2811_fini (* args ):
192
- return _rpi_ws281x .ws2811_fini (* args )
193
- ws2811_fini = _rpi_ws281x .ws2811_fini
190
+ def ws2811_init (ws2811 ):
191
+ return _rpi_ws281x .ws2811_init (ws2811 )
192
+
193
+
194
+ def ws2811_fini (ws2811 ):
195
+ return _rpi_ws281x .ws2811_fini (ws2811 )
196
+
197
+
198
+ def ws2811_render (ws2811 ):
199
+ return _rpi_ws281x .ws2811_render (ws2811 )
200
+
201
+
202
+ def ws2811_wait (ws2811 ):
203
+ return _rpi_ws281x .ws2811_wait (ws2811 )
204
+
205
+
206
+ def ws2811_get_return_t_str (state ):
207
+ return _rpi_ws281x .ws2811_get_return_t_str (state )
194
208
195
- def ws2811_render (* args ):
196
- return _rpi_ws281x .ws2811_render (* args )
197
- ws2811_render = _rpi_ws281x .ws2811_render
198
209
199
- def ws2811_wait (* args ):
200
- return _rpi_ws281x .ws2811_wait (* args )
201
- ws2811_wait = _rpi_ws281x .ws2811_wait
210
+ def ws2811_set_custom_gamma_factor (ws2811 , gamma_factor ):
211
+ return _rpi_ws281x .ws2811_set_custom_gamma_factor (ws2811 , gamma_factor )
202
212
203
- def ws2811_get_return_t_str (* args ):
204
- return _rpi_ws281x .ws2811_get_return_t_str (* args )
205
- ws2811_get_return_t_str = _rpi_ws281x .ws2811_get_return_t_str
206
213
207
- def ws2811_led_get (* args ):
208
- return _rpi_ws281x .ws2811_led_get (* args )
209
- ws2811_led_get = _rpi_ws281x .ws2811_led_get
214
+ def ws2811_led_get (channel , lednum ):
215
+ return _rpi_ws281x .ws2811_led_get (channel , lednum )
210
216
211
- def ws2811_led_set (* args ):
212
- return _rpi_ws281x .ws2811_led_set (* args )
213
- ws2811_led_set = _rpi_ws281x .ws2811_led_set
214
217
215
- def ws2811_channel_get (* args ):
216
- return _rpi_ws281x .ws2811_channel_get (* args )
217
- ws2811_channel_get = _rpi_ws281x .ws2811_channel_get
218
- # This file is compatible with both classic and new-style classes.
218
+ def ws2811_led_set (channel , lednum , color ):
219
+ return _rpi_ws281x .ws2811_led_set (channel , lednum , color )
219
220
220
221
222
+ def ws2811_channel_get (ws , channelnum ):
223
+ return _rpi_ws281x .ws2811_channel_get (ws , channelnum )
0 commit comments