Open gwdehaan opened 6 years ago
It is nice to be as close as possible to other libraries. So I agree with your idea.
Do you understand the connection between the software of these libraries and the hardware they work with? That will come in useful when trying to control individual pins, especially because a word have to be sent to USB-ISS to change a pin's state.
Do please add any gpio related USB-ISS command bytes to 'usbiss.py' similar with SPI command bytes. This will make sure that the usbiss.py
can be used as standalone class. This will allow a developer to write their class on top.
How are you getting on?
from usbiss import usbiss
from usbiss import gpio
Port = 'COM3'
usbissdev = usbiss.USBISS(Port)
Io4 = gpio.GPIO(usbissdev)
io4.setup_pins({1:gpio.OUT, 2:gpio.OUT, 3:gpio.IN, 4: gpio.IN}, {1:gpio.LOW, 2:gpio.LOW})
io4.output(1, gpio.HIGH)
method | Description |
---|---|
setup(pin, mode) | Setup the pin to mode pin - pin between 1 and 4 mode - IN, OUT, ADC |
setup_pins(pins, values) | Setup multiple pins and optionaly set their value pins - dictionary to setup multiple pins at once values - dictionary to setup pinvalues Example : setup_pins({1:gpio.OUT, 2:gpio.OUT, 3:gpio.IN, 4: gpio.IN}, {1:gpio.LOW, 2:gpio.HIGH}) |
output(pin, level) | set the specified pin to level, HIGH or LOW pin - pin between 1 and 4 |
output_pins(pins) | Set the value of multiple pins pins - dictionary of pin number to pin value Example : {1:gpio.LOW, 2:gpio.HIGH}) |
input(pin) | Read the value of pin. Returns HIGH or LOW pin - pin between 1 and 4 |
input_pins(pins) | Read the values of multiple pins. Returns a list of values pins - list of pins to read |
adc(pin, vcc) | Read de analog value on the specified pin. Returns the voltage pin - pin between 1 and 4 vcc - the voltage that the usbiss is operating on 3,3 or 5 Volt. (jumper selectable) |
Test | Description |
---|---|
test_gpio.py | Testing basic functionality by performing some loopback tests. Hardware setup is described in the test script |
con_mode | Description |
---|---|
FULL | All 4 pins are available for GPIO (default) |
I2C | Pins 1 and 2 are usable for GPIO |
SERIAL | Pins 3 and 4 are usable for GPIO |
www.robot-electronics.co.uk/htm/usb_iss_io_tech https://github.com/adafruit/Adafruit_Python_GPIO/blob/master/Adafruit_GPIO/FT232H.py
on
IO
: When I look at the RPI.GPIO and https://github.com/adafruit/Adafruit_Python_GPIO/blob/master/Adafruit_GPIO/FT232H.py (and pyftfi) the instance is a spichannel or a pin. Up until now the instance in my implementation has been the USBISS module itself :RPI / pyftdi / FT232H.py
Would you agree to the following :
We can discuss the exact names for the methods. SPI / I2C / Serial are modes that have a single instance and fixed HW pins associated, whereas GPIO is configurable per pin as input, output or ADC.