Use typestate for interrupt_occurred
/reset_interrupt_flag
in the Peripheral traits
#181
Labels
➕ improvement
Chores and fixes: the small things.
P-low
Low priority
T-peripheral traits
Topic: Peripheral Traits
what
We want to make it so that you can only call
reset_interrupt_flag
after a call tointerrupt_occurred
for the same pin+peripheral indicated that interrupts are enabled.This would look something like:
And then in
mem_mapped
,Interrupt
would change from:core/baseline-sim/src/mem_mapped.rs
Lines 203 to 219 in 5e0f0eb
To something like:
steps
Gpio
Timers
Input
Interrupt
trait inmem_mapped
and update the peripheral trait implementations of it for:Gpio
Timers
Input
Output
interp.rs
to support threading through this bit of state toclear_pending_interrupt
where
branch:
imp/pending-interrupt-typestate
open questions
reset_interrupt_flag
? It's a holdover from when we had peripheral traits haveregister_interrupt_flags
methods (Removeregister_interrupt_flags
andPeripheralInterruptFlags
from the interpreter and friends #180).clear_pending_interrupt
andinterrupt_occurred
toget_pending_interrupt
The text was updated successfully, but these errors were encountered: