diff options
Diffstat (limited to 'testhal/STM32F30x/PWM-ICU')
-rw-r--r-- | testhal/STM32F30x/PWM-ICU/.project | 2 | ||||
-rw-r--r-- | testhal/STM32F30x/PWM-ICU/main.c | 22 | ||||
-rw-r--r-- | testhal/STM32F30x/PWM-ICU/mcuconf.h | 6 | ||||
-rw-r--r-- | testhal/STM32F30x/PWM-ICU/readme.txt | 2 |
4 files changed, 16 insertions, 16 deletions
diff --git a/testhal/STM32F30x/PWM-ICU/.project b/testhal/STM32F30x/PWM-ICU/.project index 6d36832e8..d8190d4c4 100644 --- a/testhal/STM32F30x/PWM-ICU/.project +++ b/testhal/STM32F30x/PWM-ICU/.project @@ -27,7 +27,7 @@ <link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32F3_DISCOVERY</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32F3_DISCOVERY</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F30x/PWM-ICU/main.c b/testhal/STM32F30x/PWM-ICU/main.c index 4d7c3afd0..96444baef 100644 --- a/testhal/STM32F30x/PWM-ICU/main.c +++ b/testhal/STM32F30x/PWM-ICU/main.c @@ -83,13 +83,13 @@ int main(void) { chSysInit();
/*
- * Initializes the PWM driver 2 and ICU driver 3.
- * GPIOA15 is the PWM output.
- * GPIOC6 is the ICU input.
+ * Initializes the PWM driver 4 and ICU driver 3.
+ * GPIOD12 is the PWM output channel 0.
+ * GPIOC6 is the ICU input ICU_CHANNEL_1.
* The two pins have to be externally connected together.
*/
- pwmStart(&PWMD2, &pwmcfg);
- palSetPadMode(GPIOA, 15, PAL_MODE_ALTERNATE(1));
+ pwmStart(&PWMD4, &pwmcfg);
+ palSetPadMode(GPIOD, 12, PAL_MODE_ALTERNATE(2));
icuStart(&ICUD3, &icucfg);
palSetPadMode(GPIOC, 6, PAL_MODE_ALTERNATE(2));
icuEnable(&ICUD3);
@@ -98,33 +98,33 @@ int main(void) { /*
* Starts the PWM channel 0 using 75% duty cycle.
*/
- pwmEnableChannel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 7500));
+ pwmEnableChannel(&PWMD4, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD4, 7500));
chThdSleepMilliseconds(5000);
/*
* Changes the PWM channel 0 to 50% duty cycle.
*/
- pwmEnableChannel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 5000));
+ pwmEnableChannel(&PWMD4, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD4, 5000));
chThdSleepMilliseconds(5000);
/*
* Changes the PWM channel 0 to 25% duty cycle.
*/
- pwmEnableChannel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 2500));
+ pwmEnableChannel(&PWMD4, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD4, 2500));
chThdSleepMilliseconds(5000);
/*
* Changes PWM period to half second the duty cycle becomes 50%
* implicitly.
*/
- pwmChangePeriod(&PWMD2, 5000);
+ pwmChangePeriod(&PWMD4, 5000);
chThdSleepMilliseconds(5000);
/*
* Disables channel 0 and stops the drivers.
*/
- pwmDisableChannel(&PWMD2, 0);
- pwmStop(&PWMD2);
+ pwmDisableChannel(&PWMD4, 0);
+ pwmStop(&PWMD4);
icuDisable(&ICUD3);
icuStop(&ICUD3);
palClearPad(GPIOE, GPIOE_LED4_BLUE);
diff --git a/testhal/STM32F30x/PWM-ICU/mcuconf.h b/testhal/STM32F30x/PWM-ICU/mcuconf.h index bff25a4c6..a5dca256c 100644 --- a/testhal/STM32F30x/PWM-ICU/mcuconf.h +++ b/testhal/STM32F30x/PWM-ICU/mcuconf.h @@ -139,7 +139,7 @@ #define STM32_ICU_USE_TIM1 TRUE
#define STM32_ICU_USE_TIM2 FALSE
#define STM32_ICU_USE_TIM3 TRUE
-#define STM32_ICU_USE_TIM4 TRUE
+#define STM32_ICU_USE_TIM4 FALSE
#define STM32_ICU_USE_TIM8 TRUE
#define STM32_ICU_TIM1_IRQ_PRIORITY 7
#define STM32_ICU_TIM2_IRQ_PRIORITY 7
@@ -152,9 +152,9 @@ */
#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
-#define STM32_PWM_USE_TIM2 TRUE
+#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
-#define STM32_PWM_USE_TIM4 FALSE
+#define STM32_PWM_USE_TIM4 TRUE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY 7
#define STM32_PWM_TIM2_IRQ_PRIORITY 7
diff --git a/testhal/STM32F30x/PWM-ICU/readme.txt b/testhal/STM32F30x/PWM-ICU/readme.txt index cfb53f76a..bf4069267 100644 --- a/testhal/STM32F30x/PWM-ICU/readme.txt +++ b/testhal/STM32F30x/PWM-ICU/readme.txt @@ -12,7 +12,7 @@ The application demonstrates the use of the STM32F30x PWM-ICU drivers. ** Board Setup **
-- Connect PA15 and PC6 together.
+- Connect PD12 (PWM output) and PC6 (ICU input) together.
** Build Procedure **
|