AnsweredAssumed Answered

STM32 F4 Hal libraries GPIO PIN alternate function

Question asked by musyafani on Sep 21, 2015
Latest reply on Sep 29, 2015 by musyafani
how to configure GPIO PIN alternate function in hal driver ?

in std_periph driver i usually used this code:
    GPIO_PinAFConfig(GPIOB, GPIO_PinSource14, GPIO_AF_TIM12);   //TIM2_CH1
    GPIO_PinAFConfig(GPIOB, GPIO_PinSource15, GPIO_AF_TIM12);    //TIM2_CH2

how to configure in Hal driver, can you help me about this code :

// GPIO TypeDef Initialization
  GPIO_TypeDef GPIO_TypeDefStruct;
 /* // No se para que mierda es esto si uso PWM
  GPIO_TypeDefStruct.MODER |= ((31<<1)|(29<<1)|(27<<1)|(25<<1));
                                 GPIO_OSPEEDER_OSPEEDR13_1 | GPIO_OSPEEDER_OSPEEDR_12_1);
  GPIO_TypeDefStruct.AFR[1] |=(28<<GPIO_AF2_TIM4|24<<GPIO_AF2_TIM4|20<<GPIO_AF2_TIM4|16<<GPIO_AF2_TIM4);
  GPIO_TypeDef* GPIO_D = & GPIO_TypeDefStruct;