pub struct Oversampling {
pub ratio: OversamplingRatio,
pub shift: u8,
pub triggered: bool,
pub resumed: bool,
}Expand description
Raw control of the hardware oversampler.
The oversampler accumulates ratio samples and right-shifts the sum by shift bits.
Averaging (Config::averaging) is the common special case where the shift is ratio.log2();
use this to get extra resolution instead (for example 16 samples and a shift of 2 turns a
12-bit ADC into a 14-bit one).
Fields§
§ratio: OversamplingRatioNumber of samples to accumulate.
shift: u8Number of bits to right-shift the accumulated result: 0 to 8, or 0 to 11 on ADCs with the
X1024 ratio. Panics at construction when out of range.
triggered: boolTriggered mode: each oversampled conversion needs a trigger instead of all of them being run back to back after a single trigger.
resumed: boolResume (instead of continue) a regular oversampling sequence interrupted by an injected conversion. Only on ADCs with injected conversions.
Implementations§
Source§impl Oversampling
impl Oversampling
Sourcepub const fn new(ratio: OversamplingRatio, shift: u8) -> Self
pub const fn new(ratio: OversamplingRatio, shift: u8) -> Self
Oversample by ratio and right-shift the sum by shift bits, in continuous mode.
Sourcepub const fn averaging(ratio: OversamplingRatio) -> Self
pub const fn averaging(ratio: OversamplingRatio) -> Self
Oversampling settings that average ratio samples, keeping the resolution.
Trait Implementations§
Source§impl Clone for Oversampling
impl Clone for Oversampling
Source§fn clone(&self) -> Oversampling
fn clone(&self) -> Oversampling
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more