1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: package pixtendv2s</title>
<meta charset="utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>pixtendv2s</strong></big></big> (version 0.1.4)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/lib/python2.7/dist-packages/pixtendlibv2-0.1.4-py2.7.egg/pixtendv2s/__init__.py">/usr/local/lib/python2.7/dist-packages/pixtendlibv2-0.1.4-py2.7.egg/pixtendv2s/__init__.py</a></font></td></tr></table>
<p><tt># coding=utf-8</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="pixtendv2core.html#PiXtendV2Core">pixtendv2core.PiXtendV2Core</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="pixtendv2s.html#PiXtendV2S">PiXtendV2S</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="PiXtendV2S">class <strong>PiXtendV2S</strong></a>(<a href="pixtendv2core.html#PiXtendV2Core">pixtendv2core.PiXtendV2Core</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>The <a href="#PiXtendV2S">PiXtendV2S</a> class is based off of the <a href="pixtendv2core.html#PiXtendV2Core">PiXtendV2Core</a> class, which provides basic and most common functions for<br>
PiXtend V2. This class must implement the abstract methods _unpack_spi_data and _pack_spi_data otherwise there<br>
can be no functioning data communication and no usable object at runtime.<br>
<br>
Notice:<br>
Only ONE single instance of this class is allowed per Raspberry Pi. Do not create multiple objects in the<br>
same or a different program. This will lead to inconsistent states of the PiXtend board used. The PPLv2 and the<br>
SPI Bus of the Raspberry Pi cannot handle multiple instances or objects.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="pixtendv2s.html#PiXtendV2S">PiXtendV2S</a></dd>
<dd><a href="pixtendv2core.html#PiXtendV2Core">pixtendv2core.PiXtendV2Core</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="PiXtendV2S-__init__"><strong>__init__</strong></a>(self, spi_speed<font color="#909090">=700000</font>, com_interval<font color="#909090">=0.03</font>, model<font color="#909090">=83</font>, disable_dac<font color="#909090">=False</font>)</dt><dd><tt>Constructor of the PixtendV2S class. Create needed variables to store the settings and values for the PiXtend V2<br>
board which are transferred via SPI to the on-board microcontroller. The the core class (<a href="pixtendv2core.html#PiXtendV2Core">PiXtendV2Core</a>) does<br>
not provide all needed variables and functions, only the basic and most common functions of the PiXtend V2<br>
system. This class has to build and supply the rest.<br>
<br>
:param int spi_speed: SPI communication speed, default is 700000<br>
:param float com_interval: Cycle time of the communication, how often is data exchanged between the<br>
Raspberry Pi and the microcontroller on the PiXtend board, default is 30 ms<br>
:param int model: The model number of the PiXtend board which is used. S = 83 and L = 76<br>
:param bool disable_dac: The DAC (analog output) can be disabled to allow the use of the CAN-Bus on the<br>
PiXtend V2 -L- board</tt></dd></dl>
<dl><dt><a name="PiXtendV2S-close"><strong>close</strong></a>(self)</dt><dd><tt>The 'close' function needs to be called to terminate the asynchronous SPI communication in the background and to<br>
close the SPI driver. This function must be called before the <a href="#PiXtendV2S">PiXtendV2S</a> object is destroyed in the program<br>
it is used in.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>analog_in0</strong></dt>
<dd><tt>Get the value of analog input 0 as a float value converted to volts. The returned value is<br>
based on the 5 volts / 10 volts jumper setting.<br>
<br>
:return: Current value<br>
:rtype: float</tt></dd>
</dl>
<dl><dt><strong>analog_in0_raw</strong></dt>
<dd><tt>Get the raw value of analog input 0.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>analog_in1</strong></dt>
<dd><tt>Get the value of analog input 1 as a float value converted to volts. The returned value is<br>
based on the 5 volts / 10 volts jumper setting.<br>
<br>
:return: Current value<br>
:rtype: float</tt></dd>
</dl>
<dl><dt><strong>analog_in1_raw</strong></dt>
<dd><tt>Get the raw value of analog input 1.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>crc_data_in_error</strong></dt>
<dd><tt>Get the error state of the CRC check performed on the incoming SPI data.<br>
<br>
:return: Current value, False means no error, True means the data is not correct, error<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>crc_data_in_error_counter</strong></dt>
<dd><tt>Get the error counter of the CRC check performed on the incoming SPI data.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>digital_in0</strong></dt>
<dd><tt>Get the state of digital input 0. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_in1</strong></dt>
<dd><tt>Get the state of digital input 1. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_in2</strong></dt>
<dd><tt>Get the state of digital input 2. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_in3</strong></dt>
<dd><tt>Get the state of digital input 3. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_in4</strong></dt>
<dd><tt>Get the state of digital input 4. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_in5</strong></dt>
<dd><tt>Get the state of digital input 5. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_in6</strong></dt>
<dd><tt>Get the state of digital input 6. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_in7</strong></dt>
<dd><tt>Get the state of digital input 7. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_out0</strong></dt>
<dd><tt>Get or Set the state of digital output 0. A value False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_out1</strong></dt>
<dd><tt>Get or Set the state of digital output 1. A value False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_out2</strong></dt>
<dd><tt>Get or Set the state of digital output 2. A value False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>digital_out3</strong></dt>
<dd><tt>Get or Set the state of digital output 3. A value False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>jumper_setting_ai0</strong></dt>
<dd><tt>Get or Set the 5 volts / 10 volts jumper setting, depending if the jumper was physically set on the<br>
PiXtend V2 -S- board or not.<br>
The library needs to know this setting to perform correct calculations of the raw analog<br>
value of the analog input 0 when it is converted it's final float value.<br>
<br>
The default setting is 10 volts (True), no jumper set.<br>
<br>
:return: Current jumper setting<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>jumper_setting_ai1</strong></dt>
<dd><tt>Get or Set the 5 volts / 10 volts jumper setting, depending if the jumper was physically set on the<br>
PiXtend V2 -S- board or not.<br>
The library needs to know this setting to perform correct calculations of the raw analog<br>
value of the analog input 1 when it is converted it's final float value.<br>
<br>
The default setting is 10 volts (True), no jumper set.<br>
<br>
:return: Current jumper setting<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>pwm0_ctrl0</strong></dt>
<dd><tt>Get or Set the PWM0Ctrl0 property. This int value controls the configuration of PWM0 channel A & B.<br>
This property has the following bits which control PWM0:<br>
Bit 0 - Mode0<br>
Bit 1 - Mode1<br>
Bit 3 - EnableA<br>
Bit 4 - EnableB<br>
Bit 5 - Prescaler0<br>
Bit 6 - Prescaler1<br>
Bit 7 - Prescaler2<br>
<br>
See the software manual for more details on this property and it's bits.<br>
The int value must be between 0 and 255.<br>
<br>
:return: Current PWM0Ctrl0 value.<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>pwm0_ctrl1</strong></dt>
<dd><tt>Get or Set the PWM0Ctrl1 property. It is used to set the frequency for PWM0 channels A & B, but only if the<br>
selected PWM mode makes use of this value. See the software manual for more information on this topic.<br>
The int value must be between 0 and 65535 (16 bits).<br>
<br>
:return: Current PWM0Ctrl1 value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>pwm0a</strong></dt>
<dd><tt>Get or Set the value for PWM0 channel A. This property can be used to set the duty cycle of PWM0, however the<br>
exact usage depends on the PWM mode selected through the property pwm0_ctrl0. The value must be between<br>
0 and 65535, more information on the usage of PWM with PiXtend V2 -S- can be found in the software manual.<br>
<br>
:return: Current PWM0 channel A value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>pwm0b</strong></dt>
<dd><tt>Get or Set the value for PWM0 channel B. This property can be used to set the duty cycle of PWM0, however the<br>
exact usage depends on the PWM mode selected through the property pwm0_ctrl0. The value must be between<br>
0 and 65535, more information on the usage of PWM with PiXtend V2 -S- can be found in the software manual.<br>
<br>
:return: Current PWM0 channel B value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>pwm1_ctrl0</strong></dt>
<dd><tt>Get or Set the PWM1Ctrl0 property. This int value controls the configuration of PWM1 channel A & B.<br>
This property has the following bits which control PWM1:<br>
Bit 0 - Mode0<br>
Bit 1 - Mode1<br>
Bit 3 - EnableA<br>
Bit 4 - EnableB<br>
Bit 5 - Prescaler0<br>
Bit 6 - Prescaler1<br>
Bit 7 - Prescaler2<br>
<br>
See the software manual for more details on this property and it's bits.<br>
The int value must be between 0 and 255.<br>
<br>
:return: Current PWM1Ctrl0 value.<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>pwm1_ctrl1</strong></dt>
<dd><tt>Get or Set the PWM1Ctrl1 property. It is used to set the frequency for PWM1 channels A & B, but only if the<br>
selected PWM mode makes use of this value. See the software manual for more information on this topic.<br>
The int value must be between 0 and 255 (8 bits).<br>
<br>
:return: Current PWM1Ctrl1 value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>pwm1a</strong></dt>
<dd><tt>Get or Set the value for PWM1 channel A. This property can be used to set the duty cycle of PWM1, however the<br>
exact usage depends on the PWM mode selected through the property pwm1_ctrl0. The value must be between<br>
0 and 255, more information on the usage of PWM with PiXtend V2 -S- can be found in the software manual.<br>
<br>
:return: Current PWM1 channel A value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>pwm1b</strong></dt>
<dd><tt>Get or Set the value for PWM1 channel B. This property can be used to set the duty cycle of PWM1, however the<br>
exact usage depends on the PWM mode selected through the property pwm1_ctrl0. The value must be between<br>
0 and 255, more information on the usage of PWM with PiXtend V2 -S- can be found in the software manual.<br>
<br>
:return: Current PWM1 channel B value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>relay0</strong></dt>
<dd><tt>Get or Set the state of relay 0. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>relay1</strong></dt>
<dd><tt>Get or Set the state of relay 1. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>relay2</strong></dt>
<dd><tt>Get or Set the state of relay 2. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>relay3</strong></dt>
<dd><tt>Get or Set the state of relay 3. A value of False means 'off' and a value of True means 'on'.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>retain_data_in</strong></dt>
<dd><tt>From RetainDataIn return a list of 32 int's, each list element has a value between 0 and 255 (byte value).<br>
If the Retain functions was enabled, this list will contain the data previously stored in the microcontroller's<br>
flash memory. The values will remain there even if the Retain Enable flag is not set.<br>
<br>
:return: list[int]</tt></dd>
</dl>
<dl><dt><strong>retain_data_out</strong></dt>
<dd><tt>From RetainDataOut return a list of 32 int's, each list element has a value between 0 and 255 (byte value).<br>
<br>
:return: list[int]</tt></dd>
</dl>
<dl><dt><strong>servo0</strong></dt>
<dd><tt>Get or Set the value for PWM 0 channel A in Servo Mode. Possible values are 0 to 16000.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>servo1</strong></dt>
<dd><tt>Get or Set the value for PWM 0 channel B in Servo Mode. Possible values are 0 to 16000.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>servo2</strong></dt>
<dd><tt>Get or Set the value for PWM 1 channel A in Servo Mode. Possible values are 0 to 125.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>servo3</strong></dt>
<dd><tt>Get or Set the value for PWM 1 channel B in Servo Mode. Possible values are 0 to 125.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>__abstractmethods__</strong> = frozenset([])</dl>
<hr>
Methods inherited from <a href="pixtendv2core.html#PiXtendV2Core">pixtendv2core.PiXtendV2Core</a>:<br>
<dl><dt><a name="PiXtendV2S-__del__"><strong>__del__</strong></a>(self)</dt><dd><tt>Destructor of the Pixtend V2 class. Delete objects.</tt></dd></dl>
<dl><dt><a name="PiXtendV2S-set_dac_output"><strong>set_dac_output</strong></a>(self, dac_channel<font color="#909090">=0</font>, value<font color="#909090">=0</font>)</dt><dd><tt>Set the analog output value for the chosen DAC. The value 0 or constant DAC_A selects DAC A which is<br>
"Analog Out 0" and the value 1 or constant DAC_B selects DAC B which is "Analog Out 1".<br>
Example:<br>
Selecting and setting DAC A:<br>
p.set_dac_output (p.DAC_A, 512)<br>
<br>
Selecting and setting DAC B:<br>
p.set_dac_output (p.DAC_B, 256)<br>
<br>
:param int dac_channel: Number of the DAC to set the new value to<br>
:param int value: Output value for the chosen DAC.<br>
:raises ValueError: If value is smaller then 0 or larger then 1023</tt></dd></dl>
<hr>
Static methods inherited from <a href="pixtendv2core.html#PiXtendV2Core">pixtendv2core.PiXtendV2Core</a>:<br>
<dl><dt><a name="PiXtendV2S-clear_bit"><strong>clear_bit</strong></a>(int_type, offset)</dt><dd><tt><a href="#PiXtendV2S-clear_bit">clear_bit</a>() returns an integer with the bit at 'offset' cleared, set to 0.<br>
<br>
:param int int_type: Integer value in which to clear one bit<br>
:param int offset: Offset value which bit to clear<br>
:return: Integer with bit cleared a 'offset'<br>
:rtype: int</tt></dd></dl>
<dl><dt><a name="PiXtendV2S-set_bit"><strong>set_bit</strong></a>(int_type, offset)</dt><dd><tt><a href="#PiXtendV2S-set_bit">set_bit</a>() returns an integer with the bit at 'offset' set to 1.<br>
<br>
:param int int_type: Integer value in which to set one bit<br>
:param int offset: Offset value which bit to set<br>
:return: Integer with bit set at 'offset'<br>
:rtype: int</tt></dd></dl>
<dl><dt><a name="PiXtendV2S-test_bit"><strong>test_bit</strong></a>(int_type, offset)</dt><dd><tt><a href="#PiXtendV2S-test_bit">test_bit</a>() returns 1, if the bit at 'offset' is one else 0 if the bit is not set.<br>
<br>
:param int int_type: Integer value to test<br>
:param int offset: Offset value which bit to test<br>
:return: Integer based value of 0 if bit at 'offset' is not set or 1 if bit is set<br>
:rtype: int</tt></dd></dl>
<dl><dt><a name="PiXtendV2S-toggle_bit"><strong>toggle_bit</strong></a>(int_type, offset)</dt><dd><tt><a href="#PiXtendV2S-toggle_bit">toggle_bit</a>() returns an integer with the bit at 'offset' inverted, 0 -> 1 and 1 -> 0.<br>
<br>
:param int int_type: Integer value to toggle one bit within<br>
:param int offset: Offset value which bit to toggle<br>
:return: integer with bit toggled at 'offset'<br>
:rtype: int</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="pixtendv2core.html#PiXtendV2Core">pixtendv2core.PiXtendV2Core</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<dl><dt><strong>analog_out0</strong></dt>
<dd><tt>Get or Set the value of the Digital Analog Converter (DAC) for Analog Output 0.<br>
This function wraps the 'set_dac_output' function, this way only one value has<br>
to be provided, the DAC selection is automatic.<br>
Value range 0..1023 for 0V to 10V.<br>
<br>
Example:<br>
p.analog_out0 = 512<br>
myvalue = p.analog_out0<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>analog_out1</strong></dt>
<dd><tt>Get or Set the value of the Digital Analog Converter (DAC) for Analog Output 1.<br>
This function wraps the 'set_dac_output' function, this way only one value has<br>
to be provided, the DAC selection is automatic.<br>
Value range 0..1023 for 0V to 10V.<br>
<br>
Example:<br>
p.analog_out1 = 255 <br>
myvalue = p.analog_out1<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>crc_header_in_error</strong></dt>
<dd><tt>Get the error state of the CRC check performed on the SPI data header. If the CRC comparision is wrong<br>
the value will be True, if the header of the SPI data is correct, the value will be False.<br>
<br>
:return: Current value, False means no error, True means the header is not correct, error<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>crc_header_in_error_counter</strong></dt>
<dd><tt>Get the error counter of the CRC check performed on the incoming SPI data header.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>firmware</strong></dt>
<dd><tt>Get the microcontroller's firmware version.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>gpio0</strong></dt>
<dd><tt>Get or Set the state of GPIO 0. The value False means 'off' and a value of True means 'on'.<br>
<br>
Example:<br>
p.gpio0 = p.ON # Turns the GPIO on<br>
p.gpio0 = p.OFF # Turns the GPIO off<br>
or use<br>
p.gpio0 = True # Turns the GPIO on<br>
p.gpio0 = False # Turns the GPIO off<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>gpio0_ctrl</strong></dt>
<dd><tt>Get or Set the configuration of GPIO 0. Possible values are 0 (Input), 1 (Output), 2 (DHT11) or 3 (DHT22).<br>
<br>
:return: Current configuration<br>
:rtype: int<br>
:raises ValueError: If the passed value is not 0, 1, 2 or 3</tt></dd>
</dl>
<dl><dt><strong>gpio1</strong></dt>
<dd><tt>Get or Set the state of GPIO 1. The value False means 'off' and a value of True means 'on'.<br>
<br>
Example:<br>
p.gpio1 = p.ON # Turns the GPIO on<br>
p.gpio1 = p.OFF # Turns the GPIO off<br>
or use<br>
p.gpio1 = True # Turns the GPIO on<br>
p.gpio1 = False # Turns the GPIO off<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>gpio1_ctrl</strong></dt>
<dd><tt>Get or Set the configuration of GPIO 1. Possible values are 0 (Input), 1 (Output), 2 (DHT11) or 3 (DHT22).<br>
<br>
:return: Current configuration<br>
:rtype: int<br>
:raises ValueError: If the passed value is not 0, 1, 2 or 3</tt></dd>
</dl>
<dl><dt><strong>gpio2</strong></dt>
<dd><tt>Get or Set the state of GPIO 2. The value False means 'off' and a value of True means 'on'.<br>
<br>
Example:<br>
p.gpio2 = p.ON # Turns the GPIO on<br>
p.gpio2 = p.OFF # Turns the GPIO off<br>
or use<br>
p.gpio2 = True # Turns the GPIO on<br>
p.gpio2 = False # Turns the GPIO off<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>gpio2_ctrl</strong></dt>
<dd><tt>Get or Set the configuration of GPIO 2. Possible values are 0 (Input), 1 (Output), 2 (DHT11) or 3 (DHT22).<br>
<br>
:return: Current configuration<br>
:rtype: int<br>
:raises ValueError: If the passed value is not 0, 1, 2 or 3</tt></dd>
</dl>
<dl><dt><strong>gpio3</strong></dt>
<dd><tt>Get or Set the state of GPIO 3. The value False means 'off' and a value of True means 'on'.<br>
<br>
Example:<br>
p.gpio3 = p.ON # Turns the GPIO on<br>
p.gpio3 = p.OFF # Turns the GPIO off<br>
or use<br>
p.gpio3 = True # Turns the GPIO on<br>
p.gpio3 = False # Turns the GPIO off<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>gpio3_ctrl</strong></dt>
<dd><tt>Get or Set the configuration of GPIO 3. Possible values are 0 (Input), 1 (Output), 2 (DHT11) or 3 (DHT22).<br>
<br>
:return: Current configuration<br>
:rtype: int<br>
:raises ValueError: If the passed value is not 0, 1, 2 or 3</tt></dd>
</dl>
<dl><dt><strong>gpio_pullups_enable</strong></dt>
<dd><tt>Enable or Disable the GPIO 0-3 pullups if the GPIOs are configured as outputs and the pullups are needed.<br>
Setting this property to True enables the pullups, if it is set to False the pullups remain off.<br>
<br>
:return: Current value<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>hardware</strong></dt>
<dd><tt>Get the PiXtend V2 hardware revision.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>hum_input0_raw</strong></dt>
<dd><tt>Get the humidity raw value from humidity input 0.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>hum_input1_raw</strong></dt>
<dd><tt>Get the humidity raw value from humidity input 1.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>hum_input2_raw</strong></dt>
<dd><tt>Get the humidity raw value from humidity input 2.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>hum_input3_raw</strong></dt>
<dd><tt>Get the humidity raw value from humidity input 3.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>humid0</strong></dt>
<dd><tt>Get the converted humidity value from humidity input 0 if a DHT11/DHT22 sensor is physically attached.<br>
<br>
:return: Current value<br>
:rtype: float</tt></dd>
</dl>
<dl><dt><strong>humid1</strong></dt>
<dd><tt>Get the converted humidity value from humidity input 1 if a DHT11/DHT22 sensor is physically attached.<br>
<br>
:return: Current value<br>
:rtype: float</tt></dd>
</dl>
<dl><dt><strong>humid2</strong></dt>
<dd><tt>Get the converted humidity value from humidity input 2 if a DHT11/DHT22 sensor is physically attached.<br>
<br>
:return: Current value<br>
:rtype: float</tt></dd>
</dl>
<dl><dt><strong>humid3</strong></dt>
<dd><tt>Get the converted humidity value from humidity input 3 if a DHT11/DHT22 sensor is physically attached.<br>
<br>
:return: Current value<br>
:rtype: float</tt></dd>
</dl>
<dl><dt><strong>model_in</strong></dt>
<dd><tt>Get the PiXtend V2 model information from the microcontroller.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>model_in_error</strong></dt>
<dd><tt>Get the result of the comparison between the configured model, supplied by the child class through the init<br>
function (constructor) when the object is created, and the reported model by the microcontroller.<br>
If the configured model and the reported model match, the value will be False,<br>
if they don't match, the value will be True and signifies an error.<br>
<br>
:return: Current value, False means no error, True means the reported model does not match<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>retain_copy</strong></dt>
<dd><tt>Get or Set the microcontroller's Retain memory option to copy incoming data to the outgoing data<br>
stream. This way the data which will be stored on the microcontroller, in the event of a sudden power loss,<br>
can be verified that the data really reaches the microcontroller and that values are correct. This option is<br>
mainly intended for debugging, but can be used by anyone.<br>
<br>
:return: Current value<br>
:rtype: bool<br>
:raises ValueError: If the passed value is not True or False</tt></dd>
</dl>
<dl><dt><strong>retain_enable</strong></dt>
<dd><tt>Get or Set the microcontroller's Retain memory option to enabled. With this option active a specified amount of<br>
data will be stored in the microcontroller's flash memory in the event of a sudden power loss. The exact amount<br>
of int's/bytes which a PiXtend V2 board can store can be found in the SPI protocol specifications.<br>
<br>
:return: Current value<br>
:rtype: bool<br>
:raises ValueError: If the passed value is not True or False</tt></dd>
</dl>
<dl><dt><strong>save_state</strong></dt>
<dd><tt>Get or Set the microcontroller's SaveState bit in case the computer has to shutdown or needs to reboot.<br>
Settings this property to True will halt the microcontroller and a reset is needed in order to start any<br>
communication again.<br>
<br>
:return: Current value<br>
:rtype: bool<br>
:raises ValueError: If the passed value is not True or False</tt></dd>
</dl>
<dl><dt><strong>state_led_off</strong></dt>
<dd><tt>Get or Set if the State LED (L1) on the PiXtend V2 board is on or off.<br>
True turns the LED off and False leave the State LED (L1) on.<br>
<br>
:return: Current value<br>
:rtype: bool<br>
:raises ValueError: If the passed value is not True or False</tt></dd>
</dl>
<dl><dt><strong>temp0</strong></dt>
<dd><tt>Get the converted temperature value from temperature input 0 from a DHT11 or DHT22 sensor.<br>
<br>
:return: Current value<br>
:rtype: float</tt></dd>
</dl>
<dl><dt><strong>temp1</strong></dt>
<dd><tt>Get the converted temperature value from temperature input 1 from a DHT11 or DHT22 sensor.<br>
<br>
:return: Current value<br>
:rtype: float</tt></dd>
</dl>
<dl><dt><strong>temp2</strong></dt>
<dd><tt>Get the converted temperature value from temperature input 2 from a DHT11 or DHT22 sensor.<br>
<br>
:return: Current value<br>
:rtype: float</tt></dd>
</dl>
<dl><dt><strong>temp3</strong></dt>
<dd><tt>Get the converted temperature value from temperature input 3 from a DHT11 or DHT22 sensor.<br>
<br>
:return: Current value<br>
:rtype: float</tt></dd>
</dl>
<dl><dt><strong>temp_input0_raw</strong></dt>
<dd><tt>Get the temperature raw value from temperature input 0.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>temp_input1_raw</strong></dt>
<dd><tt>Get the temperature raw value from temperature input 1.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>temp_input2_raw</strong></dt>
<dd><tt>Get the temperature raw value from temperature input 2.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>temp_input3_raw</strong></dt>
<dd><tt>Get the temperature raw value from temperature input 3.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>uc_state</strong></dt>
<dd><tt>The UCState byte from the microcontroller contains information of the following internal states:<br>
Bit 0: Run - The microcontroller is up and running, this is just a helper bit<br>
Bit 4: Error0 - Bit 0 of the 4 bit error number from the microcontroller. Together with the next 3<br>
Bit 5: Error1 - bits a 4 bit number can be formed which results in an error number which is<br>
Bit 6: Error2 - listed in the SPI protocol specification or the software manual.<br>
Bit 7: Error3<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>uc_warnings</strong></dt>
<dd><tt>The UCWarnings byte from the microcontroller contains information of the following internal errors:<br>
Bit 1: RetainCRCError - Signals a CRC error in the retain data in the microcontroller<br>
Bit 2: RetainVoltageError - The supply voltage is below 19 volts, the Retain memory option cannot be used.<br>
<br>
:return: Current value<br>
:rtype: int</tt></dd>
</dl>
<dl><dt><strong>use_fahrenheit</strong></dt>
<dd><tt>Get or Set if the conversion of the temperature raw value should be done in Fahrenheit.<br>
Default is 'False', meaning by getting the temperature from temp0 to temp3<br>
the value will be in degrees Celsius, if set to 'True' the values will be in Fahrenheit.<br>
<br>
:returns: Bool value, 'False' for Celsius and 'True' for Fahrenheit<br>
:rtype: bool</tt></dd>
</dl>
<dl><dt><strong>watchdog</strong></dt>
<dd><tt>Get or Set the PiXtend V2 watchdog option. WDT_OFF or 0 ms means the watchdog is disabled. One of the<br>
following time values 16 ms, 32 ms, 64 ms, 125 ms, 250 ms, 500 ms, 1000 ms (1s), 2000 ms (2s), 4000 ms (4s)<br>
and 8000 ms (8s) turns the watchdog function in the microcontroller on. If no SPI communication occurs within<br>
this time frame, the microcontroller will stop working and goes into save state. Only a reset or power cycle<br>
will bring it back to life once it has entered this stage.<br>
<br>
:return: Current value<br>
:rtype: int<br>
:raises ValueError: If the passed value is not one of the following: 16, 32, 64, 125, 250, 500, 1000,<br>
2000, 4000 or 8000</tt></dd>
</dl>
<hr>
Data and other attributes inherited from <a href="pixtendv2core.html#PiXtendV2Core">pixtendv2core.PiXtendV2Core</a>:<br>
<dl><dt><strong>BIT_0</strong> = 0</dl>
<dl><dt><strong>BIT_1</strong> = 1</dl>
<dl><dt><strong>BIT_10</strong> = 10</dl>
<dl><dt><strong>BIT_11</strong> = 11</dl>
<dl><dt><strong>BIT_12</strong> = 12</dl>
<dl><dt><strong>BIT_13</strong> = 13</dl>
<dl><dt><strong>BIT_14</strong> = 14</dl>
<dl><dt><strong>BIT_15</strong> = 15</dl>
<dl><dt><strong>BIT_2</strong> = 2</dl>
<dl><dt><strong>BIT_3</strong> = 3</dl>
<dl><dt><strong>BIT_4</strong> = 4</dl>
<dl><dt><strong>BIT_5</strong> = 5</dl>
<dl><dt><strong>BIT_6</strong> = 6</dl>
<dl><dt><strong>BIT_7</strong> = 7</dl>
<dl><dt><strong>BIT_8</strong> = 8</dl>
<dl><dt><strong>BIT_9</strong> = 9</dl>
<dl><dt><strong>COM_INTERVAL_DEFAULT</strong> = 0.03</dl>
<dl><dt><strong>COM_INTERVAL_DHT</strong> = 0.03</dl>
<dl><dt><strong>COM_INTERVAL_MINIMUM</strong> = 0.01</dl>
<dl><dt><strong>DAC_A</strong> = 0</dl>
<dl><dt><strong>DAC_B</strong> = 1</dl>
<dl><dt><strong>DHT11</strong> = 0</dl>
<dl><dt><strong>DHT22</strong> = 1</dl>
<dl><dt><strong>GPIO_DHT11</strong> = 2</dl>
<dl><dt><strong>GPIO_DHT22</strong> = 3</dl>
<dl><dt><strong>GPIO_INPUT</strong> = 0</dl>
<dl><dt><strong>GPIO_OUTPUT</strong> = 1</dl>
<dl><dt><strong>JUMPER_10V</strong> = 1</dl>
<dl><dt><strong>JUMPER_5V</strong> = 0</dl>
<dl><dt><strong>MC_RESET_PIN</strong> = 23</dl>
<dl><dt><strong>OFF</strong> = False</dl>
<dl><dt><strong>ON</strong> = True</dl>
<dl><dt><strong>PIXTENDV2L_MODEL</strong> = 76</dl>
<dl><dt><strong>PIXTENDV2S_MODEL</strong> = 83</dl>
<dl><dt><strong>PWM_MODE</strong> = 1</dl>
<dl><dt><strong>RS232</strong> = 0</dl>
<dl><dt><strong>RS485</strong> = 0</dl>
<dl><dt><strong>SERVO_MODE</strong> = 0</dl>
<dl><dt><strong>SPI_ENABLE_PIN</strong> = 24</dl>
<dl><dt><strong>SPI_NOT_FOUND</strong> = -1</dl>
<dl><dt><strong>SPI_SPEED</strong> = 700000</dl>
<dl><dt><strong>WDT_125MS</strong> = 125</dl>
<dl><dt><strong>WDT_16MS</strong> = 16</dl>
<dl><dt><strong>WDT_1S</strong> = 1000</dl>
<dl><dt><strong>WDT_250MS</strong> = 250</dl>
<dl><dt><strong>WDT_2S</strong> = 2000</dl>
<dl><dt><strong>WDT_32MS</strong> = 32</dl>
<dl><dt><strong>WDT_4S</strong> = 4000</dl>
<dl><dt><strong>WDT_500MS</strong> = 500</dl>
<dl><dt><strong>WDT_64MS</strong> = 64</dl>
<dl><dt><strong>WDT_8S</strong> = 8000</dl>
<dl><dt><strong>WDT_OFF</strong> = 0</dl>
<dl><dt><strong>__metaclass__</strong> = <class 'abc.ABCMeta'><dd><tt>Metaclass for defining Abstract Base Classes (ABCs).<br>
<br>
Use this metaclass to create an ABC. An ABC can be subclassed<br>
directly, and then acts as a mix-in class. You can also register<br>
unrelated concrete classes (even built-in classes) and unrelated<br>
ABCs as 'virtual subclasses' -- these and their descendants will<br>
be considered subclasses of the registering ABC by the built-in<br>
issubclass() function, but the registering ABC won't show up in<br>
their MRO (Method Resolution Order) nor will method<br>
implementations defined by the registering ABC be callable (not<br>
even via super()).</tt></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>__author__</strong> = 'Robin Turner'<br>
<strong>__version__</strong> = '0.1.4'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td>
<td width="100%">Robin Turner</td></tr></table>
</body></html>
|