Skip to content

Commit

Permalink
Merge pull request #470 from bikeNomad/modernize-tim1_pwm_complementa…
Browse files Browse the repository at this point in the history
…ry_outputs-example

Modernize tim1_complementary_outputs example
  • Loading branch information
cnlohr authored Dec 4, 2024
2 parents 885e227 + 821ed0b commit f10fda0
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f10fda0

Please sign in to comment.