Fix example reference voltage
This commit is contained in:
parent
20e7b5e296
commit
7c53ebd576
@ -20,10 +20,9 @@ async fn main(_spawner: Spawner) {
|
|||||||
let mut vrefint = adc.enable_vref(&mut Delay);
|
let mut vrefint = adc.enable_vref(&mut Delay);
|
||||||
let vrefint_sample = adc.read_internal(&mut vrefint);
|
let vrefint_sample = adc.read_internal(&mut vrefint);
|
||||||
let convert_to_millivolts = |sample| {
|
let convert_to_millivolts = |sample| {
|
||||||
// FIXME: use proper datasheet and value
|
// From https://www.st.com/resource/en/datasheet/stm32f031c6.pdf
|
||||||
// From http://www.st.com/resource/en/datasheet/CD00161566.pdf
|
// 6.3.4 Embedded reference voltage
|
||||||
// 5.3.4 Embedded reference voltage
|
const VREFINT_MV: u32 = 1230; // mV
|
||||||
const VREFINT_MV: u32 = 1200; // mV
|
|
||||||
|
|
||||||
(u32::from(sample) * VREFINT_MV / u32::from(vrefint_sample)) as u16
|
(u32::from(sample) * VREFINT_MV / u32::from(vrefint_sample)) as u16
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user