Description
Throughout the crate I believe most (if not all) register-mutating functions are unchecked, meaning that the crate user should check for support before enabling and configurating a feature. I consider this reasonable for trivial functions such as DWT::has_exception_trace
and DWT::enable_exception_tracing
but less so for more complex functions like DWT::configure
and ITM::configure
which may enable and configure a whole set of features. For these functions it's not trivial to figure out which has_
functions must be called before configuration (presuming they are implemented in the first place).
I believe it would be a better idea to verify support in configure
functions before registers are mutated (and return Err
if the requested configuration cannot be applied) and offer some configure_unchecked
variant when the user knows when a set of features are supported. I'm not sure if we should do the same to the more drivial functions.
Thoughts?