From 821ed0be6d4508c738a02f50e1a04a41ddb934fd Mon Sep 17 00:00:00 2001 From: Ned Konz Date: Wed, 4 Dec 2024 14:30:19 -0800 Subject: [PATCH] Modernize tim1_complementary_outputs example I realized that there were now Arduino-style #defines for the PINs. This commit changes the pin initialization in my example to use them. --- .../tim1_pwm_complementary_outputs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/tim1_pwm_complementary_outputs/tim1_pwm_complementary_outputs.c b/examples/tim1_pwm_complementary_outputs/tim1_pwm_complementary_outputs.c index 96c321f3..6969b452 100644 --- a/examples/tim1_pwm_complementary_outputs/tim1_pwm_complementary_outputs.c +++ b/examples/tim1_pwm_complementary_outputs/tim1_pwm_complementary_outputs.c @@ -53,12 +53,10 @@ void t1pwm_init( void ) AFIO->PCFR1 |= AFIO_PCFR1_TIM1_REMAP_PARTIALREMAP1; // PC3 is T1CH1_N, 10MHz Output alt func, push-pull - GPIOC->CFGLR &= ~( 0xf << ( 4 * 3 ) ); - GPIOC->CFGLR |= ( GPIO_Speed_10MHz | GPIO_CNF_OUT_PP_AF ) << ( 4 * 3 ); + funPinMode( PC3, GPIO_Speed_10MHz | GPIO_CNF_OUT_PP_AF ); // PC6 is T1CH1, 10MHz Output alt func, push-pull - GPIOC->CFGLR &= ~( 0xf << ( 4 * 6 ) ); - GPIOC->CFGLR |= ( GPIO_Speed_10MHz | GPIO_CNF_OUT_PP_AF ) << ( 4 * 6 ); + funPinMode( PC6, GPIO_Speed_10MHz | GPIO_CNF_OUT_PP_AF ); // Reset TIM1 to init all regs RCC->APB2PRSTR |= RCC_APB2Periph_TIM1;