Skip to content

Commit

Permalink
ads7924: fix cast
Browse files Browse the repository at this point in the history
  • Loading branch information
jordens committed Oct 11, 2020
1 parent 8f0686f commit 5d06da6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ads7924/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ where
// Convert the voltage registers to an ADC code. The code is stored MSB-aligned,
// so we need to shift it back into alignment.
for i in 0..4 {
let code = u16::from_be_bytes(data[2 * i..2 * i + 1].try_into().unwrap());
let code = u16::from_be_bytes(data[2 * i..2 * (i + 1)].try_into().unwrap());
voltages[i] = (code >> 4) as f32 * self.volts_per_lsb;
}

Expand Down
5 changes: 2 additions & 3 deletions src/settings/channel_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ impl BoosterChannelData {
// All of the power meters are preceded by attenuators which are incorporated in
// the offset.
output_power_transform: LinearTransformation::new(1.0 / 0.035, -35.6 + 19.8 + 10.0),
// The input power and reflected power detectors are then passed through an
// op-amp with gain 1.5x - this modifies the slope from 35mV/dB to 52.5mV/dB
reflected_power_transform: LinearTransformation::new(
1.0 / 1.5 / 0.035,
-35.6 + 19.8 + 10.0,
),

// The input power and reflected power detectors are then passed through an
// op-amp with gain 1.5x - this modifies the slope from 35mV/dB to 52.5mV/dB
input_power_transform: LinearTransformation::new(1.0 / 1.5 / 0.035, -35.6 + 8.9),
}
}
Expand Down

0 comments on commit 5d06da6

Please sign in to comment.