Skip to content

Commit fbbc3ed

Browse files
authored
Merge pull request #50 from Neotron-Compute/turn-on-interrupts
You do have to turn interrupts back on if you've turned them off...
2 parents 8939b86 + 0ca1817 commit fbbc3ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,13 @@ fn main() -> ! {
404404

405405
// Unmask the IO_BANK0 IRQ so that the NVIC interrupt controller
406406
// will jump to the interrupt function when the interrupt occurs.
407+
// Then enable interrupts on Core 0.
408+
//
407409
// We do this last so that the interrupt can't go off while
408-
// it is in the middle of being configured
410+
// it is in the middle of being configured.
409411
unsafe {
410412
pac::NVIC::unmask(pac::Interrupt::IO_IRQ_BANK0);
413+
cortex_m::interrupt::enable();
411414
}
412415

413416
// Empty the keyboard FIFO
@@ -835,7 +838,7 @@ impl Hardware {
835838
if INTERRUPT_PENDING.load(Ordering::Relaxed) {
836839
// The IO chip reports 0 for pending, 1 for not pending.
837840
self.interrupts_pending = self.io_read_interrupts() ^ 0xFF;
838-
defmt::info!("Interrupts: 0b{:08b}", self.interrupts_pending);
841+
defmt::info!("MCP23S17 IRQ pins: 0b{:08b}", self.interrupts_pending);
839842
// Change the debug LEDs so we can see the interrupts
840843
self.irq_count = self.irq_count.wrapping_add(1);
841844
self.set_debug_leds((self.irq_count & 0x0F) as u8);

0 commit comments

Comments
 (0)