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

Enable GPIO Pin Interrupts #1922

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

Enable GPIO Pin Interrupts #1922

wants to merge 4 commits into from

Conversation

lzrd
Copy link
Contributor

@lzrd lzrd commented Nov 18, 2024

Add interrupt-related API calls to the LPC55 gpio_driver.

Also:
Fix app/gimletlet/app-mgmt.toml stack size which was found while building all targets.


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" }
]

@lzrd lzrd force-pushed the lpc55-gpio-interrupts branch 2 times, most recently from ddf4058 to 8565d73 Compare November 19, 2024 03:19
drv/lpc55-gpio/src/main.rs Outdated Show resolved Hide resolved
build/lpc55pins/src/lib.rs Outdated Show resolved Hide resolved
build/lpc55pins/src/lib.rs Outdated Show resolved Hide resolved
@lzrd lzrd force-pushed the lpc55-gpio-interrupts branch from 8565d73 to 70ecce9 Compare November 26, 2024 03:47
@lzrd lzrd force-pushed the lpc55-gpio-interrupts branch from 70ecce9 to 77e17fd Compare December 13, 2024 00:13
lzrd added 3 commits January 30, 2025 11:02
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.
@lzrd lzrd force-pushed the lpc55-gpio-interrupts branch from 77e17fd to 1a53002 Compare January 30, 2025 19:02
…EADME.md

Feedback response: Fix idl/lpc55-pins.idol to use Option<PintSlot>.
Feedback response: Collapse the many PINT calls in lpc55-pins.idol to one `pint_op`
@lzrd lzrd force-pushed the lpc55-gpio-interrupts branch from 1a53002 to e419b0a Compare January 31, 2025 00:55
@@ -77,3 +77,12 @@ size = 0x1000
[bootrom]
address = 0x03000000
size = 0x10000

[pint]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, to keep region count down (which is less critical on v8M but still), IOCON, PINT, and two currently-unused-but-relevant-looking blocks (GINT0/1) are adjacent. So you could merge them into one block at 0x4000_1000 with length 0x4000.

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.

3 participants