ad7172: impl default for ch_calibration

This commit is contained in:
linuswck 2024-01-17 13:16:24 +08:00
parent ccaf728c75
commit f49fd08c69

View File

@ -274,6 +274,16 @@ pub struct ChannelCalibration {
bipolar: bool,
}
impl Default for ChannelCalibration {
fn default() -> Self {
ChannelCalibration {
offset: 0,
gain: 0,
bipolar: false,
}
}
}
impl ChannelCalibration {
pub fn convert_data(&self, data: u32) -> ElectricPotential {
let data = if self.bipolar {