Remove \version svn tag.
[bertos.git] / boards / stm32-p103 / hw / hw_adc.h
index 3c6e4bbce7952c59026c2fa94b2818e83468f550..0313b2fc47a68939ceea41a1279460e78c26ca9b 100644 (file)
 
 #include <io/stm32.h>
 
+/*
+ * Return the Vrefint voltage in mV.
+ */
 INLINE uint16_t hw_readVrefint(void)
 {
-       return ADC_RANGECONV(adc_read(ADC_VREFINT_CH), 0, 3.3);
+       return ADC_RANGECONV(adc_read(ADC_VREFINT_CH), 0, 3300);
 }
 
-INLINE float hw_readIntTemp(void)
+/*
+ * Return the cpu core temperature in degrees * 100.
+ */
+INLINE uint16_t hw_readIntTemp(void)
 {
-       float vsens = ADC_RANGECONV(adc_read(ADC_TEMP_CH), 0, 3.3);
-       return (float)(((ADC_TEMP_V25 - vsens) / ADC_TEMP_SLOPE) + ADC_TEMP_CONST);
+       uint16_t vsens = ADC_RANGECONV(adc_read(ADC_TEMP_CH), 0, 3300);
+
+       uint16_t temp = (((ADC_TEMP_V25 - vsens) * 1000)/ ADC_TEMP_SLOPE) + ADC_TEMP_CONST;
+       return (temp / 10);
 }
 
 #endif /* HW_ADC_H */