From c852dcb3c960198f49c5fdd8619a6d5d581d9136 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 25 Nov 2010 18:32:45 +0000 Subject: Improved ADC and SPI driver models. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2426 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'demos/ARMCM3-STM32F100-DISCOVERY-GCC') diff --git a/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c b/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c index b1bc37c29..445872f00 100644 --- a/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c +++ b/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c @@ -187,17 +187,9 @@ int main(int argc, char **argv) { */ spiStart(&SPID1, &spicfg); - /* - * Initializes the ADC driver 1. - * The pin PC0 on the port GPIOC is programmed as analog input. - */ - adcStart(&ADCD1, &adccfg); - palSetGroupMode(GPIOC, PAL_PORT_BIT(0), PAL_MODE_INPUT_ANALOG); - /* * Initializes the PWM driver 1, re-routes the TIM3 outputs, programs the - * pins as alternate functions and finally enables channels with zero - * initial duty cycle. + * pins as alternate functions. * Note, the AFIO access routes the TIM3 output pins on the PC6...PC9 * where the LEDs are connected. */ @@ -206,6 +198,14 @@ int main(int argc, char **argv) { palSetGroupMode(GPIOC, PAL_PORT_BIT(GPIOC_LED3) | PAL_PORT_BIT(GPIOC_LED4), PAL_MODE_STM32_ALTERNATE_PUSHPULL); + /* + * Initializes the ADC driver 1 and performs a conversion. + * The pin PC0 on the port GPIOC is programmed as analog input. + */ + adcStart(&ADCD1, &adccfg); + palSetGroupMode(GPIOC, PAL_PORT_BIT(0), PAL_MODE_INPUT_ANALOG); + adcConvert(&ADCD1, &adcgrpcfg, samples, ADC_GRP1_BUF_DEPTH); + /* * Creates the example thread. */ -- cgit v1.2.3