projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use prefix on the presets name.
[bertos.git]
/
boards
/
stm32-p103
/
hw
/
hw_adc.h
diff --git
a/boards/stm32-p103/hw/hw_adc.h
b/boards/stm32-p103/hw/hw_adc.h
index 2883d8ab3801a2e4266ca856c47bb85447a4a56c..8e0f0deecc9b448362207baf047bf2650ae96426 100644
(file)
--- a/
boards/stm32-p103/hw/hw_adc.h
+++ b/
boards/stm32-p103/hw/hw_adc.h
@@
-42,15
+42,28
@@
#include <io/stm32.h>
#include <io/stm32.h>
+/*
+ * Return the Vrefint voltage in mV.
+ */
INLINE uint16_t hw_readVrefint(void)
{
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, 3
300
);
}
}
+/*
+ * Return the cpu core temperature in degrees * 100.
+ */
INLINE uint16_t hw_readIntTemp(void)
{
uint16_t vsens = ADC_RANGECONV(adc_read(ADC_TEMP_CH), 0, 3300);
INLINE uint16_t 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);
+
+ uint16_t temp = (((ADC_TEMP_V25 - vsens) * 1000)/ ADC_TEMP_SLOPE) + ADC_TEMP_CONST;
+ return (temp / 10);
+}
+
+INLINE uint16_t hw_readRawTemp(void)
+{
+ return (uint16_t)ADC_RANGECONV(adc_read(ADC_TEMP_CH), 0, 3300);
}
#endif /* HW_ADC_H */
}
#endif /* HW_ADC_H */