Skip to content

(read|modify|write)_register should take/return typed structures rather than u8 #10

Description

@dsvensson

The following code:

        self.modify_register(config::Register::MDMCFG2, |r| {
            MDMCFG2(r).modify().sync_mode(mode.value()).bits()
        })?;

... should ideally not mention MDMCFG2 in the body, nor modify():

        self.modify_register(config::Register::MDMCFG2, |r| {
            r.sync_mode(mode.value()).bits()
        })?;

And similarily, calling self.read_register(config::Register.:MDMCFG2) should return a MDMCFG2 rather than an u8.

Can probably be fixed by introducing some good traits. Figure out how.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions