Fixed temperature ADC conversion bug on mbxxx.
The conversion was made from an incorrect source when the GPIO pin was not PB7. Added functions and macros used to select the correct ADC channel.
This commit is contained in:
parent
faf2943e02
commit
01a7a78a94
4 changed files with 60 additions and 9 deletions
|
@ -72,7 +72,7 @@ value(int type)
|
|||
static int16u ADCvalue;
|
||||
static int16s volts;
|
||||
|
||||
halStartAdcConversion(ADC_USER_APP, ADC_REF_INT, ADC_SOURCE_ADC2_VREF2, ADC_CONVERSION_TIME_US_4096);
|
||||
halStartAdcConversion(ADC_USER_APP, ADC_REF_INT, ADC_SOURCE(halGetADCChannelFromGPIO(TEMPERATURE_SENSOR_GPIO),ADC_MUX_VREF2), ADC_CONVERSION_TIME_US_4096);
|
||||
|
||||
halReadAdcBlocking(ADC_USER_APP, &ADCvalue); // This blocks for a while, about 4ms.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue