Initial proof of concept
This commit is contained in:
9
src/adc/stm32.rs
Normal file
9
src/adc/stm32.rs
Normal file
@ -0,0 +1,9 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user