Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocol/driver: add DigitalInputProtocol, GpioDigitalInputDriver #1458

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

flxzt
Copy link
Contributor

@flxzt flxzt commented Jul 31, 2024

Description

this adds a new protocol DigitalInputProtocol and a GPIO driver that implements it.

The DigitalOutputProtocol ABC now also inherits it, ensuring it can be used in all existing driver implementations.

Additionally the client now automatically uses DigitalInputProtocol when the command is io get.

By seperating the input from output protocol it is possible to make sure the GPIO line is configured in direction input in sysfs, which avoids shorts when reading out digital states from DUT's. Otherwise, one would have to rely on the circuitry of the GPIO line.

Tested on two Raspberry Pi's as exporter and DUT.

Note:

the sysfsgpioin.py part duplicates most of the sysfsgpio.py code but because of the way this code is executed by agentwrapper I thought it was cleaner to separate it into a new file.

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • PR has been tested

closes #1457

@flxzt
Copy link
Contributor Author

flxzt commented Aug 2, 2024

I think the way I implemented the behaviour of the client doesn't work well - if labgrid-client io get is used after labgrid-client io high/low, the sysfs direction is changed from out to in which can result in state low even if it was set high previously.

I'll revert to the previous behaviour where DigitialOutputProtocol is used for all client io subcommands.
So DigitalInputProtocol will only be available for usage with the library, which is also acceptable imo.

this adds a new protocol `DigitalInputProtocol` and a GPIO driver
that implements it.
The `DigitalOutputProtocol` ABC now also inherits it, ensuring it can be
used in all existing driver implementations.
Additionally the client now automatically uses `DigitalInputProtocol`
when the command is `io get`.

By seperating the input from output protocol it is possible
to make sure the GPIO line is configured in direction `input` in sysfs,
which avoids possible shorts when reading out digital states from DUT's.
Otherwise, one would have to rely on the circuitry of the GPIO line to
prevent that.

Signed-off-by: Felix Zwettler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add DigitalInputProtocol, GpioDigitalInputDriver
1 participant