EdgePi-Cloud / edgepi-python-sdk

Python SDK to control EdgePi, an industrial PC/PLC/IoT device powered by Raspberry Pi CM4
MIT License
6 stars 3 forks source link

GPIO Library #20

Closed sjpark608 closed 1 year ago

sjpark608 commented 2 years ago

There are two types of GPIOs on the EdgePi.

  1. BCM MCU GPIOs that are controlled directly by the kernel
    • DIN1-8, DOUT1-2, IO_RST, SPARE1, SPARE2
  2. GPIO expanders that are controlled using I2C comm
    • DOUT3-8, RTD_EN, DAC_GAIN, LED_OVR1-8, AN_EN1-8, GNDSW_IN1, GNDSW_IN2, RELAY_EN

Modules

  1. Terminal block configuration
    • Analog/Digital input
    • Analog/Digital output
  2. LED indicator

TODOs:

edgepi_gpio

gpio_commands

gpio_constants

Default values

sjpark608 commented 2 years ago

We are only interested in controlling the GPIO expanders as output sources. Section 3.5 of this datasheet illustrates register maps. The registers of interest are listed as follows

sjpark608 commented 2 years ago

Usage

gpio_commands

setDefaults() function

sjpark608 commented 2 years ago

GPIO test failed due to a number of reasons

  1. positional and keyword arguments, path, line directions are positional arguments but were passed as keyword arguments
  2. spi6-extended overlay still uses GPIO 27 as CS group. Therefore the gpio library throws a device or resource busy os error. by fixing the dt overlay the test gets to pass