Fixed adc config, to read internal reference to get cpu temperature

This commit is contained in:
dino 2019-10-10 16:03:25 +02:00 committed by David Sidrane
parent 7c2b945c21
commit 3c77ef7eb3
3 changed files with 9 additions and 1 deletions

View File

@ -137,6 +137,8 @@
#define ADC_HW_REV_SENSE_CHANNEL /* PC3 */ ADC1_CH(13)
#define ADC1_SPARE_1_CHANNEL /* PC4 */ ADC1_CH(14)
#define ADC_INTERNAL_TEMP_SENSOR_CHANNEL (18) /* No Gpio assigned, internal channel*/
#if BOARD_HAS_NBAT_V == 2 && BOARD_HAS_NBAT_I == 2
#define ADC_CHANNELS \
((1 << ADC_BATTERY1_VOLTAGE_CHANNEL) | \

View File

@ -156,6 +156,8 @@
#define ADC_HW_VER_SENSE_CHANNEL /* PF4 */ ADC3_CH(14)
#define ADC_HW_REV_SENSE_CHANNEL /* PF5 */ ADC3_CH(15)
#define ADC_INTERNAL_TEMP_SENSOR_CHANNEL (18) /* No Gpio assigned, internal channel*/
#define ADC_CHANNELS \
((1 << ADC_SCALED_VDD_3V3_SENSORS1_CHANNEL) | \
(1 << ADC_SCALED_VDD_3V3_SENSORS2_CHANNEL) | \

View File

@ -70,7 +70,7 @@
#ifdef STM32_ADC_CCR
# define rCCR(base) REG((base), STM32_ADC_CCR_OFFSET)
# define rCCR(base) REG((STM32_ADCCMN_BASE), STM32_ADC_CCR_OFFSET)
/* Assuming VDC 2.4 - 3.6 */
@ -235,7 +235,11 @@ float px4_arch_adc_reference_v()
uint32_t px4_arch_adc_temp_sensor_mask()
{
#ifdef ADC_INTERNAL_TEMP_SENSOR_CHANNEL
return 1 << ADC_INTERNAL_TEMP_SENSOR_CHANNEL;
#elif
return 1 << 16;
#endif
}
uint32_t px4_arch_adc_dn_fullcount()