-
Notifications
You must be signed in to change notification settings - Fork 20
zephyr-build: add aux_display support and fixed the gpio interrupt for stm32 series. #90
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
base: main
Are you sure you want to change the base?
Changes from all commits
82274ec
bb84703
3132d8b
0fc7432
830b748
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ mod async_io { | |
use embassy_sync::waitqueue::AtomicWaker; | ||
use zephyr_sys::{ | ||
device, gpio_add_callback, gpio_callback, gpio_init_callback, gpio_pin_interrupt_configure, | ||
gpio_pin_interrupt_configure_dt, gpio_port_pins_t, GPIO_INT_LEVEL_HIGH, GPIO_INT_LEVEL_LOW, | ||
gpio_pin_interrupt_configure_dt, gpio_port_pins_t, GPIO_INT_EDGE_FALLING, GPIO_INT_EDGE_RISING, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although the STM32 devices do not have level triggered interrupts, we don't want to remove support for them from targets that do. The async interface is actually really racy with edge triggered interrupts, and will pretty readily end up missing an edge and not firing again. Honestly, I think supporting wake from stm32 is going to be a bit more work. We can't just have something attach an edge trigger, but would need to leave it attached, to track the state. |
||
ZR_GPIO_INT_MODE_DISABLE_ONLY, | ||
}; | ||
|
||
|
@@ -212,14 +212,19 @@ mod async_io { | |
self.pin.data.register(self.pin.pin.pin, cx.waker()); | ||
|
||
let mode = match self.level { | ||
0 => GPIO_INT_LEVEL_LOW, | ||
1 => GPIO_INT_LEVEL_HIGH, | ||
0 => GPIO_INT_EDGE_FALLING/*GPIO_INT_LEVEL_LOW*/, | ||
1 => GPIO_INT_EDGE_RISING/*GPIO_INT_LEVEL_HIGH*/, | ||
_ => unreachable!(), | ||
}; | ||
|
||
unsafe { | ||
gpio_pin_interrupt_configure_dt(&self.pin.pin, mode); | ||
|
||
if self.level == zephyr_sys::gpio_pin_get_raw(self.pin.pin.port,self.pin.pin.pin) as u8 { | ||
let cb = self.pin.data.callback.get(); | ||
GpioStatic::callback_handler(self.pin.pin.port, cb, 1 << self.pin.pin.pin); | ||
} | ||
|
||
// Before sleeping, check if it fired, to avoid having to pend if it already | ||
// happened. | ||
if self.pin.data.has_fired(self.pin.pin.pin) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your editor seems to be inserting tabs instead of spaces. It does seem to suggest that cargo fmt doesn't process the build.rs file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from that, does auxdisplay have anything to do with this PR?