Remove interrupts_enabled
from Timers
and Gpio
#183
Labels
➕ improvement
Chores and fixes: the small things.
P-low
Low priority
T-peripheral traits
Topic: Peripheral Traits
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
core/traits/src/peripherals/gpio.rs
Lines 269 to 272 in 5e0f0eb
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
core/traits/src/peripherals/timers.rs
Lines 260 to 264 in 5e0f0eb
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
The text was updated successfully, but these errors were encountered: