hoaaaaaaaaaaaaa

Dependencies:   mbed

EncoderMspInitF7.cpp

Committer:
Jecours
Date:
2017-12-21
Revision:
0:1e31c3d92e90

File content as of revision 0:1e31c3d92e90:

#include "mbed.h"

/*
 TIM1_CH1: PA8
 TIM1_CH2: PA9
 TIM2_CH1: PA5
 TIM2_CH2: PB3
 TIM3_CH1: PB4
 TIM3_CH2: PB5
 TIM4_CH1: PB6
 TIM4_CH2: PB7
 TIM8_CH1: PC6
 TIM8_CH2: PC7

*/

void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim)
{
    GPIO_InitTypeDef GPIO_InitStruct;
    
    if(htim->Instance == TIM1){
        __TIM1_CLK_ENABLE();
        __GPIOA_CLK_ENABLE();
        GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
        GPIO_InitStruct.Speed =  GPIO_SPEED_FREQ_VERY_HIGH;
        GPIO_InitStruct.Alternate = GPIO_AF1_TIM1;
        HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
    }
}