The Input and Output traits have this method because whether or not interrupts are enabled is truly orthogonal to the current state of the peripheral: it's possible for the peripheral to be ready (i.e. to have data (Input) or to be ready to accept data (Output)) regardless of whether interrupts are enabled or disabled (#182).
For Gpio, it's only valid for the peripheral to produce interrupts when a pin is in Interrupt mode. This makes Gpio::interrupts_enabled entirely redundant: you'd never want anything but the default interrupts_enabled impl.
For Timers there isn't an enable/disable for interrupts because there is no other mode of use for Timersother than interrupts.
When a timer has fired there is an interrupt pending. Clearing that interrupt flag means there is no longer an interrupt pending and there are no additional states.
steps
[ ] remove the interrupts_enabled functions from Timers and Gpio
what
The
Input
andOutput
traits have this method because whether or not interrupts are enabled is truly orthogonal to the current state of the peripheral: it's possible for the peripheral to be ready (i.e. to have data (Input
) or to be ready to accept data (Output
)) regardless of whether interrupts are enabled or disabled (#182).This is not the case for
Gpio
andTimers
.Gpio
https://github.com/ut-utp/core/blob/5e0f0eb43de2fe9e94f124cff6bc7db0821c7737/traits/src/peripherals/gpio.rs#L269-L272
For
Gpio
, it's only valid for the peripheral to produce interrupts when a pin is inInterrupt
mode. This makesGpio::interrupts_enabled
entirely redundant: you'd never want anything but the defaultinterrupts_enabled
impl.Timers
https://github.com/ut-utp/core/blob/5e0f0eb43de2fe9e94f124cff6bc7db0821c7737/traits/src/peripherals/timers.rs#L260-L264
For
Timers
there isn't an enable/disable for interrupts because there is no other mode of use forTimers
other than interrupts.When a timer has fired there is an interrupt pending. Clearing that interrupt flag means there is no longer an interrupt pending and there are no additional states.
steps
interrupts_enabled
functions fromTimers
andGpio
mem_mapped
inbaseline-sim
to matchTimers
andGpio
traitswhere
branch:
imp/remove-interrupts-enables-function
open questions