ad7172: impl default for ch_calibration

This commit is contained in:
linuswck 2024-01-17 13:16:24 +08:00
parent ccaf728c75
commit f49fd08c69
1 changed files with 10 additions and 0 deletions

View File

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