diff options
Diffstat (limited to 'testhal/STM32/ADC')
| -rw-r--r-- | testhal/STM32/ADC/main.c | 23 | 
1 files changed, 5 insertions, 18 deletions
| diff --git a/testhal/STM32/ADC/main.c b/testhal/STM32/ADC/main.c index 11931b05b..00c82b9fd 100644 --- a/testhal/STM32/ADC/main.c +++ b/testhal/STM32/ADC/main.c @@ -29,7 +29,6 @@  static const ADCConfig adccfg = {};
  static adcsample_t samples[ADC_GRP1_NUM_CHANNELS * ADC_GRP1_BUF_DEPTH];
 -static Thread *adctp;
  /*
   * ADC streaming callback.
 @@ -67,20 +66,6 @@ static const ADCConversionGroup adcgrpcfg = {  };
  /*
 - * ADC continuous conversion thread.
 - */
 -static WORKING_AREA(adc_continuous_wa, 256);
 -static msg_t adc_continuous_thread(void *p){
 -
 -  (void)p;
 -  adcStart(&ADCD1, &adccfg);
 -  adcStartConversion(&ADCD1, &adcgrpcfg, samples, ADC_GRP1_BUF_DEPTH);
 -  adcWaitConversion(&ADCD1, TIME_INFINITE);
 -  adcStop(&ADCD1);
 -  return 0;
 -}
 -
 -/*
   * Red LEDs blinker thread, times are in milliseconds.
   */
  static WORKING_AREA(waThread1, 128);
 @@ -118,15 +103,17 @@ int main(int argc, char **argv) {    chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
    /*
 -   * Creates the ADC continuous conversion test thread.
 +   * Starts an ADC continuous conversion.
     */
 -  adctp = chThdCreateStatic(adc_continuous_wa, sizeof(adc_continuous_wa),
 -                            NORMALPRIO + 10, adc_continuous_thread, NULL);
 +  adcStart(&ADCD1, &adccfg);
 +  adcStartConversion(&ADCD1, &adcgrpcfg, samples, ADC_GRP1_BUF_DEPTH);
    /*
     * Normal main() thread activity, in this demo it does nothing.
     */
    while (TRUE) {
 +    if (palReadPad(IOPORT1, GPIOA_BUTTON))
 +      adcStopConversion(&ADCD1);
      chThdSleepMilliseconds(500);
    }
    return 0;
 | 
