| |
- __builtin__.object
-
- Pixtend
- _ctypes.Structure(_ctypes._CData)
-
- AnalogValueBytes
- FlagsBits
- FlagsBits16
- UcVersionBytes
- _ctypes.Union(_ctypes._CData)
-
- AnalogValue
- Flags
- Flags16
class Flags(_ctypes.Union) |
|
A class using the ctypes Union to combine the 8 bits from the FlagsBits class (field) and one byte (type c_uint8)
into one memory space overlaying each other. This way each single bit within a byte can be accessed directly by
its individual name. Using the asBytes field element allows to set all 8 bits at once.
:type b : FlagsBits
:type asByte : c_uint8 |
|
- Method resolution order:
- Flags
- _ctypes.Union
- _ctypes._CData
- __builtin__.object
Methods defined here:
- __init__(self, *args, **kwargs)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- asByte
- Structure/Union member
- b
- Structure/Union member
Data and other attributes inherited from _ctypes.Union:
- __new__ = <built-in method __new__ of _ctypes.UnionType object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from _ctypes._CData:
- __ctypes_from_outparam__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- __setstate__(...)
|
class Flags16(_ctypes.Union) |
|
Union from ctypes to combine a 16 bits structure with a C_UINT16 type to make a two byte memory space
for the SPI data which will be sent to the DAC via SPI Master 0 and Chip Select 1.
:type bits : FlagsBits16
:type asUint16 : c_uint16 |
|
- Method resolution order:
- Flags16
- _ctypes.Union
- _ctypes._CData
- __builtin__.object
Methods defined here:
- __init__(self, *args, **kwargs)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- asUint16
- Structure/Union member
- bits
- Structure/Union member
Data and other attributes inherited from _ctypes.Union:
- __new__ = <built-in method __new__ of _ctypes.UnionType object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from _ctypes._CData:
- __ctypes_from_outparam__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- __setstate__(...)
|
class FlagsBits(_ctypes.Structure) |
|
This class has a field with named bits within one single byte, they will be used later to control/change
individual bits in one single byte.
:type bit0 : c_uint8
:type bit1 : c_uint8
:type bit2 : c_uint8
:type bit3 : c_uint8
:type bit4 : c_uint8
:type bit5 : c_uint8
:type bit6 : c_uint8
:type bit7 : c_uint8 |
|
- Method resolution order:
- FlagsBits
- _ctypes.Structure
- _ctypes._CData
- __builtin__.object
Methods defined here:
- __init__(self, *args, **kwargs)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bit0
- Structure/Union member
- bit1
- Structure/Union member
- bit2
- Structure/Union member
- bit3
- Structure/Union member
- bit4
- Structure/Union member
- bit5
- Structure/Union member
- bit6
- Structure/Union member
- bit7
- Structure/Union member
Data and other attributes inherited from _ctypes.Structure:
- __new__ = <built-in method __new__ of _ctypes.PyCStructType object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from _ctypes._CData:
- __ctypes_from_outparam__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- __setstate__(...)
|
class FlagsBits16(_ctypes.Structure) |
|
This class has a field with named bits within one 2 bytes structure (c_uint16 type), they will be used later
to control/change individual bits in two bytes.
:type bit0 : ctypes.c_ushort
:type bit1 : ctypes.c_ushort
:type bit2 : ctypes.c_ushort
:type bit3 : ctypes.c_ushort
:type bit4 : ctypes.c_ushort
:type bit5 : ctypes.c_ushort
:type bit6 : ctypes.c_ushort
:type bit7 : ctypes.c_ushort
:type bit8 : ctypes.c_ushort
:type bit9 : ctypes.c_ushort
:type bit10 : ctypes.c_ushort
:type bit11 : ctypes.c_ushort
:type bit12 : ctypes.c_ushort
:type bit13 : ctypes.c_ushort
:type bit14 : ctypes.c_ushort
:type bit15 : ctypes.c_ushort |
|
- Method resolution order:
- FlagsBits16
- _ctypes.Structure
- _ctypes._CData
- __builtin__.object
Methods defined here:
- __init__(self, *args, **kwargs)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bit0
- Structure/Union member
- bit1
- Structure/Union member
- bit10
- Structure/Union member
- bit11
- Structure/Union member
- bit12
- Structure/Union member
- bit13
- Structure/Union member
- bit14
- Structure/Union member
- bit15
- Structure/Union member
- bit2
- Structure/Union member
- bit3
- Structure/Union member
- bit4
- Structure/Union member
- bit5
- Structure/Union member
- bit6
- Structure/Union member
- bit7
- Structure/Union member
- bit8
- Structure/Union member
- bit9
- Structure/Union member
Data and other attributes inherited from _ctypes.Structure:
- __new__ = <built-in method __new__ of _ctypes.PyCStructType object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from _ctypes._CData:
- __ctypes_from_outparam__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- __setstate__(...)
|
class Pixtend(__builtin__.object) |
|
The PiXtend class derived from Python object can be used to control and manipulate states of inputs and outputs
(analog and digital) in the microcontroller on the PiXtend board via the Raspberry Pi's SPI bus.
Import the pixtend file: from pixtendlib import Pixtend
Creating an instance: p = Pixtend()
Activate the SPI bus: p.open()
Read relay 0 state: mystate = p.relay0
Set relay 1 to on: p.relay1 = p.ON |
|
Methods defined here:
- __del__(self)
- Destructor of the Pixtend class.
Delete all objects, clean up GPIOs and close the SPI bus when the Pixtend instance is destroyed.
- __init__(self)
- Constructor of the Pixtend class.
Create all objects and variables needed, set defaults for the RPi SPI bus, the GPIOs and activate
the BCM GPIO layout on the Raspberry Pi. The GPIO 24 needs to be an output and set to 'on' to enable
the communication with the microcontroller on the PiXtend board via SPI Master 0 and Chip Select 0.
- auto_mode(self)
- Method for the auto(matic) mode data transfer. The settings and values of all applicable
properties like outputs, GPIO and PWM configuration for the PiXtend board are sent to the microcontroller
in one block and states and values of all digital and analog inputs and outputs are received as response.
This is the most efficient way to work with the microcontroller on the PiXtend board.
In the beginning the auto_mode method should be called until the return value is 0 and the microcontroller's
uc_state is 1, meaning the communication is working and the microcontroller has entered the 'Run' state.
After that the auto_mode method does not need to be called on a regular basis, but when new values are needed
or outputs have to be turned on or off.
Example:
if p.auto_mode() == 0 and p.uc_status == 1:
p.relay0 = p.ON
:return: 0 means communication is ok and running, -1 means crc error and/or a problem with the received data
:rtype: int
- close(self)
- Close SPI device, clean up Raspberry Pi GPIO device and set all variables to None.
- open(self, spi_channel=0, spi_cs=0, spi_speed=100000)
- Open SPI Master 0 with Chip Select 0 on the Raspberry Pi to start the communication with the microcontroller
on the PiXtend board.
:param int spi_channel: Number of the SPI master, default is 0, optional parameter
:param int spi_cs: Chip Select (CS) for the SPI master, default is 0, optional parameter
:param int spi_speed: SPI frequency, default 100 kHz, optional parameter
:raises IOError: If SPI bus has already been opened
- open_dac(self, spi_channel=0, spi_cs=1, spi_speed=100000)
- Open SPI Master 0 with Chip Select 1 on the Raspberry Pi to start the communication
with the DAC on the PiXtend board.
:param int spi_channel: Number of the SPI master, default is 0, optional parameter
:param int spi_cs: Chip Select (CS) for the SPI master for the DAC, default is 1, optional parameter
:param int spi_speed: SPI frequency, default 100 kHz, optional parameter
:raises IOError: If SPI bus has already been opened
- pwm_ctrl_configure(self)
- Configures the PWM control of the microcontroller on the PiXtend board. The data transferred includes
all PWM settings like the Mode, OD setting and the Clock Select for the PWMs as well as the frequency.
- set_dac_output(self, value)
- Set the analog output value for the chosen DAC. The active DAC can be chosen with the property 'dac_selection'.
The value 0 or constant DAC_A selects DAC A and the value 1 or constant DAC_B selects DAC B.
Example:
Selecting and setting DAC A:
p.dac_selection = p.DAC_A
p.set_dac_output (512)
Selecting and setting DAC B:
p.dac_selection = p.DAC_B
p.set_dac_output (256)
:param int value: Output value for the chosen DAC.
:raises ValueError: If value is smaller then 0 or larger then 1023
Static methods defined here:
- update_rtc()
- Update the hardware real time clock (RTC) with the current Linux system time.
The system time is updated by the NTP service, which is active by default, if it is able to connect to
the Internet and get the current time and date.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- analog_input0
- Get analog input 0 value as float in Volts. The returned value is based on the 10 volts jumper setting.
- analog_input0_10volts_jumper
- Get or Set the 10 volts jumper setting, depending if the jumper was physically set on the PiXtend board.
The library needs to know this setting to perform correct calculations of the raw analog
values of the analog inputs when they are converted their final float value. Applies only to AI0 and AI1
as these 2 inputs measure voltage.
- analog_input0_nos
- Get or Set the Number of Samples (NoS) the analog input 0 should take from the incoming analog signal.
Possible NoS values are 1, 5, 10 (default) and 50. If something is wrong -1 is returned.
:return: Decimal value of the Number of Samples (NoS)
:rtype: int
:raises ValueError: If passed value is not 1, 5, 10, 50
- analog_input0_raw
- Get the raw value of analog input 0.
- analog_input1
- Get analog input 1 value as float in Volts. The returned value is based on the 10 volts jumper setting.
- analog_input1_10volts_jumper
- Get or Set the 10 volts jumper setting, depending if the jumper was physically set on the PiXtend board.
The library needs to know this setting to perform correct calculations of the raw analog
values of the analog inputs when they are converted their final float value. Applies only to AI0 and AI1
as these 2 inputs measure voltage.
- analog_input1_nos
- Get or Set the Number of Samples (NoS) the analog input 1 should take from the incoming analog signal.
Possible NoS values are 1, 5, 10 (default) and 50. If something is wrong -1 is returned.
:return: Decimal value of the Number of Samples (NoS)
:rtype: int
:raises ValueError: If passed value is not 1, 5, 10, 50
- analog_input1_raw
- Get the raw value of analog input 1.
- analog_input2
- Get analog input 2 value as float in Ampere (mA).
- analog_input2_nos
- Get or Set the Number of Samples (NoS) the analog input 2 should take from the incoming analog signal.
Possible NoS values are 1, 5, 10 (default) and 50. If something is wrong -1 is returned.
:return: Decimal value of the Number of Samples (NoS)
:rtype: int
:raises ValueError: If passed value is not 1, 5, 10, 50
- analog_input2_raw
- Get the raw value of analog input 2.
- analog_input3
- Get analog input 3 value as float in Ampere (mA).
- analog_input3_nos
- Get or Set the Number of Samples (NoS) the analog input 3 should take from the incoming analog signal.
Possible NoS values are 1, 5, 10 (default) and 50. If something is wrong -1 is returned.
:return: Decimal value of the Number of Samples (NoS)
:rtype: int
:raises ValueError: If passed value is not 1, 5, 10, 50
- analog_input3_raw
- Get the raw value of analog input 3.
- analog_input_nos_freq
- Get or Set the Clock Select of the A/D converter of the microcontroller on the PiXtend board.
Possible float values are 0.125, 0.250, 0.500, 1.0, 2.0, 4.0 and 8.0. The unit is Mhz.
:return: Float value of the currently set A/D converter frequency
:rtype: float
- dac_selection
- Get or Set the DAC selection. There are 2 DAC's on the PiXtend board. DAC A = 0 and DAC B = 1.
:return: selected DAC, 0 = DAC A and 1 = DAC B
:rtype: int
- dht0
- Get or Set the 1-Wire setting for GPIO 0. Default is 'off' (0), if set to 'on' (1) means 1-wire sensors
like DHT11, DHT22 and AM2302 can be used at this GPIO. The direction bit (input/output) will be ignored if
this property is set to 'on' (1).
- dht1
- Get or Set the 1-Wire setting for GPIO 1. Default is 'off' (0), if set to 'on' (1) means 1-wire sensors
like DHT11, DHT22 and AM2302 can be used at this GPIO. The direction bit (input/output) will be ignored if
this property is set to 'on' (1).
- dht2
- Get or Set the 1-Wire setting for GPIO 2. Default is 'off' (0), if set to 'on' (1) means 1-wire sensors
like DHT11, DHT22 and AM2302 can be used at this GPIO. The direction bit (input/output) will be ignored if
this property is set to 'on' (1).
- dht3
- Get or Set the 1-Wire setting for GPIO 3. Default is 'off' (0), if set to 'on' (1) means 1-wire sensors
like DHT11, DHT22 and AM2302 can be used at this GPIO. The direction bit (input/output) will be ignored if
this property is set to 'on' (1).
- di0
- Get the state of digital input 0. A value of 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_input0 <--> di0
- di1
- Get the state of digital input 1. A value of 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_input1 <--> di1
- di2
- Get the state of digital input 2. A value of 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_input2 <--> di2
- di3
- Get the state of digital input 3. A value of 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_input3 <--> di3
- di4
- Get the state of digital input 4. A value of 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_input4 <--> di4
- di5
- Get the state of digital input 5. A value of 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_input5 <--> di5
- di6
- Get the state of digital input 6. A value of 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_input6 <--> di6
- di7
- Get the state of digital input 7. A value of 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_input7 <--> di7
- digital_input0
- Get the state of digital input 0. A value of 0 means 'off' and a value of 1 means 'on'.
- digital_input1
- Get the state of digital input 1. A value pf 0 means 'off' and a value of 1 means 'on'.
- digital_input2
- Get the state of digital input 2. A value of 0 means 'off' and a value of 1 means 'on'.
- digital_input3
- Get the state of digital input 3. A value of 0 means 'off' and a value of 1 means 'on'.
- digital_input4
- Get the state of digital input 4. A value of 0 means 'off' and a value of 1 means 'on'.
- digital_input5
- Get the state of digital input 5. A value of 0 means 'off' and a value of 1 means 'on'.
- digital_input6
- Get the state of digital input 6. A value of 0 means 'off' and a value of 1 means 'on'.
- digital_input7
- Get the state of digital input 7. A value of 0 means 'off' and a value of 1 means 'on'.
- digital_output0
- Get or Set the state of digital output 0. A value 0 means 'off' and a value of 1 means 'on'.
- digital_output1
- Get or Set the state of digital output 1. A value 0 means 'off' and a value of 1 means 'on'.
- digital_output2
- Get or Set the state of digital output 2. A value 0 means 'off' and a value of 1 means 'on'.
- digital_output3
- Get or Set the state of digital output 3. A value 0 means 'off' and a value of 1 means 'on'.
- digital_output4
- Get or Set the state of digital output 4. A value 0 means 'off' and a value of 1 means 'on'.
- digital_output5
- Get or Set the state of digital output 5. A value 0 means 'off' and a value of 1 means 'on'.
- do0
- Get or Set the state of digital output 0. A value 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_output0 <--> do0
- do1
- Get or Set the state of digital output 1. A value 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_output1 <--> do1
- do2
- Get or Set the state of digital output 2. A value 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_output2 <--> do2
- do3
- Get or Set the state of digital output 3. A value 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_output3 <--> do3
- do4
- Get or Set the state of digital output 4. A value 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_output4 <--> do4
- do5
- Get or Set the state of digital output 5. A value 0 means 'off' and a value of 1 means 'on'.
This property is just a shorter version in terms of wording: digital_output5 <--> do5
- gpio0
- Get or Set the state of GPIO 0. The value 0 means 'off' and a value of 1 means 'on'.
Example:
p.gpio0 = p.ON # Turns the GPIO on
p.gpio0 = p.OFF # Turns the GPIO off
or use
p.gpio0 = 1 # Turns the GPIO on
p.gpio0 = 0 # Turns the GPIO off
- gpio0_direction
- Get or Set the direction of GPIO 0, input or output is possible.
Example:
p.gpio0_direction = p.GPIO_INPUT
p.gpio0_direction = p.GPIO_OUTPUT
or
p.gpio0_direction = 0 # Input
p.gpio0_direction = 1 # Output
- gpio1
- Get or Set the state of GPIO 1. The value 0 means 'off' and a value of 1 means 'on'.
Example:
p.gpio1 = p.ON # Turns the GPIO on
p.gpio1 = p.OFF # Turns the GPIO off
or use
p.gpio1 = 1 # Turns the GPIO on
p.gpio1 = 0 # Turns the GPIO off
- gpio1_direction
- Get or Set the direction of GPIO 1, input or output is possible.
Example:
p.gpio1_direction = p.GPIO_INPUT
p.gpio1_direction = p.GPIO_OUTPUT
or
p.gpio1_direction = 0 # Input
p.gpio1_direction = 1 # Output
- gpio2
- Get or Set the state of GPIO 2. The value 0 means 'off' and a value of 1 means 'on'.
Example:
p.gpio2 = p.ON # Turns the GPIO on
p.gpio2 = p.OFF # Turns the GPIO off
or use
p.gpio2 = 1 # Turns the GPIO on
p.gpio2 = 0 # Turns the GPIO off
- gpio2_direction
- Get or Set the direction of GPIO 2, input or output is possible.
Example:
p.gpio2_direction = p.GPIO_INPUT
p.gpio2_direction = p.GPIO_OUTPUT
or
p.gpio2_direction = 0 # Input
p.gpio2_direction = 1 # Output
- gpio3
- Get or Set the state of GPIO 3. The value 0 means 'off' and a value of 1 means 'on'.
Example:
p.gpio3 = p.ON # Turns the GPIO on
p.gpio3 = p.OFF # Turns the GPIO off
or use
p.gpio3 = 1 # Turns the GPIO on
p.gpio3 = 0 # Turns the GPIO off
- gpio3_direction
- Get or Set the direction of GPIO 3, input or output is possible.
Example:
p.gpio3_direction = p.GPIO_INPUT
p.gpio3_direction = p.GPIO_OUTPUT
or
p.gpio3_direction = 0 # Input
p.gpio3_direction = 1 # Output
- h0_dht11
- Get the converted humidity value from humidity input 0 if a DHT11 sensor is physically attached.
- h0_dht22
- Get the converted humidity value from humidity input 0 if a DHT22 sensor is physically attached.
- h1_dht11
- Get the converted humidity value from humidity input 1 if a DHT11 sensor is physically attached.
- h1_dht22
- Get the converted humidity value from humidity input 1 if a DHT22 sensor is physically attached.
- h2_dht11
- Get the converted humidity value from humidity input 2 if a DHT11 sensor is physically attached.
- h2_dht22
- Get the converted humidity value from humidity input 2 if a DHT22 sensor is physically attached.
- h3_dht11
- Get the converted humidity value from humidity input 3 if a DHT11 sensor is physically attached.
- h3_dht22
- Get the converted humidity value from humidity input 3 if a DHT22 sensor is physically attached.
- hum_input0_raw
- Get the humidity raw value from humidity input 0.
- hum_input1_raw
- Get the humidity raw value from humidity input 1.
- hum_input2_raw
- Get the humidity raw value from humidity input 2.
- hum_input3_raw
- Get the humidity raw value from humidity input 3.
- pwm0
- Get or Set the PWM 0 duty cycle. This value has to correspond to the PWM freq/signal period configuration.
The allowed values for PWM 0 are 0 to 65000.
Example:
pwm_ctrl_cs0 = 1, pwm_ctrl_cs1 = 1, pwm_ctrl_cs2 = 0, pwm_ctrl_mode = 1 and pwm_ctrl_period = 5000
* If pwm0 is set to 2500 the duty cycle will be 50%
* If pwm0 > pwm_ctrl_period the PWM channel will be continuously logical 1
* If pwm0 = 0 the PWM channel will be continuously logical 0
- pwm1
- Get or Set the PWM 1 duty cycle. This value has to correspond to the PWM freq/signal period configuration.
The allowed values for PWM 1 are 0 to 65000.
Example:
pwm_ctrl_cs0 = 1, pwm_ctrl_cs1 = 1, pwm_ctrl_cs2 = 0, pwm_ctrl_mode = 1 and pwm_ctrl_period = 5000
* If pwm1 is set to 2500 the duty cycle will be 50%.
* If pwm1 > pwm_ctrl_period the PWM channel will be continuously logical 1
* If pwm1 = 0 the PWM channel will be continuously logical 0
- pwm_ctrl_cs0
- Get or Set the Clock Select bit 0 (CS0) for both PWMs. This setting will be ignored if PWMs are in servo mode.
A value of 1 means this CS is 'on' (selected) and 0 means 'off' (not selected).
- pwm_ctrl_cs1
- Get or Set the Clock Select bit 1 (CS1) for both PWMs. This setting will be ignored if PWMs are in servo mode.
A value of 1 means this CS is 'on' (selected) and 0 means 'off' (not selected).
- pwm_ctrl_cs2
- Get or Set the Clock Select bit 2 (CS2) for both PWMs. This setting will be ignored if PWMs are in servo mode.
A value of 1 means this CS is 'on' (selected) and 0 means 'off' (not selected).
- pwm_ctrl_mode
- Get or Set the PWM mode. A value of 0 means the PWMs are in servo mode, a value of 1 means both PWMs are
in PWM mode.
- pwm_ctrl_od0
- Get or Set the Over Drive (OD) value for PWM 0. A value of 0 means 'off' and 1 means 'on'.
- pwm_ctrl_od1
- Get or Set the Over Drive (OD) value for PWM 1. A value of 0 means 'off' and 1 means 'on'.
- pwm_ctrl_period
- Get or Set the frequency/signal period length of the PWMs. Values from 0 to 65000 are allowed.
Example:
pwm_ctrl_cs0 = 1, pwm_ctrl_cs1 = 1, pwm_ctrl_cs2 = 0, pwm_ctrl_mode = 1 and pwm_ctrl_period = 1000
PWM Period length = uMC Freq / Prescaler / PWM_CTRL1..2
PWM Period length = 16 MHz / 64 / 1000 = 250 Hz
- relay0
- Get or Set the state of relay 0. A value of 0 means 'off' and a value of 1 means 'on'.
- relay1
- Get or Set the state of relay 1. A value of 0 means 'off' and a value of 1 means 'on'.
- relay2
- Get or Set the state of relay 2. A value of 0 means 'off' and a value of 1 means 'on'.
- relay3
- Get or Set the state of relay 3. A value of 0 means 'off' and a value of 1 means 'on'.
- serial_mode
- Get or Set the serial mode of the PiXtend board. Use boolean values: False = RS232 and True = RS485
Example:
p.serial_mode = p.RS232 # or p.serial_mode = False
or
p.serial_mode = p.RS485 # or p.serial_mode = True
:return: Value of the serial mode
:rtype: bool
- servo0
- Get or Set the value for PWM 0 in servo mode. Possible values are 0 to 250.
- servo1
- Get or Set the value for PWM 1 in servo mode. Possible values are 0 to 250.
- t0_dht11
- Get the converted temperature value from temperature input 0 from a DHT11 sensor.
- t0_dht22
- Get the converted temperature value from temperature input 0 from a DHT22 sensor.
- t1_dht11
- Get the converted temperature value from temperature input 1 from a DHT11 sensor.
- t1_dht22
- Get the converted temperature value from temperature input 1 from a DHT22 sensor.
- t2_dht11
- Get the converted temperature value from temperature input 2 from a DHT11 sensor.
- t2_dht22
- Get the converted temperature value from temperature input 2 from a DHT22 sensor.
- t3_dht11
- Get the converted temperature value from temperature input 3 from a DHT11 sensor.
- t3_dht22
- Get the converted temperature value from temperature input 3 from a DHT22 sensor.
- temp_input0_raw
- Get the temperature raw value from temperature input 0.
- temp_input1_raw
- Get the temperature raw value from temperature input 1.
- temp_input2_raw
- Get the temperature raw value from temperature input 2.
- temp_input3_raw
- Get the temperature raw value from temperature input 3.
- uc_board_version
- Get the PiXtend board version.
Example:
A value of 13 means board version 1.3.x
:return: Board version of the PiXtend board
:rtype: c_uint8
- uc_control
- Get or Set the microcontroller's control register. If the automatic mode is off, setting
a new value will have immediate effect.
:return: Current value of the control byte in the microcontroller
:rtype: c_uint8
:raises ValueError: If the passed value is smaller then 0 or larger then 255
- uc_fw_version
- Get the microcontroller firmware version on the PiXtend board.
Example:
A value of 2 means firmware version 2.x is installed on the microcontroller
:return: Firmware version of the microcontroller on the PiXtend board
:rtype: c_uint8
- uc_status
- Get the microcontroller status byte.
:return: Status byte of the microcontroller on the PiXtend board
:rtype: c_uint8
- use_fahrenheit
- Get or Set if the conversion of the temperature raw value should be done in Fahrenheit.
Default is 'False', meaning by getting the temperature from t0_dht22 to t3_dht22 or from t0_dht11 to t3_dht11
the value will be in degrees Celsius, if set to 'True' the values will be in Fahrenheit.
:returns: Bool value, 'False' for Celsius and 'True' for Fahrenheit
:rtype: bool
Data and other attributes defined here:
- BIT_0 = 0
- BIT_1 = 1
- BIT_10 = 10
- BIT_11 = 11
- BIT_12 = 12
- BIT_13 = 13
- BIT_14 = 14
- BIT_15 = 15
- BIT_2 = 2
- BIT_3 = 3
- BIT_4 = 4
- BIT_5 = 5
- BIT_6 = 6
- BIT_7 = 7
- BIT_8 = 8
- BIT_9 = 9
- DAC_A = 0
- DAC_B = 1
- GPIO_INPUT = 0
- GPIO_OUTPUT = 1
- JUMPER_10V = 1
- JUMPER_5V = 0
- OFF = 0
- ON = 1
- PIXTEND_MAX_RELAYS = 4
- PIXTEND_MC_RESET_PIN = 23
- PIXTEND_SERIAL_PIN = 18
- PIXTEND_SPI_AUTO_MODE = 231
- PIXTEND_SPI_ENABLE_PIN = 24
- PIXTEND_SPI_GET_AIN0 = 3
- PIXTEND_SPI_GET_AIN1 = 4
- PIXTEND_SPI_GET_AIN2 = 5
- PIXTEND_SPI_GET_AIN3 = 6
- PIXTEND_SPI_GET_DIN = 2
- PIXTEND_SPI_GET_DOUT = 18
- PIXTEND_SPI_GET_GPIO = 9
- PIXTEND_SPI_GET_HUM0 = 14
- PIXTEND_SPI_GET_HUM1 = 15
- PIXTEND_SPI_GET_HUM2 = 16
- PIXTEND_SPI_GET_HUM3 = 17
- PIXTEND_SPI_GET_RELAY = 19
- PIXTEND_SPI_GET_TEMP0 = 10
- PIXTEND_SPI_GET_TEMP1 = 11
- PIXTEND_SPI_GET_TEMP2 = 12
- PIXTEND_SPI_GET_TEMP3 = 13
- PIXTEND_SPI_GET_UC_STAT = 138
- PIXTEND_SPI_GET_UC_VER = 137
- PIXTEND_SPI_HANDSHAKE = 170
- PIXTEND_SPI_NOT_FOUND = -1
- PIXTEND_SPI_NULL_BYTE = 0
- PIXTEND_SPI_SET_AI_CTRL = 135
- PIXTEND_SPI_SET_DOUT = 1
- PIXTEND_SPI_SET_GPIO = 8
- PIXTEND_SPI_SET_GPIO_CTRL = 133
- PIXTEND_SPI_SET_PWM0 = 130
- PIXTEND_SPI_SET_PWM1 = 131
- PIXTEND_SPI_SET_PWM_CTRL = 132
- PIXTEND_SPI_SET_RASPSTAT = 136
- PIXTEND_SPI_SET_RELAY = 7
- PIXTEND_SPI_SET_SERVO0 = 128
- PIXTEND_SPI_SET_SERVO1 = 129
- PIXTEND_SPI_SET_UC_CTRL = 134
- PWM_MODE = 1
- RS232 = False
- RS485 = True
- SERVO_MODE = 0
|
class UcVersionBytes(_ctypes.Structure) |
|
This is a structure for two (2) single bytes to store the firmware version and the board version reported by the
microcontroller on the PiXtend board.
Example:
UC_VERSIONH = 13 means board version is 1.3.x
UC_VERSIONL = 2 means firmware version 2.x is installed on the microcontroller
:type UC_VERSIONL : c_uint8
:type UC_VERSIONH : c_uint8 |
|
- Method resolution order:
- UcVersionBytes
- _ctypes.Structure
- _ctypes._CData
- __builtin__.object
Methods defined here:
- __init__(self, *args, **kwargs)
Data descriptors defined here:
- UC_VERSIONH
- Structure/Union member
- UC_VERSIONL
- Structure/Union member
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _ctypes.Structure:
- __new__ = <built-in method __new__ of _ctypes.PyCStructType object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from _ctypes._CData:
- __ctypes_from_outparam__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- __setstate__(...)
| |