Shift register

Module for interaction with shift register.

class devices.shift_register.shift_register.ShiftRegister(data_pin, clock_pin, latch_pin, num_outs)

Bases: object

Class for shift register.

Parameters:
  • data_pin – shift register data pin.
  • clock_pin – shift register clock pin.
  • latch_pin – shift register latch pin.
  • num_outs – number of outs.
assign_bit(position, bit_value, auto_show=True)

Assign bit to shift register view.

Parameters:
  • position – out position (from most significat bit, MSB=0).
  • bit_value – value for write out.
  • auto_show – write imidiately flag.
clock()

Switch clock.

get_position(position)

Get value of position.

latch()

Switch latch.

show_bits()

Write view bits to register.

class devices.shift_register.shift_register.ShiftRegisterPin(shift_register, position)

Bases: object

ShiftRegisterPin allow to manipulate separate shift register pin.

Parameters:
  • shift_register – ShiftRegister instance.
  • position – position of pin in register (from most significat bit, MSB=0).
OUT

Used by autodoc_mock_imports.

__call__(value=None)

Set or get the value of the pin.

Parameters:value – the value that will be assign to bit that concern to pin.
init(mode=-1, pull=-1, value=-1, drive=-1, alt=-1)

Pin.init method fake.

It can set mode to Pin.OUT. It can set value if present.

See machine.Pin constructor documentation for details of the mode argument.

mode(mode=None)

Get or set the pin mode.

off()

Set pin to “0” output level.

on()

Set pin to “1” output level.

pull(pull=None)

Get or set the pin pull state.

value(value=None)

Set or get the value of the pin.

Parameters:value – the value that will be assign to bit that concern to pin.