"sanity check, I am doing this..." <- > <@mameluc:matrix.org> sanity check, I am doing this right? Trying to read the temperature calibration values but nothing makes sense > > ```rs > pub const TS_CAL1: *mut () = 0x1FFF75A8 as usize as _; > let ts_cal1 = unsafe { *TS_CAL1.cast::() } > ``` This works on stm32g081: ```rust // Converts raw temp reading from ADC[12] to temperature in °C. pub fn raw_ts_to_temp(ts: u16) -> i32 { let ts_cal1 = unsafe { *(0x1FFF75A8 as *mut u16) } as i32; let ts_cal2 = unsafe { *(0x1FFF75CA as *mut u16) } as i32; const TS_CAL1_TEMP: i32 = 30; const TS_CAL2_TEMP: i32 = 130; (TS_CAL2_TEMP - TS_CAL1_TEMP) / (ts_cal2 - ts_cal1) * (ts as i32 - ts_cal1) + TS_CAL1_TEMP } ```