Description
In HALConfig.cpp
, the hal_adc_config()
routine currently has the Sample Time (sConfig.SamplingTime
) hard coded to a value of
ADC_SAMPLETIME_8CYCLES_5
(8.5 clocks).
According to the datasheet, a value of ADC_SAMPLETIME_2CYCLES_5
(2.5 clocks) is legal. This increases the maximum sample rate from 1.8 MS/s to 2.9 MS/s.
Due to concerns about operating conditions (temperature, voltage etc), it would NOT be a good idea to simply change the hard-coded value from 8.5 clocks to 2.5 clocks. Instead, a new defaulted argument can be added to hal_adc_config()
which can be set to SAMPLE_SLOW
or SAMPLE_FAST
to enable switching between 8.5 clocks and 2.5 clocks as the user prefers based on their operating conditions and needs. The default would be SAMPLE_SLOW
to retain backward compatibility.