diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-11-25 18:32:45 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-11-25 18:32:45 +0000 |
commit | c852dcb3c960198f49c5fdd8619a6d5d581d9136 (patch) | |
tree | 18da29976692bb47392618d38484c7cebbabdffb /demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c | |
parent | d973c3f25a6ab56e12b9f858b0692ec4297d84c9 (diff) | |
download | ChibiOS-c852dcb3c960198f49c5fdd8619a6d5d581d9136.tar.gz ChibiOS-c852dcb3c960198f49c5fdd8619a6d5d581d9136.tar.bz2 ChibiOS-c852dcb3c960198f49c5fdd8619a6d5d581d9136.zip |
Improved ADC and SPI driver models.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2426 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c')
-rw-r--r-- | demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c | 18 |
1 files changed, 9 insertions, 9 deletions
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 @@ -188,16 +188,8 @@ 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.
*/
@@ -207,6 +199,14 @@ int main(int argc, char **argv) { 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.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|