12-bit ADC resolution for STM32 (#20519)
This commit is contained in:
parent
ba1176108a
commit
36aff1e464
@ -159,14 +159,14 @@ static inline int freeMemory() {
|
|||||||
|
|
||||||
#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT)
|
#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT)
|
||||||
|
|
||||||
inline void HAL_adc_init() {}
|
|
||||||
|
|
||||||
#define HAL_ADC_VREF 3.3
|
#define HAL_ADC_VREF 3.3
|
||||||
#define HAL_ADC_RESOLUTION 10
|
#define HAL_ADC_RESOLUTION ADC_RESOLUTION // 12
|
||||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||||
#define HAL_READ_ADC() HAL_adc_result
|
#define HAL_READ_ADC() HAL_adc_result
|
||||||
#define HAL_ADC_READY() true
|
#define HAL_ADC_READY() true
|
||||||
|
|
||||||
|
inline void HAL_adc_init() { analogReadResolution(HAL_ADC_RESOLUTION); }
|
||||||
|
|
||||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||||
|
|
||||||
uint16_t HAL_adc_get_result();
|
uint16_t HAL_adc_get_result();
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#define THERMISTOR_TABLE_SCALE (HAL_ADC_RANGE / _BV(THERMISTOR_TABLE_ADC_RESOLUTION))
|
#define THERMISTOR_TABLE_SCALE (HAL_ADC_RANGE / _BV(THERMISTOR_TABLE_ADC_RESOLUTION))
|
||||||
#if ENABLED(HAL_ADC_FILTERED)
|
#if ENABLED(HAL_ADC_FILTERED)
|
||||||
#define OVERSAMPLENR 1
|
#define OVERSAMPLENR 1
|
||||||
|
#elif HAL_ADC_RESOLUTION > 10
|
||||||
|
#define OVERSAMPLENR (20 - HAL_ADC_RESOLUTION)
|
||||||
#else
|
#else
|
||||||
#define OVERSAMPLENR 16
|
#define OVERSAMPLENR 16
|
||||||
#endif
|
#endif
|
||||||
|
@ -114,6 +114,8 @@ extern "C" {
|
|||||||
#define NUM_ANALOG_INPUTS 7
|
#define NUM_ANALOG_INPUTS 7
|
||||||
#define NUM_ANALOG_FIRST 80
|
#define NUM_ANALOG_FIRST 80
|
||||||
|
|
||||||
|
#define ADC_RESOLUTION 12
|
||||||
|
|
||||||
// PWM resolution
|
// PWM resolution
|
||||||
// #define PWM_RESOLUTION 12
|
// #define PWM_RESOLUTION 12
|
||||||
#define PWM_FREQUENCY 20000 // >= 20 Khz => inaudible noise for fans
|
#define PWM_FREQUENCY 20000 // >= 20 Khz => inaudible noise for fans
|
||||||
|
Loading…
Reference in New Issue
Block a user