Demonstrate GPIO interrupts on the LPC55S69-EVK board.#1919
Open
Demonstrate GPIO interrupts on the LPC55S69-EVK board.#1919
Conversation
lzrd
commented
Nov 17, 2024
lzrd
commented
Nov 17, 2024
lzrd
commented
Nov 17, 2024
task/button/src/main.rs
Outdated
| }; | ||
|
|
||
| // XXX for now at least, setting up a PINT pin will set dir to Input | ||
| server.gpio.disable_rising(BUTTON_PINT_MASK); |
Contributor
Author
There was a problem hiding this comment.
Some of these calls are redundant with the reset state of the PINT peripheral and can be removed.
Contributor
Author
|
Note: This implementation only implements edge-detection interrupts and ignores level-detection. |
8b12ea1 to
6dd78e5
Compare
labbott
reviewed
Nov 18, 2024
labbott
reviewed
Nov 18, 2024
| fn set_pin_direction(&self, port: usize, pin: usize, dir: Direction) { | ||
| match dir { | ||
| Direction::Input => self.gpio.dirclr[port] | ||
| .write(|w| unsafe { w.dirclrp().bits(1 << pin) }), |
Collaborator
There was a problem hiding this comment.
The unsafe is a quirk of how the lpc55-pac is generated. Adding a safety comment for this is unlikely to be useful.
2ae073d to
1e52c42
Compare
Add interrupt-related API calls to the LPC55 `gpio_driver`.
A task on an LPC55 can now configue and use GPIO interrupts.
app.toml example shows Pin Interrupt configuration:
[tasks.foo]
...
interrupts = { "pint.irq0" = "button-irq" }
...
task-slots = ["gpio_driver", ...]
[tasks.foo.config]
pins = [
{ name="BUTTON', pin={ port=1, pin=9}, alt=0, pint=0, direction="input", opendrain="normal" }
]
…API.
The functions:
fn {clear,detected,disable,enable}_{rising,falling,status}(PintSlot)
and
fn read_pint_status(...)
become
fn pint_op(PintSlot, PintOp, PintCondition)
This leaves a couple permutations not covered (enable/disable
interrupt at the NVIC level).
Those can are left as no-ops for the time being.
Future: The unimplemented combinations could return an error/fault
if called.
Pressing the USER button generates an interrupt to the button task.
A single press will increment the RGB pattern.
Quick (~1.5s) successive presses 2nd, 3rd, and subsequent will respecitvely
- turn off LEDs
- blink LEDs
- cycle through RBG pattern including all off.
Minor updates to other app.toml files:
- add `pint` and `inputmux` peripherals to their `gpio_driver` tasks.
- when compiling all targets, some needed slight allocation
adjustments not related to this PR.
Future: The unimplemented combinations could return an error/fault if called.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pressing the USER button generates an interrupt to the button task.
A single press will increment the RGB pattern.
Quick (~1.5s) successive presses 2nd, 3rd, and subsequent will respecitvely
Minor updates to other app.toml files:
pintandinputmuxperipherals to theirgpio_drivertasks.