|
|
@ -29,7 +29,7 @@ static void adc_read_callback(ADCDriver *);
|
|
|
|
.cfgr2 = 0,
|
|
|
|
.cfgr2 = 0,
|
|
|
|
.tr1 = ADC_TR(0, 4095),
|
|
|
|
.tr1 = ADC_TR(0, 4095),
|
|
|
|
.smpr = {
|
|
|
|
.smpr = {
|
|
|
|
ADC_SMPR1_SMP_AN5(ADC_SMPR_SMP_247P5), 0
|
|
|
|
ADC_SMPR1_SMP_AN5(ADC_SMPR_SMP_2P5), 0
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.sqr = {
|
|
|
|
.sqr = {
|
|
|
|
ADC_SQR1_SQ1_N(ADC_CHANNEL_IN5),
|
|
|
|
ADC_SQR1_SQ1_N(ADC_CHANNEL_IN5),
|
|
|
@ -38,7 +38,7 @@ static void adc_read_callback(ADCDriver *);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
constexpr static const GPTConfig gpt_config = {
|
|
|
|
constexpr static const GPTConfig gpt_config = {
|
|
|
|
.frequency = 1000000,
|
|
|
|
.frequency = 4000000,
|
|
|
|
.callback = nullptr,
|
|
|
|
.callback = nullptr,
|
|
|
|
.cr2 = TIM_CR2_MMS_1, /* TRGO */
|
|
|
|
.cr2 = TIM_CR2_MMS_1, /* TRGO */
|
|
|
|
.dier = 0
|
|
|
|
.dier = 0
|
|
|
@ -65,7 +65,7 @@ namespace adc
|
|
|
|
adc_is_read_finished = false;
|
|
|
|
adc_is_read_finished = false;
|
|
|
|
adc_group_config.circular = false;
|
|
|
|
adc_group_config.circular = false;
|
|
|
|
adcStartConversion(adcd, &adc_group_config, buffer, count);
|
|
|
|
adcStartConversion(adcd, &adc_group_config, buffer, count);
|
|
|
|
gptStartContinuous(gptd, 100); // 10kHz
|
|
|
|
gptStartContinuous(gptd, 2);
|
|
|
|
while (!adc_is_read_finished);
|
|
|
|
while (!adc_is_read_finished);
|
|
|
|
return buffer;
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -77,7 +77,7 @@ namespace adc
|
|
|
|
adc_operation_func = operation_func;
|
|
|
|
adc_operation_func = operation_func;
|
|
|
|
adc_group_config.circular = true;
|
|
|
|
adc_group_config.circular = true;
|
|
|
|
adcStartConversion(adcd, &adc_group_config, buffer, count);
|
|
|
|
adcStartConversion(adcd, &adc_group_config, buffer, count);
|
|
|
|
gptStartContinuous(gptd, 100); // 10kHz
|
|
|
|
gptStartContinuous(gptd, 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void read_stop()
|
|
|
|
void read_stop()
|
|
|
|