diff options
Diffstat (limited to 'testhal/STM32F4xx/PWM-ICU/main.c')
-rw-r--r-- | testhal/STM32F4xx/PWM-ICU/main.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/testhal/STM32F4xx/PWM-ICU/main.c b/testhal/STM32F4xx/PWM-ICU/main.c index 55e9736d2..a964d221e 100644 --- a/testhal/STM32F4xx/PWM-ICU/main.c +++ b/testhal/STM32F4xx/PWM-ICU/main.c @@ -84,12 +84,12 @@ int main(void) { /*
* Initializes the PWM driver 2 and ICU driver 3.
- * GPIOA15 is the PWM output.
+ * GPIOA8 is the PWM output.
* GPIOC6 is the ICU input.
* The two pins have to be externally connected together.
*/
- pwmStart(&PWMD2, &pwmcfg);
- palSetPadMode(GPIOA, 15, PAL_MODE_ALTERNATE(1));
+ pwmStart(&PWMD1, &pwmcfg);
+ palSetPadMode(GPIOA, 8, PAL_MODE_ALTERNATE(1));
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(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 7500));
chThdSleepMilliseconds(5000);
/*
* Changes the PWM channel 0 to 50% duty cycle.
*/
- pwmEnableChannel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 5000));
+ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000));
chThdSleepMilliseconds(5000);
/*
* Changes the PWM channel 0 to 25% duty cycle.
*/
- pwmEnableChannel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 2500));
+ pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 2500));
chThdSleepMilliseconds(5000);
/*
* Changes PWM period to half second the duty cycle becomes 50%
* implicitly.
*/
- pwmChangePeriod(&PWMD2, 5000);
+ pwmChangePeriod(&PWMD1, 5000);
chThdSleepMilliseconds(5000);
/*
* Disables channel 0 and stops the drivers.
*/
- pwmDisableChannel(&PWMD2, 0);
- pwmStop(&PWMD2);
+ pwmDisableChannel(&PWMD1, 0);
+ pwmStop(&PWMD1);
icuDisable(&ICUD3);
icuStop(&ICUD3);
palClearPad(GPIOD, GPIOD_LED4);
|