void closeAnalogIO (void) { adcStopConversion (&ADCD3); chThdSleepMilliseconds(TIME_STEP); adcStop (&ADCD3); }
/* * Application entry point. */ int main(void) { /* * System initializations. * - HAL initialization, this also initializes the configured device drivers * and performs the board-specific initializations. * - Kernel initialization, the main() function becomes a thread and the * RTOS is active. */ halInit(); chSysInit(); /* * Setting up analog inputs used by the demo. */ palSetGroupMode(GPIOC, PAL_PORT_BIT(1) | PAL_PORT_BIT(2), 0, PAL_MODE_INPUT_ANALOG); /* * Creates the blinker thread. */ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); /* * Activates the ADC1 driver and the temperature sensor. */ adcStart(&ADCD1, NULL); adcSTM32EnableTS(&ADCD1); adcSTM32EnableVBAT(&ADCD1); /* * Linear conversion. */ adcConvert(&ADCD1, &adcgrpcfg1, samples1, ADC_GRP1_BUF_DEPTH); chThdSleepMilliseconds(1000); /* * Starts an ADC continuous conversion. */ adcStartConversion(&ADCD1, &adcgrpcfg2, samples2, ADC_GRP2_BUF_DEPTH); /* * Normal main() thread activity, in this demo it does nothing. */ while (true) { if (palReadPad(GPIOA, GPIOA_BUTTON)) { adcStopConversion(&ADCD1); } chThdSleepMilliseconds(500); } }
/* * Application entry point. */ int main(void) { /* * System initializations. * - HAL initialization, this also initializes the configured device drivers * and performs the board-specific initializations. * - Kernel initialization, the main() function becomes a thread and the * RTOS is active. */ halInit(); chSysInit(); /* * Creates the blinker thread. */ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); /* * Activates the ADC1 driver, the temperature sensor and the VBat * measurement. */ adcStart(&ADCD1, NULL); adcSTM32Calibrate(&ADCD1); adcSTM32EnableTSVREFE(); adcSTM32EnableVBATE(); /* * Linear conversion. */ adcConvert(&ADCD1, &adcgrpcfg1, samples1, ADC_GRP1_BUF_DEPTH); chThdSleepMilliseconds(1000); /* * Starts an ADC continuous conversion. */ adcStartConversion(&ADCD1, &adcgrpcfg2, samples2, ADC_GRP2_BUF_DEPTH); /* * Normal main() thread activity, in this demo it does nothing. */ while (TRUE) { if (palReadPad(GPIOA, GPIOA_WKUP_BUTTON)) { adcStopConversion(&ADCD1); } chThdSleepMilliseconds(500); } }
uint32_t dma_storm_adc_stop(void){ adcStopConversion(&ADCD1); adcSTM32DisableTSVREFE(); adcStop(&ADCD1); return ints; }
void convStop( void ) { adcStopConversion( &ADCD1 ); adcStop( &ADCD1 ); pwmStop( &CONV_PWM ); }
void adc_convert(void) { adcStopConversion(&ADCD1); adcStartConversion(&ADCD1, &adcgrpcfg1, adcvalues, ADC_GRP1_BUF_DEPTH); }