@@ -31,7 +31,7 @@ mod async_io {
31
31
use embassy_sync:: waitqueue:: AtomicWaker ;
32
32
use zephyr_sys:: {
33
33
device, gpio_add_callback, gpio_callback, gpio_init_callback, gpio_pin_interrupt_configure,
34
- gpio_pin_interrupt_configure_dt, gpio_port_pins_t, GPIO_INT_LEVEL_HIGH , GPIO_INT_LEVEL_LOW ,
34
+ gpio_pin_interrupt_configure_dt, gpio_port_pins_t, GPIO_INT_EDGE_FALLING , GPIO_INT_EDGE_RISING ,
35
35
ZR_GPIO_INT_MODE_DISABLE_ONLY ,
36
36
} ;
37
37
@@ -212,14 +212,19 @@ mod async_io {
212
212
self . pin . data . register ( self . pin . pin . pin , cx. waker ( ) ) ;
213
213
214
214
let mode = match self . level {
215
- 0 => GPIO_INT_LEVEL_LOW ,
216
- 1 => GPIO_INT_LEVEL_HIGH ,
215
+ 0 => GPIO_INT_EDGE_FALLING /* GPIO_INT_LEVEL_LOW*/ ,
216
+ 1 => GPIO_INT_EDGE_RISING /* GPIO_INT_LEVEL_HIGH*/ ,
217
217
_ => unreachable ! ( ) ,
218
218
} ;
219
219
220
220
unsafe {
221
221
gpio_pin_interrupt_configure_dt ( & self . pin . pin , mode) ;
222
222
223
+ if self . level == zephyr_sys:: gpio_pin_get_raw ( self . pin . pin . port , self . pin . pin . pin ) as u8 {
224
+ let cb = self . pin . data . callback . get ( ) ;
225
+ GpioStatic :: callback_handler ( self . pin . pin . port , cb, 1 << self . pin . pin . pin ) ;
226
+ }
227
+
223
228
// Before sleeping, check if it fired, to avoid having to pend if it already
224
229
// happened.
225
230
if self . pin . data . has_fired ( self . pin . pin . pin ) {
0 commit comments