Multiplexer¶
Module for interaction with multiplexer.
-
class
devices.multiplexer.multiplexer.Multiplexer(input_pin, address_pins)¶ Bases:
objectClass for one multiplexer connected to ADC pin.
Parameters: - input_pin – multiplexers input.
- address_pins – multiplexer address pins.
-
get_states()¶ Return multiplexer inputs states list.
Returns: Inputs states.
-
read()¶ Read selected pin.
Returns: Selected pin value.
-
read_states()¶ Read states of multiplexer inputs to states list.
-
set_number(out_number)¶ Select input pin.
-
class
devices.multiplexer.multiplexer.MultiplexerCluster(input_pins, address_pins)¶ Bases:
objectClass for many multiplexers on one group of address pins.
Parameters: - input_pins – cluster multiplexers inputs.
- address_pins – cluster multiplexers address pins.
-
get_states()¶ Return list of multiplexers inputs states lists.
Returns: Inputs states.
-
read(input_index)¶ Read selected pin from
input_indexinput.Parameters: input_index – index of multiplexer in cluster. Returns: Selected pin value.
-
read_states()¶ Read states of multiplexers inputs to states lists.
-
set_number(out_number)¶ Select input pin.
-
class
devices.multiplexer.multiplexer.MultiplexerClusterPin(multiplexer_cluster, multiplexer, position, pull=None, treshold=512)¶ Bases:
objectMultiplexer cluster digital pin emulator.
Parameters: - multiplexer_cluster – multiplexer cluster.
- multiplexer – multiplexer index in cluster.
- position – position of pin in multiplexer.
- pull – type of actual (physycal) pull (Pin.PULL_UP or Pin.PULL_DOWN).
- treshold – tresholld of changing digital level.
-
__call__(value=None)¶ MultiplexerClusterPin objects are callable.
The call method provides a (fast) shortcut to set and get the value of the pin. It is equivalent to MultiplexerClusterPin.value(). See MultiplexerClusterPin.value() for more details.
-
init(mode=-1, pull=-1, value=-1, drive=-1, alt=-1)¶ Pin.init method fake.
It can set mode to Pin.IN. It can set value if present. It can set virtual pull if present.
See machine.Pin constructor documentation for details of the mode argument.
-
mode(mode=None)¶ Get or set the pin mode.
See machine.Pin constructor documentation for details of the mode argument.
Mode of MultiplexerClusterPin can be only Pin.IN otherwise raise exception.
-
off()¶ Set pin to “0” output level.
This pin unsupport set and raise exception.
-
on()¶ Set pin to “1” output level.
This pin unsupport set and raise exception.
-
pull(pull=None)¶ Get or set the pin (virtual) pull state.
See machine.Pin constructor documentation for details of the mode argument.
If actual pull is not eqivalent to virtual pull then digital logic is inverted. If pin has no actual physical pull the both pull shoutld be
None.
-
read()¶ Call read of internal ADC.
Returns: analog value of pin.
-
value(value=None)¶ Set and get the value of the pin.
It depends on whether the argument
valueis supplied or not.This pin unsupport set and raise exception.
-
class
devices.multiplexer.multiplexer.MultiplexerPin(multiplexer, position, pull=None, treshold=512)¶ Bases:
objectMultiplexer digital pin emulator.
Parameters: - multiplexer – multiplexer of pin.
- position – position of pin in multiplexer.
- pull – type of actual (physycal) pull (Pin.PULL_UP or Pin.PULL_DOWN).
- treshold – treshold of changing digital level.
-
__call__(value=None)¶ MultiplexerPin objects are callable.
The call method provides a (fast) shortcut to set and get the value of the pin. It is equivalent to MultiplexerPin.value(). See MultiplexerPin.value() for more details.
-
init(mode=-1, pull=-1, value=-1, drive=-1, alt=-1)¶ Pin.init method fake.
It can set mode to Pin.IN. It can set value if present. It can set virtual pull if present.
See machine.Pin constructor documentation for details of the mode argument.
-
mode(mode=None)¶ Get or set the pin mode.
See machine.Pin constructor documentation for details of the mode argument.
Mode of MultiplexerPin can be only Pin.IN otherwise raise exception.
-
off()¶ Set pin to “0” output level.
This pin unsupport set and raise exception.
-
on()¶ Set pin to “1” output level.
This pin unsupport set and raise exception.
-
pull(pull=None)¶ Get or set the pin (virtual) pull state.
See machine.Pin constructor documentation for details of the mode argument.
If actual pull is not eqivalent to virtual pull then digital logic is inverted. If pin has no actual physical pull the both pull shoutld be
None.
-
read()¶ Call read of internal ADC.
Returns: analog value of pin.
-
value(value=None)¶ Set and get the value of the pin.
It depends on whether the argument
valueis supplied or not.This pin unsupport set and raise exception.