What are, if any, pros or cons of using a struct
vs using an enum
to hold register addresses for a device driver? Different authors of such drivers seem to approach it differently. At first sight the struct
seems to make more sense, as there is no need to add the function that will return actual u8
values required by the functions. Is there some good reason to use enum
here?
struct Register;
impl Register {
const CTRL_STATUS_2 : u8 = 0x01;
}
/// Clear the timer flag.
pub fn clear_timer_flag(&mut self) -> Result<(), Error> {