Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixed value registers should still contain the fields in its struct. #28

Open
trembel opened this issue Nov 22, 2024 · 1 comment
Open

Comments

@trembel
Copy link

trembel commented Nov 22, 2024

Look at example below. Problem: you can not compare to Version::default(), although it exists :S

/// `VERSION` Register
///
/// Address: 0x7F
///
/// Reset Value: 0x41
///
/// Holds the version number of the IC, currently 0x41.
///
/// Fixed bits:
/// - `[7:0]` = 0b1000001
#[derive(Debug, PartialEq)]
pub struct Version {
}

/// Register Properties
impl Register<1, u8> for Version {
    const ADDRESS: u8 = 0x7F;
    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x41]));
}

/// Reset Value
impl Default for Version {
    fn default() -> Self {
        Self {
        }
    }
}
@trembel
Copy link
Author

trembel commented Nov 22, 2024

The biggest IMO with the current solution, is that it's unclear what default does; Although somehow I expect it to populate the struct with the default values - which does not really exist.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant