From 13292fe21ffef5edef79eb339903a91d5dde6b93 Mon Sep 17 00:00:00 2001 From: asterix Date: Mon, 28 Jun 2010 18:12:07 +0000 Subject: [PATCH] Revert last commit and add comments. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3963 38d2e660-2303-0410-9eaa-f027e97ec537 --- boards/stm32-p103/hw/hw_adc.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/boards/stm32-p103/hw/hw_adc.h b/boards/stm32-p103/hw/hw_adc.h index 2883d8ab..c2c321f1 100644 --- a/boards/stm32-p103/hw/hw_adc.h +++ b/boards/stm32-p103/hw/hw_adc.h @@ -42,15 +42,21 @@ #include +/* + * 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 uint16_t hw_readIntTemp(void) +/* + * Return the cpu core temperature in degrees. + */ +INLINE float hw_readIntTemp(void) { - uint16_t vsens = ADC_RANGECONV(adc_read(ADC_TEMP_CH), 0, 3300); - return (((ADC_TEMP_V25 - vsens) / ADC_TEMP_SLOPE) + ADC_TEMP_CONST); + float vsens = ADC_RANGECONV(adc_read(ADC_TEMP_CH), 0, 3.3); + return (float)(((ADC_TEMP_V25 - vsens) / ADC_TEMP_SLOPE) + ADC_TEMP_CONST); } #endif /* HW_ADC_H */ -- 2.25.1