Skip to content
Discussion options

You must be logged in to vote

Thanks for the help.
I agree it would be a can of worms to support subregisters natively.
I tried a bunch of stuff and reframing the problem of a subregister as a group of fields in a tree-like structure gave decent ergonomics (ex: R_FC::HostControllerVersion and R_FC::HostControllerVersion::SPEC).

Here is an example of what I ended up with:

macro_rules! register_bitfields_combined {
    (
        $valtype:ident, $(
            $(#[$r_meta:meta])*
            $vis:vis $reg:ident [$(
                $(#[$g_meta:meta])*
                $group:ident  OFFSET($g_offset:expr) NUMBITS($g_numbits:expr) [$(
                    $(#[$f_meta:meta])*
                    $field:ident  OFFSET($f_offset:e…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by flaviojs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants