Shota Asao
/
RobotEx_Test01
hoaaaaaaaaaaaaa
EncoderMspInitF7.cpp@0:1e31c3d92e90, 2017-12-21 (annotated)
- Committer:
- Jecours
- Date:
- Thu Dec 21 04:16:17 2017 +0000
- Revision:
- 0:1e31c3d92e90
mbed otita;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jecours | 0:1e31c3d92e90 | 1 | #include "mbed.h" |
Jecours | 0:1e31c3d92e90 | 2 | |
Jecours | 0:1e31c3d92e90 | 3 | /* |
Jecours | 0:1e31c3d92e90 | 4 | TIM1_CH1: PA8 |
Jecours | 0:1e31c3d92e90 | 5 | TIM1_CH2: PA9 |
Jecours | 0:1e31c3d92e90 | 6 | TIM2_CH1: PA5 |
Jecours | 0:1e31c3d92e90 | 7 | TIM2_CH2: PB3 |
Jecours | 0:1e31c3d92e90 | 8 | TIM3_CH1: PB4 |
Jecours | 0:1e31c3d92e90 | 9 | TIM3_CH2: PB5 |
Jecours | 0:1e31c3d92e90 | 10 | TIM4_CH1: PB6 |
Jecours | 0:1e31c3d92e90 | 11 | TIM4_CH2: PB7 |
Jecours | 0:1e31c3d92e90 | 12 | TIM8_CH1: PC6 |
Jecours | 0:1e31c3d92e90 | 13 | TIM8_CH2: PC7 |
Jecours | 0:1e31c3d92e90 | 14 | |
Jecours | 0:1e31c3d92e90 | 15 | */ |
Jecours | 0:1e31c3d92e90 | 16 | |
Jecours | 0:1e31c3d92e90 | 17 | void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim) |
Jecours | 0:1e31c3d92e90 | 18 | { |
Jecours | 0:1e31c3d92e90 | 19 | GPIO_InitTypeDef GPIO_InitStruct; |
Jecours | 0:1e31c3d92e90 | 20 | |
Jecours | 0:1e31c3d92e90 | 21 | if(htim->Instance == TIM1){ |
Jecours | 0:1e31c3d92e90 | 22 | __TIM1_CLK_ENABLE(); |
Jecours | 0:1e31c3d92e90 | 23 | __GPIOA_CLK_ENABLE(); |
Jecours | 0:1e31c3d92e90 | 24 | GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9; |
Jecours | 0:1e31c3d92e90 | 25 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; |
Jecours | 0:1e31c3d92e90 | 26 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; |
Jecours | 0:1e31c3d92e90 | 27 | GPIO_InitStruct.Alternate = GPIO_AF1_TIM1; |
Jecours | 0:1e31c3d92e90 | 28 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
Jecours | 0:1e31c3d92e90 | 29 | } |
Jecours | 0:1e31c3d92e90 | 30 | } |