You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug Report: GPIO Event and Value Handling Discrepancy
Board Type
Raspberry Pi 4 Model B Rev 1.4
Operating System
Debian GNU/Linux 12 (bookworm)
Swift Version
Swift 6.0.1
Installed using swiftlang.xyz
Description of the Issue
When using a button wired to GPIO 26 as an input, I encountered inconsistent behavior with GPIO event handling and value reading depending on the board configuration used.
Using RaspberryPi4:
Issue: GPIO events (e.g., onChange) do not fire when pressing the button.
Observation: Manually reading GPIO.value reflects the correct value change when the button is pressed.
Switching to RaspberryPi4_2024:
Issue: GPIO events now fire properly, but manually reading GPIO.value no longer returns the correct value.
Investigation Findings
The filenames in /sys/class/gpio/ match the IDs used in RaspberryPi4_2024, which are offset by 512 (e.g., /sys/class/gpio/gpio538/value for GPIO 26).
Thus, RaspberryPi4_2024 seems necessary for proper event handling.
However, the ids in RaspberryPi4_2024 appear to break the memory mapping.
Workaround
Here's a workaround I'm currently using. This ensures that the memory address calculations work as they did in RaspberryPi4 but the filenames will be offset by 512 as done in RaspberryPi4_2024. I don't understand all the details of this class so its likely I'm missing some things.
The text was updated successfully, but these errors were encountered:
gestrich
added a commit
to gestrich/SwiftyGPIO
that referenced
this issue
Dec 1, 2024
Bug Report: GPIO Event and Value Handling Discrepancy
Board Type
Operating System
Swift Version
Installed using
swiftlang.xyz
Description of the Issue
When using a button wired to GPIO 26 as an input, I encountered inconsistent behavior with GPIO event handling and value reading depending on the board configuration used.
Using
RaspberryPi4
:onChange
) do not fire when pressing the button.GPIO.value
reflects the correct value change when the button is pressed.Switching to
RaspberryPi4_2024
:GPIO.value
no longer returns the correct value.Investigation Findings
The filenames in
/sys/class/gpio/
match the IDs used inRaspberryPi4_2024
, which are offset by 512 (e.g.,/sys/class/gpio/gpio538/value
for GPIO 26).Thus,
RaspberryPi4_2024
seems necessary for proper event handling.However, the ids in
RaspberryPi4_2024
appear to break the memory mapping.Workaround
Here's a workaround I'm currently using. This ensures that the memory address calculations work as they did in RaspberryPi4 but the filenames will be offset by 512 as done in RaspberryPi4_2024. I don't understand all the details of this class so its likely I'm missing some things.
The text was updated successfully, but these errors were encountered: