12 Commits

Author SHA1 Message Date
Eric Callahan
98bb40bd80
utils: add kernel version
Move the kernel version tuple calculation out of gpio.py into
the utils package so its available for any module that requires
it.  In addition, report the kernel version string with the distribution
info and log the platform in the rollover header.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-03-11 06:26:18 -04:00
Eric Callahan
ea6df41f05
gpio: fix initial state for inverted gpios
The python-periphery library XORs the initial value based on
whether or not its inverted.  This requires consumers to set
the direction to "high" for inverted pins that are off, and
"low" otherwise.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-10 06:22:39 -05:00
Eric Callahan
e620d2dcd7
gpio: improve pin parsing
Use a regular expression to parse pins.  This simplifies flag
extraction and pin verification.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-23 11:37:45 -05:00
Eric Callahan
2298f6b5a7
gpio: improve event debounce procedure
Use a traditional debouncing method, waiting for a specified
debounce period before triggering events.  Consumers may
choose to futher ignore events based on the the duration
between events.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-22 18:19:59 -05:00
Eric Callahan
5d079d8c26
gpio: migrate from gpiod to python-periphery
The libgpiod library has breaks API compatibility with version 2.
Given that not all distributions ship gpiod and its unique nature
as a system package, replace it with a wrapper that directly
accesses the GPIO character device.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-22 18:19:58 -05:00
Eric Callahan
0f8638fec7
components: correct imports
All imports must now be relative to work correctly with the
moonraker parent package.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 12:16:27 -05:00
Eric Callahan
1f86943cbb
gpio: relax error handling
Increase the error threshold to 50 and reset within a 5 second threshold.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-21 14:13:17 -04:00
Eric Callahan
fc5e34096a gpio: add support for line events
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-01-12 08:05:17 -05:00
Eric Callahan
9346186337 gpio: refactor pin parsing
Return a dictionary of pin params rather than a tuple

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-01-06 11:56:41 -05:00
Eric Callahan
0a1367744f confighelper: fix json parsing error for gpios
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-11-23 08:21:56 -05:00
Eric Callahan
97e27661d7 gpio: remove get_gpio_out_from_config method
The confighelper object now can setup  gpios directly.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-21 06:26:09 -05:00
Eric Callahan
83901b1896 gpio: helper component for managing system gpios
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-11-15 08:10:29 -05:00