aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARMCM3-STM32F100-DISCOVERY-GCC
diff options
context:
space:
mode:
Diffstat (limited to 'demos/ARMCM3-STM32F100-DISCOVERY-GCC')
-rw-r--r--demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c18
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);