# Book Sprint * Content at https://hackmd.io/@bart-massey/BkUFCK5xye <- Edit here * https://github.com/rust-embedded/discovery-mb2 <- Repo * Chapter/chapters on Interrupts, DMA, PWM * Intro to interrupts * level? * events, tasks * https://docs.rust-embedded.org/book/ * `&raw mut*` * TODO: * Outline * Split the work * Code the example(s) * Write the chapters * Authorship, style * (Future: RTIC, Embassy) * (Move to microbit-bsp?) --- # Outline * Interrupts * What's an interrupt <- @hdoordt * Reflect on the way things were done in prior chapters * What's it good for: power saving, interleaving computation, concurrently waiting on i/o, ... * What is an interrupt? * What does it do (code pause, jump to ISP, return to where it was) * Can pause in the middle of a single CPU instruction, which makes interrupts very much like threads: race conditions * ISR has no arguments so how does it get input? Segue into next section * enabling it at the peripheral, masking/unmasking in nvic, ensure you unpend the interrupt before return <- James * Example with defmt::exit (or panic or something) - for fast feedback <- Bart * Gluing this together with non-embedded concepts like sharing across threads, etc. * HERE BE SHARING DRAGONS * WFE/WFI * Example using interrupt... gpio and timer peripherals * timer flashes LED * two buttons speed up/slow down the timer flash period * main loop wfi * Do this with an atomic so we don't need shared stuff again? * Under The Hood <- @adamgreig * ARM-specific stuff like NVIC, priorities, pre-emption * Vector table * Concurrency/resource sharing * Chip-specific stuff like PPI, EasyDMA * Interrupt macro * DMA and PWM