Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of locate_by_hello_enc by
EncoderMspInitL0.cpp
00001 #include "mbed.h" 00002 /* 00003 * HAL_TIM_Encoder_MspInit() 00004 * Overrides the __weak function stub in stm32f4xx_hal_tim.h 00005 * 00006 * Edit the below for your preferred pin wiring & pullup/down 00007 * I have encoder common at 3V3, using GPIO_PULLDOWN on inputs. 00008 * Encoder A&B outputs connected directly to GPIOs. 00009 * 00010 */ 00011 00012 #ifdef TARGET_STM32L0 00013 void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim) 00014 { 00015 GPIO_InitTypeDef GPIO_InitStruct; 00016 00017 if (htim->Instance == TIM2) { //PA0 PA1 = Nucleo A0 A1 00018 __TIM2_CLK_ENABLE(); 00019 __GPIOA_CLK_ENABLE(); 00020 GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1; 00021 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; 00022 GPIO_InitStruct.Pull = GPIO_PULLDOWN; 00023 GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; 00024 GPIO_InitStruct.Alternate = GPIO_AF1_TIM2; 00025 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); 00026 } 00027 } 00028 #endif
Generated on Sun Jul 17 2022 23:05:29 by
