File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
libraries/mbed/targets/hal/TARGET_STM Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ static inline uint16_t adc_read(analogin_t *obj)
104
104
105
105
// Configure ADC channel
106
106
sConfig .Rank = ADC_REGULAR_RANK_1 ;
107
- sConfig .SamplingTime = ADC_SAMPLETIME_4CYCLES_5 ;
107
+ sConfig .SamplingTime = ADC_SAMPLETIME_19CYCLES_5 ;
108
108
sConfig .SingleDiff = ADC_SINGLE_ENDED ;
109
109
sConfig .OffsetNumber = ADC_OFFSET_NONE ;
110
110
sConfig .Offset = 0 ;
Original file line number Diff line number Diff line change @@ -110,8 +110,8 @@ static inline uint16_t adc_read(analogin_t *obj)
110
110
AdcHandle .Instance = (ADC_TypeDef * )(obj -> adc );
111
111
112
112
// Configure ADC channel
113
- sConfig .Rank = 1 ;
114
- sConfig .SamplingTime = ADC_SAMPLETIME_4CYCLES_5 ;
113
+ sConfig .Rank = ADC_REGULAR_RANK_1 ;
114
+ sConfig .SamplingTime = ADC_SAMPLETIME_19CYCLES_5 ;
115
115
sConfig .SingleDiff = ADC_SINGLE_ENDED ;
116
116
sConfig .OffsetNumber = ADC_OFFSET_NONE ;
117
117
sConfig .Offset = 0 ;
Original file line number Diff line number Diff line change @@ -80,9 +80,9 @@ void analogin_init(analogin_t *obj, PinName pin) {
80
80
81
81
// Configure ADC
82
82
AdcHandle .Init .OversamplingMode = DISABLE ;
83
- AdcHandle .Init .ClockPrescaler = ADC_CLOCKPRESCALER_PCLK_DIV2 ; // ADCCLK = 8 MHz (HSI 16 MHz / 2)
83
+ AdcHandle .Init .ClockPrescaler = ADC_CLOCKPRESCALER_PCLK_DIV1 ;
84
84
AdcHandle .Init .Resolution = ADC_RESOLUTION12b ;
85
- AdcHandle .Init .SamplingTime = ADC_SAMPLETIME_7CYCLES_5 ;
85
+ AdcHandle .Init .SamplingTime = ADC_SAMPLETIME_41CYCLES_5 ;
86
86
AdcHandle .Init .ScanDirection = ADC_SCAN_DIRECTION_UPWARD ;
87
87
AdcHandle .Init .DataAlign = ADC_DATAALIGN_RIGHT ;
88
88
AdcHandle .Init .ContinuousConvMode = DISABLE ;
@@ -91,7 +91,7 @@ void analogin_init(analogin_t *obj, PinName pin) {
91
91
AdcHandle .Init .ExternalTrigConv = ADC_EXTERNALTRIG0_T6_TRGO ; // Not used here
92
92
AdcHandle .Init .DMAContinuousRequests = DISABLE ;
93
93
AdcHandle .Init .EOCSelection = EOC_SINGLE_CONV ;
94
- AdcHandle .Init .Overrun = OVR_DATA_PRESERVED ;
94
+ AdcHandle .Init .Overrun = OVR_DATA_OVERWRITTEN ;
95
95
AdcHandle .Init .LowPowerAutoWait = ENABLE ;
96
96
AdcHandle .Init .LowPowerFrequencyMode = DISABLE ; // To be enabled only if ADC clock < 2.8 MHz
97
97
AdcHandle .Init .LowPowerAutoOff = DISABLE ;
You can’t perform that action at this time.
0 commit comments