-
Notifications
You must be signed in to change notification settings - Fork 189
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
Gpio acitve low and button protocol #1583
base: master
Are you sure you want to change the base?
Gpio acitve low and button protocol #1583
Conversation
This PR is a reduced version of #1569 without the libgpiod code. |
A button can be used to simulate pressing a physical button on a device. For example a DigitalOutputButtonDriver can be used when a reset button is connected via a relay to a DigitalOutput. In addition there are the ManualButtonDriver and ExternalButtonDriver drivers analogous to the ManualPowerDriver and ExternalPowerDriver drivers. Operations on a button include "press", "release", "press_for", and "get". Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
…tput The "invert" method should invert the value of a digital output. Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
The resources SysfsGPIO, NetworkSysfsGPIO and MatchedSysfsGPIO have been modified to have an additional optional active_low attribute (default False) which can be used to invert the logical value used on the gpio line. Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
Update the GPIODigitalOutputDriver to also implement the ResetProtocol, PowerProtocol, and ButtonProtocol. Update the GpioDigitalOutput agent to use the new active_low attribute Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
Add support for the power and button protocols and add the "invert" method of the io protocol to SysffsGPIO Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
Add documentations for ManualButtonDriver, ExternalButtonDriver, DigitalOutputButtonDriver. Update the SysfsGPIO, MatchedSysfsGPIO, and GpioDigitalOutputDriver to add the new active_low attribute and the new protocols supported by the GpioDigitalOutputDriver. Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
Also expand examples to call methods from the Power and Button protocols Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
840c6ff
to
c896f2d
Compare
Rebased to main development branch. |
A few notes:
I don't think the button abstraction is needed, from the labgrid POV we are pulling a GPIO line either high or low, that this corresponds to holding a button should be irrelevant and is best abstracted in the board strategy. |
Using labgrid-client to try to run power methods (on/off/cycle) on a SysfsGPIO resource results in Am I doing something wrong?
The ability to press_for a certain amount of time is still needed for my tests. With labgrid-client, the delay of calling an action can easily be longer than the press_for delay and is not accurate. example: labgrid-client calling on "io" and pulling high, sleep for 2 seconds, pulling low... real 0m8.138s example: labgrid-cleint calling on "button" to push_for with a 2 second delay... real 0m5.073s |
I have tried the following and still not getting power methods to work on the SysfsGPIO resource with labgrid-client.
result...
|
Description
As far as new features go...
ButtonProtocol is to be used in my test environment to control pressing the reset button of DUTs. For many of the DUTs, pressing the reset button when powering on provides (via uboot) a TFTP client or server or simply access to a web socket to be able to upload a new firmware image. A logical button is better for the test environment I am creating since it encapsulates the high/low logic levels of IO ports into something logical.
Extending the GPIO based drivers to the Reset, Power, and Button protocols was very straight forward and I did wonder why the Reset and Power protocols had not jet been implemented. They seem like logical extensions to general purpose IO lines.
Adding the active_low attribute was necessary because the IO lines used in the testbed are connected to relays which are active_low.
All development and testing was done on a raspberry pi 4 with opto-coupler relays connected to the GPIO lines to control power and reset buttons.
Checklist