mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
rp/gpio: fix wait_for_* when multiple pins are in use.
This commit is contained in:
parent
89e2e25d6f
commit
6c10fa44d0
@ -152,24 +152,26 @@ unsafe fn IO_IRQ_BANK0() {
|
|||||||
let event = (intsx.read().0 >> pin_group * 4) & 0xf as u32;
|
let event = (intsx.read().0 >> pin_group * 4) & 0xf as u32;
|
||||||
|
|
||||||
if let Some(trigger) = InterruptTrigger::from_u32(event) {
|
if let Some(trigger) = InterruptTrigger::from_u32(event) {
|
||||||
proc_intx.inte(pin / 8).write(|w| match trigger {
|
critical_section::with(|_| {
|
||||||
InterruptTrigger::AnyEdge => {
|
proc_intx.inte(pin / 8).modify(|w| match trigger {
|
||||||
w.set_edge_high(pin_group, false);
|
InterruptTrigger::AnyEdge => {
|
||||||
w.set_edge_low(pin_group, false);
|
w.set_edge_high(pin_group, false);
|
||||||
}
|
w.set_edge_low(pin_group, false);
|
||||||
InterruptTrigger::LevelHigh => {
|
}
|
||||||
debug!("IO_IRQ_BANK0 pin {} LevelHigh triggered\n", pin);
|
InterruptTrigger::LevelHigh => {
|
||||||
w.set_level_high(pin_group, false);
|
debug!("IO_IRQ_BANK0 pin {} LevelHigh triggered\n", pin);
|
||||||
}
|
w.set_level_high(pin_group, false);
|
||||||
InterruptTrigger::LevelLow => {
|
}
|
||||||
w.set_level_low(pin_group, false);
|
InterruptTrigger::LevelLow => {
|
||||||
}
|
w.set_level_low(pin_group, false);
|
||||||
InterruptTrigger::EdgeHigh => {
|
}
|
||||||
w.set_edge_high(pin_group, false);
|
InterruptTrigger::EdgeHigh => {
|
||||||
}
|
w.set_edge_high(pin_group, false);
|
||||||
InterruptTrigger::EdgeLow => {
|
}
|
||||||
w.set_edge_low(pin_group, false);
|
InterruptTrigger::EdgeLow => {
|
||||||
}
|
w.set_edge_low(pin_group, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
INTERRUPT_WAKERS[pin as usize].wake();
|
INTERRUPT_WAKERS[pin as usize].wake();
|
||||||
}
|
}
|
||||||
@ -193,23 +195,25 @@ impl<'d, T: Pin> InputFuture<'d, T> {
|
|||||||
// pin, and each group consists of LEVEL_LOW, LEVEL_HIGH, EDGE_LOW,
|
// pin, and each group consists of LEVEL_LOW, LEVEL_HIGH, EDGE_LOW,
|
||||||
// and EGDE_HIGH.
|
// and EGDE_HIGH.
|
||||||
let pin_group = (pin.pin() % 8) as usize;
|
let pin_group = (pin.pin() % 8) as usize;
|
||||||
pin.int_proc().inte((pin.pin() / 8) as usize).write(|w| match level {
|
critical_section::with(|_| {
|
||||||
InterruptTrigger::LevelHigh => {
|
pin.int_proc().inte((pin.pin() / 8) as usize).modify(|w| match level {
|
||||||
debug!("InputFuture::new enable LevelHigh for pin {} \n", pin.pin());
|
InterruptTrigger::LevelHigh => {
|
||||||
w.set_level_high(pin_group, true);
|
debug!("InputFuture::new enable LevelHigh for pin {} \n", pin.pin());
|
||||||
}
|
w.set_level_high(pin_group, true);
|
||||||
InterruptTrigger::LevelLow => {
|
}
|
||||||
w.set_level_low(pin_group, true);
|
InterruptTrigger::LevelLow => {
|
||||||
}
|
w.set_level_low(pin_group, true);
|
||||||
InterruptTrigger::EdgeHigh => {
|
}
|
||||||
w.set_edge_high(pin_group, true);
|
InterruptTrigger::EdgeHigh => {
|
||||||
}
|
w.set_edge_high(pin_group, true);
|
||||||
InterruptTrigger::EdgeLow => {
|
}
|
||||||
w.set_edge_low(pin_group, true);
|
InterruptTrigger::EdgeLow => {
|
||||||
}
|
w.set_edge_low(pin_group, true);
|
||||||
InterruptTrigger::AnyEdge => {
|
}
|
||||||
// noop
|
InterruptTrigger::AnyEdge => {
|
||||||
}
|
// noop
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
irq.enable();
|
irq.enable();
|
||||||
|
Loading…
Reference in New Issue
Block a user