Skip to content

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

Open
@MaxKaenner

Description

@MaxKaenner

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions