Skip to content

GPIO Module refactoring #153

@sjpark608

Description

@sjpark608

I'm starting to implement the DIN and DOUT feature of EdgePiGPIO. These two feature requires to use GPIO character device. All pins of DIN (DIN1~DIN8) are attached on RPI CPU and requires direct pin access. For DOUT pins, DOUT1 and DOUT2 are attached on the CPU but rest of the pins are attached on the expander chip( i2c device). In order to access both pin groups on different hardware, I'm planning to refactor the EdgePiGPIO module as follows:

┌──────────────────────────┐               ┌─────────────────────────────┐
│                          │               │                             │
│                          │               │                             │
│  edgpi_gpio_expander.py  │               │  edgpi_gpio_chip.py         │
│                          │               │                             │
│                          │               │                             │
└──────────────────────┬───┘            ┌──┴─────────────────────────────┘
                       │                │
                       │                │
                       │                │
                       │                │
                 ┌─────▼────────────────▼────┐
                 │      edgpi_gpio.py        │
                 │                           │
                 └───────────────────────────┘

The current EdgePiGPIO class will be moved to a separate file and changed its name to edgepi_gpio_expander. This class only takes care of gpio pins on the expander chip. And a new class is generated in a separate file edgepi_gpio_chip. This will take care of direct control of pins on the CPU. Then the current edgepi_gpio will inherit both classes and instantiate one or both of them depending on the module config.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions