Start ADC Conversion from within ADC conversion callback
Posted: Thu Mar 10, 2016 11:16 am
Can i call start adc conversion from within callback of previous adc conversion?
My approaches was unsuccessfull..
for example: (reconstruction, may be small errors)
My approaches was unsuccessfull..
for example: (reconstruction, may be small errors)
Code: Select all
void adc1_callback(ADCDriver *adcp, adcsample_t *buffer, size_t n)
{
...
adcStartConversionI(adcp, &adc_grp_cfg2, &sample_2, ADC_GRP2_NUM_CHANNELS);
...
}
// conversion group for previous conversion
static const ADCConversionGroup adc_grp_cfg1 = {
FALSE,
1,
adc1_callback,
NULL,
.u.adc = {
0, ADC_CR2_SWSTART, 0, 0,
{ 0, ADC_SMPR2_SMP_AN8(ADC_SAMPLE_1P5)},
{ 0, 0, ADC_SQR3_SQ1_N(ADC_CHANNEL_IN8 ) }
}
};
// conversion group for next conversion
static const ADCConversionGroup adc_cfg_grp2 = {
FALSE,
ADC_WDG_NUM_CHANNELS,
NULL,
adcerr_wdg,
.u.adc = {
ADC_CR1_AWDEN | ADC_CR1_AWDIE | ADC_CR1_AWDSGL | ADC_CR1_AWDCH_0 | ADC_CR1_AWDCH_3,
ADC_CR2_SWSTART | ADC_CR2_CONT,
NEGATIVE_VOLTAGE_LIMIT,
POSITIVE_VOLTAGE_LIMIT,
{ 0, ADC_SMPR2_SMP_AN9(ADC_SAMPLE_1P5)},
{ 0, 0, ADC_SQR3_SQ1_N(ADC_CHANNEL_IN9)}}};