aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c')
-rw-r--r--demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c b/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c
index 9e2ee3a6b..f27371742 100644
--- a/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c
+++ b/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c
@@ -197,6 +197,13 @@ int main(void) {
spiStart(&SPID1, &spicfg);
/*
+ * Initializes the ADC driver 1.
+ * The pin PC0 on the port GPIOC is programmed as analog input.
+ */
+ adcStart(&ADCD1, NULL);
+ 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.
* Note, the AFIO access routes the TIM3 output pins on the PC6...PC9
@@ -208,14 +215,6 @@ int main(void) {
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, NULL);
- 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);