diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-10-12 17:59:47 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-10-12 17:59:47 +0000 |
commit | eaaf043cdab72623a15c957f44496b7bd0bd9873 (patch) | |
tree | cf7509640c9f62e6423cea9220f336ed1a99fd1a /testhal/STM32 | |
parent | 935e2fb27f56a3b81d4161d65e116e9da4fe441c (diff) | |
download | ChibiOS-eaaf043cdab72623a15c957f44496b7bd0bd9873.tar.gz ChibiOS-eaaf043cdab72623a15c957f44496b7bd0bd9873.tar.bz2 ChibiOS-eaaf043cdab72623a15c957f44496b7bd0bd9873.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2251 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32')
-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;
|