digi.xbee.io module¶
-
class
digi.xbee.io.IOLine(value)[source]¶ Bases:
enum.EnumEnumerates the different IO lines that can be found in the XBee devices.
Depending on the hardware and firmware of the device, the number of lines that can be used as well as their functionality may vary. Refer to the product manual to learn more about the IO lines of your XBee device.
Values:IOLine.DIO0_AD0 = (‘DIO0/AD0’, 0, ‘D0’)IOLine.DIO1_AD1 = (‘DIO1/AD1’, 1, ‘D1’)IOLine.DIO2_AD2 = (‘DIO2/AD2’, 2, ‘D2’)IOLine.DIO3_AD3 = (‘DIO3/AD3’, 3, ‘D3’)IOLine.DIO4_AD4 = (‘DIO4/AD4’, 4, ‘D4’)IOLine.DIO5_AD5 = (‘DIO5/AD5’, 5, ‘D5’)IOLine.DIO6 = (‘DIO6’, 6, ‘D6’)IOLine.DIO7 = (‘DIO7’, 7, ‘D7’)IOLine.DIO8 = (‘DIO8’, 8, ‘D8’)IOLine.DIO9 = (‘DIO9’, 9, ‘D9’)IOLine.DIO10_PWM0 = (‘DIO10/PWM0’, 10, ‘P0’, ‘M0’)IOLine.DIO11_PWM1 = (‘DIO11/PWM1’, 11, ‘P1’, ‘M1’)IOLine.DIO12 = (‘DIO12’, 12, ‘P2’)IOLine.DIO13 = (‘DIO13’, 13, ‘P3’)IOLine.DIO14 = (‘DIO14’, 14, ‘P4’)IOLine.DIO15 = (‘DIO15’, 15, ‘P5’)IOLine.DIO16 = (‘DIO16’, 16, ‘P6’)IOLine.DIO17 = (‘DIO17’, 17, ‘P7’)IOLine.DIO18 = (‘DIO18’, 18, ‘P8’)IOLine.DIO19 = (‘DIO19’, 19, ‘P9’)-
has_pwm_capability()[source]¶ Returns whether the IO line has PWM capability or not.
- Returns
Trueif the IO line has PWM capability,Falseotherwise.- Return type
Boolean
-
property
description¶ String. The IO line description.
-
property
index¶ Integer. The IO line index.
-
property
at_command¶ String. The IO line AT command.
-
property
pwm_at_command¶ String. The IO line PWM AT command.
-
-
class
digi.xbee.io.IOValue(value)[source]¶ Bases:
enum.EnumEnumerates the possible values of a
IOLineconfigured as digital I/O.Values:IOValue.LOW = 4IOValue.HIGH = 5-
classmethod
get(code)[source]¶ Returns the IOValue for the given code.
- Parameters
code (Integer) – the code corresponding to the IOValue to get.
- Returns
the IOValue with the given code,
Noneif there is not any IOValue with that code.- Return type
-
property
code¶ Integer. The IO value code.
-
classmethod
-
class
digi.xbee.io.IOSample(io_sample_payload)[source]¶ Bases:
objectThis class represents an IO Data Sample. The sample is built using the the constructor. The sample contains an analog and digital mask indicating which IO lines are configured with that functionality.
Depending on the protocol the XBee device is executing, the digital and analog masks are retrieved in separated bytes (2 bytes for the digital mask and 1 for the analog mask) or merged contained (digital and analog masks are contained in 2 bytes).
Digital and analog channels masks Indicates which digital and ADC IO lines are configured in the module. Each bit corresponds to one digital or ADC IO line on the module:
bit 0 = DIO01 bit 1 = DIO10 bit 2 = DIO20 bit 3 = DIO31 bit 4 = DIO40 bit 5 = DIO51 bit 6 = DIO60 bit 7 = DIO70 bit 8 = DIO80 bit 9 = AD00 bit 10 = AD11 bit 11 = AD21 bit 12 = AD30 bit 13 = AD40 bit 14 = AD50 bit 15 = NA0 Example: mask of 0x0C29 means DIO0, DIO3, DIO5, AD1 and AD2 enabled. 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1
Digital Channel Mask Indicates which digital IO lines are configured in the module. Each bit corresponds to one digital IO line on the module:
bit 0 = DIO0AD0 bit 1 = DIO1AD1 bit 2 = DIO2AD2 bit 3 = DIO3AD3 bit 4 = DIO4AD4 bit 5 = DIO5AD5ASSOC bit 6 = DIO6RTS bit 7 = DIO7CTS bit 8 = DIO8DTRSLEEP_RQ bit 9 = DIO9ON_SLEEP bit 10 = DIO10PWM0RSSI bit 11 = DIO11PWM1 bit 12 = DIO12CD bit 13 = DIO13 bit 14 = DIO14 bit 15 = NA Example: mask of 0x040B means DIO0, DIO1, DIO2, DIO3 and DIO10 enabled. 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 1
Analog Channel Mask Indicates which lines are configured as ADC. Each bit in the analog channel mask corresponds to one ADC line on the module.
bit 0 = AD0DIO0 bit 1 = AD1DIO1 bit 2 = AD2DIO2 bit 3 = AD3DIO3 bit 4 = AD4DIO4 bit 5 = AD5DIO5ASSOC bit 6 = NA bit 7 = Supply Voltage Value Example: mask of 0x83 means AD0, and AD1 enabled. 0 0 0 0 0 0 1 1
Class constructor. Instantiates a new
IOSampleobject with the provided parameters.- Parameters
io_sample_payload (Bytearray) – The payload corresponding to an IO sample.
- Raises
ValueError – if io_sample_payload length is less than 5.
-
static
min_io_sample_payload()[source]¶ Returns the minimum IO sample payload length.
- Returns
the minimum IO sample payload length.
- Return type
Integer
-
has_digital_values()[source]¶ Checks whether the IOSample has digital values or not.
- Returns
Trueif the sample has digital values,Falseotherwise.- Return type
Boolean
-
has_digital_value(io_line)[source]¶ Returns whether th IO sample contains a digital value for the provided IO line or not.
- Parameters
io_line (
IOLine) – The IO line to check if it has a digital value.- Returns
Trueif the given IO line has a digital value,Falseotherwise.- Return type
Boolean
-
has_analog_value(io_line)[source]¶ Returns whether the given IOLine has an analog value or not.
- Returns
Trueif the given IOLine has an analog value,Falseotherwise.- Return type
Boolean
-
has_analog_values()[source]¶ Returns whether the {@code IOSample} has analog values or not.
- Returns
Boolean.
Trueif there are analog values,Falseotherwise.
-
has_power_supply_value()[source]¶ Returns whether the IOSample has power supply value or not.
- Returns
Boolean.
Trueif the given IOLine has a power supply value,Falseotherwise.
-
get_digital_value(io_line)[source]¶ Returns the digital value of the provided IO line.
To verify if this sample contains a digital value for the given
IOLine, use the methodIOSample.has_digital_value().
-
get_analog_value(io_line)[source]¶ Returns the analog value of the provided IO line.
To verify if this sample contains an analog value for the given
IOLine, use the methodIOSample.has_analog_value().- Parameters
io_line (
IOLine) – The IO line to get its analog value.- Returns
- The analog value of the given IO line or
Noneif the IO sample does not contain an analog value for the given IO line.
- The analog value of the given IO line or
- Return type
Integer
See also
-
property
digital_hsb_mask¶ Integer. High Significant Byte (HSB) of the digital mask.
-
property
digital_lsb_mask¶ Integer. Low Significant Byte (LSB) of the digital mask.
-
property
digital_mask¶ Integer. Digital mask of the IO sample.
-
property
analog_mask¶ Integer. Analog mask of the IO sample.
-
property
digital_values¶ Dictionary. Digital values map.
-
property
analog_values¶ Dictionary. Analog values map.
-
property
power_supply_value¶ Integer. Power supply value,
Noneif the sample does not contain power supply value.
-
class
digi.xbee.io.IOMode(value)[source]¶ Bases:
enum.EnumEnumerates the different Input/Output modes that an IO line can be configured with.
-
DISABLED= 0¶ Disabled
-
SPECIAL_FUNCTIONALITY= 1¶ Firmware special functionality
-
PWM= 2¶ PWM output
-
ADC= 2¶ Analog to Digital Converter
-
DIGITAL_IN= 3¶ Digital input
-
DIGITAL_OUT_LOW= 4¶ Digital output, Low
-
DIGITAL_OUT_HIGH= 5¶ Digital output, High
-
I2C_FUNCTIONALITY= 6¶ I2C functionality
-