Skip to content

Power optimized ADC Resolution wrong slope [fix included] #527

New issue

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

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

Already on GitHub? Sign in to your account

Open
MaxKaenner opened this issue May 21, 2025 · 0 comments · May be fixed by #528
Open

Power optimized ADC Resolution wrong slope [fix included] #527

MaxKaenner opened this issue May 21, 2025 · 0 comments · May be fixed by #528

Comments

@MaxKaenner
Copy link

The revision V chips have two additional resolutions that can be set: TwelveBitV and FourteenBitV. Those are power optimized versions of TwelveBit and FourteenBit respectively. Currently using them is not intuitive because the slope() isn't calculated correctly.
The wrong calculation comes from the NumberOfBits trait implementation:

impl NumberOfBits for Resolution {
    fn number_of_bits(&self) -> u32 {
        match *self {
            Resolution::EightBit => 8,
            Resolution::TenBit => 10,
            Resolution::TwelveBit => 12,
            Resolution::FourteenBit => 14,
            _ => 16,
        }
    }
}

The TwelveBitV and FourteenBitV variants are handled by the wildcard and thus are wrongly assigned 16 bits. I think the two variants just need to be matched when the revision_v feature is enabled.

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

Successfully merging a pull request may close this issue.

1 participant