herosdevices.hardware.ftdi¶
Implements a wrapper for FT232H devices.
https://www.adafruit.com/product/2264
The implementation https://github.com/eblot/pyftdi supports simultaneous use of SPI and GPIO pins. Unfortunately it is based on using bitmasks for everything.
Module Contents¶
- class herosdevices.hardware.ftdi.GPIO[source]¶
Bases:
enum.Enum
Provide Rpi.GPIO like API.
- IN = 0¶
- OUT = 1¶
- LOW¶
- HIGH¶
- class herosdevices.hardware.ftdi.FT232H(device_sn: str = 'QAO201901')[source]¶
Provide pin wrapping and GPIO abstraction.
see http://eblot.github.io/pyftdi/pinout.html
The device sn is written to the eeprom of the Adafruit FT232H chips. To do that follow this description: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-ft232h-breakout.pdf?timestamp=1550211653 (section Erase EEPROM For Programming With FT_PROG)
- PINMAP¶
- device_sn = 'QAO201901'¶
- spi_master¶
- gpio = None¶
- get_slave(cs: int = 0, freq: float = 12000000.0, mode: int = 0) int [source]¶
Get a slave aka. what you use to communicate.
- Parameters:
cs – chip-select 0 <= cs <= 4 (default CS0/ADBUS3/D3)
freq – spi frequency (default 12MHz)
mode – spi mode (default 0)
- Returns:
exposed spi slave
- gpio_setup(pin: str = 'C0', mode: GPIO = GPIO.OUT, initial_value: GPIO = GPIO.LOW) None [source]¶
Set up a single GPIO pin.
- Parameters:
pin – name according to pinmap
mode – GPIO.IN or GPIO.OUT
initial_value – GPIO.LOW or GPIO.HIGH
- Returns:
- gpio_set_output(pin: str = 'C0', initial_value: GPIO = GPIO.LOW) None [source]¶
Set one pin as output.
- Parameters:
pin – str pin descriptor
initial_value – initial value default GPIO.LOW
- Returns:
- gpio_set_input(pin: str = 'C0', initial_value: GPIO = GPIO.LOW) None [source]¶
Set one pin as output.
- Parameters:
pin – str pin descriptor
initial_value – initial value default GPIO.LOW (not used)
- Returns:
- herosdevices.hardware.ftdi.ftdi¶