10 lines
261 B
Rust
10 lines
261 B
Rust
use crate::quantity::{MilliVolts, Quantity};
|
|
|
|
pub fn reading_to_voltage(
|
|
reading: u32,
|
|
reference_voltage: MilliVolts<u32>,
|
|
v_ref_int_scale: u32,
|
|
) -> MilliVolts<u16> {
|
|
MilliVolts((reading * v_ref_int_scale / reference_voltage.value()) as u16)
|
|
}
|