Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
AdRainty
rt-thread
提交
94d7bdd0
R
rt-thread
项目概览
AdRainty
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
94d7bdd0
编写于
8月 23, 2019
作者:
T
tangweikang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp][stm32] add drv_encoder.c to stm32f407-atk-explorer
上级
1d4139ab
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
179 addition
and
31 deletion
+179
-31
bsp/stm32/libraries/HAL_Drivers/SConscript
bsp/stm32/libraries/HAL_Drivers/SConscript
+3
-0
bsp/stm32/libraries/HAL_Drivers/drv_encoder.c
bsp/stm32/libraries/HAL_Drivers/drv_encoder.c
+2
-0
bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/.mxproject
...m32/stm32f407-atk-explorer/board/CubeMX_Config/.mxproject
+3
-2
bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/CubeMX_Config.ioc
...32f407-atk-explorer/board/CubeMX_Config/CubeMX_Config.ioc
+39
-28
bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/Inc/stm32f4xx_hal_conf.h
...atk-explorer/board/CubeMX_Config/Inc/stm32f4xx_hal_conf.h
+1
-1
bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/Src/main.c
...m32/stm32f407-atk-explorer/board/CubeMX_Config/Src/main.c
+51
-0
bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/Src/stm32f4xx_hal_msp.c
...-atk-explorer/board/CubeMX_Config/Src/stm32f4xx_hal_msp.c
+68
-0
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
+12
-0
未找到文件。
bsp/stm32/libraries/HAL_Drivers/SConscript
浏览文件 @
94d7bdd0
...
...
@@ -85,6 +85,9 @@ if GetDepend(['BSP_USING_SDIO']):
if
GetDepend
([
'BSP_USING_USBD_FS'
]):
src
+=
[
'drv_usbd_fs.c'
]
if
GetDepend
([
'BSP_USING_ENCODER'
]):
src
+=
[
'drv_encoder.c'
]
src
+=
[
'drv_common.c'
]
path
=
[
cwd
]
...
...
bsp/stm32/libraries/HAL_Drivers/drv_encoder.c
浏览文件 @
94d7bdd0
...
...
@@ -103,6 +103,7 @@ rt_err_t encoder_init(struct rt_encoder_device *encoder)
if
(
HAL_TIM_Encoder_Init
(
tim_handler
,
&
sConfig
)
!=
HAL_OK
)
{
LOG_E
(
"encoder init failed"
);
return
-
RT_ERROR
;
}
...
...
@@ -111,6 +112,7 @@ rt_err_t encoder_init(struct rt_encoder_device *encoder)
if
(
HAL_TIMEx_MasterConfigSynchronization
(
tim_handler
,
&
sMasterConfig
))
{
LOG_E
(
"TIMx master config failed"
);
return
-
RT_ERROR
;
}
...
...
bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/.mxproject
浏览文件 @
94d7bdd0
[PreviousGenFiles]
HeaderPath=E:/workspace/
BspFramework/
rt-thread/bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/Inc
HeaderPath=E:/workspace/rt-thread/bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/Inc
HeaderFiles=stm32f4xx_it.h;stm32f4xx_hal_conf.h;main.h;
SourcePath=E:/workspace/
BspFramework/
rt-thread/bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/Src
SourcePath=E:/workspace/rt-thread/bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/Src
SourceFiles=stm32f4xx_it.c;stm32f4xx_hal_msp.c;main.c;
[PreviousLibFiles]
...
...
@@ -10,4 +10,5 @@ LibFiles=Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc.h;Drivers/STM32F4xx_
[PreviousUsedKeilFiles]
SourceFiles=..\Src\main.c;..\Src\stm32f4xx_it.c;..\Src\stm32f4xx_hal_msp.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_eth.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_iwdg.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;../\Src/system_stm32f4xx.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_eth.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_iwdg.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;../\Src/system_stm32f4xx.c;../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;null;
HeaderPath=..\Drivers\STM32F4xx_HAL_Driver\Inc;..\Drivers\STM32F4xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F4xx\Include;..\Drivers\CMSIS\Include;..\Inc;
CDefines=USE_HAL_DRIVER;STM32F407xx;USE_HAL_DRIVER;STM32F407xx;
bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/CubeMX_Config.ioc
浏览文件 @
94d7bdd0
...
...
@@ -13,11 +13,12 @@ Mcu.Family=STM32F4
Mcu.IP0=ADC1
Mcu.IP1=ETH
Mcu.IP10=TIM2
Mcu.IP11=TIM11
Mcu.IP12=TIM13
Mcu.IP13=TIM14
Mcu.IP14=USART1
Mcu.IP15=USART3
Mcu.IP11=TIM4
Mcu.IP12=TIM11
Mcu.IP13=TIM13
Mcu.IP14=TIM14
Mcu.IP15=USART1
Mcu.IP16=USART3
Mcu.IP2=IWDG
Mcu.IP3=NVIC
Mcu.IP4=RCC
...
...
@@ -26,7 +27,7 @@ Mcu.IP6=SDIO
Mcu.IP7=SPI1
Mcu.IP8=SPI2
Mcu.IP9=SYS
Mcu.IPNb=1
6
Mcu.IPNb=1
7
Mcu.Name=STM32F407Z(E-G)Tx
Mcu.Package=LQFP144
Mcu.Pin0=PC14-OSC32_IN
...
...
@@ -56,37 +57,39 @@ Mcu.Pin3=PH1-OSC_OUT
Mcu.Pin30=PB3
Mcu.Pin31=PB4
Mcu.Pin32=PB5
Mcu.Pin33=
VP_IWDG_VS_IWDG
Mcu.Pin34=
VP_RTC_VS_RTC_Activate
Mcu.Pin35=VP_
SYS_VS_Systick
Mcu.Pin36=VP_
TIM2_VS_ClockSourceINT
Mcu.Pin37=VP_
TIM11_VS_ClockSourceINT
Mcu.Pin38=VP_TIM
13
_VS_ClockSourceINT
Mcu.Pin39=VP_TIM1
4
_VS_ClockSourceINT
Mcu.Pin33=
PB6
Mcu.Pin34=
PB7
Mcu.Pin35=VP_
IWDG_VS_IWDG
Mcu.Pin36=VP_
RTC_VS_RTC_Activate
Mcu.Pin37=VP_
SYS_VS_Systick
Mcu.Pin38=VP_TIM
2
_VS_ClockSourceINT
Mcu.Pin39=VP_TIM1
1
_VS_ClockSourceINT
Mcu.Pin4=PC1
Mcu.Pin40=VP_TIM13_VS_ClockSourceINT
Mcu.Pin41=VP_TIM14_VS_ClockSourceINT
Mcu.Pin5=PC2
Mcu.Pin6=PC3
Mcu.Pin7=PA1
Mcu.Pin8=PA2
Mcu.Pin9=PA3
Mcu.PinsNb=4
0
Mcu.PinsNb=4
2
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F407ZGTx
MxCube.Version=5.0.0
MxDb.Version=DB.5.0.0
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false
\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false
\:false
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false
\:false
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false
\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false
\:false
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false
\:false
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SPI1_IRQn=true\:0\:0\:false\:false\:true\:true
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.SPI1_IRQn=true\:0\:0\:false\:false\:true\:true
\:true
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false
\:false
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false
\:true
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true
\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false
\:false
PA1.Mode=RMII
PA1.Signal=ETH_REF_CLK
PA10.Mode=Asynchronous
...
...
@@ -119,6 +122,10 @@ PB4.Signal=SPI1_MISO
PB5.Locked=true
PB5.Mode=Full_Duplex_Master
PB5.Signal=SPI1_MOSI
PB6.Locked=true
PB6.Signal=S_TIM4_CH1
PB7.Locked=true
PB7.Signal=S_TIM4_CH2
PC1.Mode=RMII
PC1.Signal=ETH_MDC
PC10.Mode=SD_4_bits_Wide_bus
...
...
@@ -167,7 +174,7 @@ PH0-OSC_IN.Signal=RCC_OSC_IN
PH1-OSC_OUT.Mode=HSE-External-Oscillator
PH1-OSC_OUT.Signal=RCC_OSC_OUT
PinOutPanel.RotationAngle=0
ProjectManager.AskForMigrate=
tru
e
ProjectManager.AskForMigrate=
fals
e
ProjectManager.BackupPrevious=false
ProjectManager.CompilerOptimize=6
ProjectManager.ComputerToolchain=false
...
...
@@ -181,7 +188,7 @@ ProjectManager.FreePins=false
ProjectManager.HalAssertFull=false
ProjectManager.HeapSize=0x200
ProjectManager.KeepUserCode=true
ProjectManager.LastFirmware=
fals
e
ProjectManager.LastFirmware=
tru
e
ProjectManager.LibraryCopy=0
ProjectManager.MainLocation=Src
ProjectManager.NoMain=false
...
...
@@ -193,7 +200,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=MDK-ARM V5
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_SPI1_Init-SPI1-false-HAL-true,5-MX_ETH_Init-ETH-false-HAL-true,6-MX_USART3_UART_Init-USART3-false-HAL-true,7-MX_ADC1_Init-ADC1-false-HAL-true,8-MX_RTC_Init-RTC-false-HAL-true,9-MX_IWDG_Init-IWDG-false-HAL-true,10-MX_TIM14_Init-TIM14-false-HAL-true,11-MX_TIM13_Init-TIM13-false-HAL-true,12-MX_TIM11_Init-TIM11-false-HAL-true,13-MX_SDIO_SD_Init-SDIO-false-HAL-true,14-MX_TIM2_Init-TIM2-false-HAL-true,15-MX_SPI2_Init-SPI2-false-HAL-true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_SPI1_Init-SPI1-false-HAL-true,5-MX_ETH_Init-ETH-false-HAL-true,6-MX_USART3_UART_Init-USART3-false-HAL-true,7-MX_ADC1_Init-ADC1-false-HAL-true,8-MX_RTC_Init-RTC-false-HAL-true,9-MX_IWDG_Init-IWDG-false-HAL-true,10-MX_TIM14_Init-TIM14-false-HAL-true,11-MX_TIM13_Init-TIM13-false-HAL-true,12-MX_TIM11_Init-TIM11-false-HAL-true,13-MX_SDIO_SD_Init-SDIO-false-HAL-true,14-MX_TIM2_Init-TIM2-false-HAL-true,15-MX_SPI2_Init-SPI2-false-HAL-true
,16-MX_TIM4_Init-TIM4-false-HAL-true
RCC.48MHZClocksFreq_Value=48000000
RCC.AHBFreq_Value=168000000
RCC.APB1CLKDivider=RCC_HCLK_DIV4
...
...
@@ -233,6 +240,10 @@ SH.ADCx_IN5.0=ADC1_IN5,IN5
SH.ADCx_IN5.ConfNb=1
SH.S_TIM2_CH4.0=TIM2_CH4,PWM Generation4 CH4
SH.S_TIM2_CH4.ConfNb=1
SH.S_TIM4_CH1.0=TIM4_CH1,Encoder_Interface
SH.S_TIM4_CH1.ConfNb=1
SH.S_TIM4_CH2.0=TIM4_CH2,Encoder_Interface
SH.S_TIM4_CH2.ConfNb=1
SPI1.CalculateBaudRate=42.0 MBits/s
SPI1.Direction=SPI_DIRECTION_2LINES
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
...
...
bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/Inc/stm32f4xx_hal_conf.h
浏览文件 @
94d7bdd0
...
...
@@ -5,7 +5,7 @@
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 201
8
STMicroelectronics</center></h2>
* <h2><center>© COPYRIGHT(c) 201
9
STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
...
...
bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/Src/main.c
浏览文件 @
94d7bdd0
...
...
@@ -76,6 +76,7 @@ SPI_HandleTypeDef hspi1;
SPI_HandleTypeDef
hspi2
;
TIM_HandleTypeDef
htim2
;
TIM_HandleTypeDef
htim4
;
TIM_HandleTypeDef
htim11
;
TIM_HandleTypeDef
htim13
;
TIM_HandleTypeDef
htim14
;
...
...
@@ -104,6 +105,7 @@ static void MX_TIM11_Init(void);
static
void
MX_SDIO_SD_Init
(
void
);
static
void
MX_TIM2_Init
(
void
);
static
void
MX_SPI2_Init
(
void
);
static
void
MX_TIM4_Init
(
void
);
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
...
...
@@ -155,6 +157,7 @@ int main(void)
MX_SDIO_SD_Init
();
MX_TIM2_Init
();
MX_SPI2_Init
();
MX_TIM4_Init
();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
...
...
@@ -551,6 +554,54 @@ static void MX_TIM2_Init(void)
}
/**
* @brief TIM4 Initialization Function
* @param None
* @retval None
*/
static
void
MX_TIM4_Init
(
void
)
{
/* USER CODE BEGIN TIM4_Init 0 */
/* USER CODE END TIM4_Init 0 */
TIM_Encoder_InitTypeDef
sConfig
=
{
0
};
TIM_MasterConfigTypeDef
sMasterConfig
=
{
0
};
/* USER CODE BEGIN TIM4_Init 1 */
/* USER CODE END TIM4_Init 1 */
htim4
.
Instance
=
TIM4
;
htim4
.
Init
.
Prescaler
=
0
;
htim4
.
Init
.
CounterMode
=
TIM_COUNTERMODE_UP
;
htim4
.
Init
.
Period
=
0
;
htim4
.
Init
.
ClockDivision
=
TIM_CLOCKDIVISION_DIV1
;
sConfig
.
EncoderMode
=
TIM_ENCODERMODE_TI1
;
sConfig
.
IC1Polarity
=
TIM_ICPOLARITY_RISING
;
sConfig
.
IC1Selection
=
TIM_ICSELECTION_DIRECTTI
;
sConfig
.
IC1Prescaler
=
TIM_ICPSC_DIV1
;
sConfig
.
IC1Filter
=
0
;
sConfig
.
IC2Polarity
=
TIM_ICPOLARITY_RISING
;
sConfig
.
IC2Selection
=
TIM_ICSELECTION_DIRECTTI
;
sConfig
.
IC2Prescaler
=
TIM_ICPSC_DIV1
;
sConfig
.
IC2Filter
=
0
;
if
(
HAL_TIM_Encoder_Init
(
&
htim4
,
&
sConfig
)
!=
HAL_OK
)
{
Error_Handler
();
}
sMasterConfig
.
MasterOutputTrigger
=
TIM_TRGO_RESET
;
sMasterConfig
.
MasterSlaveMode
=
TIM_MASTERSLAVEMODE_DISABLE
;
if
(
HAL_TIMEx_MasterConfigSynchronization
(
&
htim4
,
&
sMasterConfig
)
!=
HAL_OK
)
{
Error_Handler
();
}
/* USER CODE BEGIN TIM4_Init 2 */
/* USER CODE END TIM4_Init 2 */
}
/**
* @brief TIM11 Initialization Function
* @param None
...
...
bsp/stm32/stm32f407-atk-explorer/board/CubeMX_Config/Src/stm32f4xx_hal_msp.c
浏览文件 @
94d7bdd0
...
...
@@ -585,6 +585,43 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
}
/**
* @brief TIM_Encoder MSP Initialization
* This function configures the hardware resources used in this example
* @param htim_encoder: TIM_Encoder handle pointer
* @retval None
*/
void
HAL_TIM_Encoder_MspInit
(
TIM_HandleTypeDef
*
htim_encoder
)
{
GPIO_InitTypeDef
GPIO_InitStruct
=
{
0
};
if
(
htim_encoder
->
Instance
==
TIM4
)
{
/* USER CODE BEGIN TIM4_MspInit 0 */
/* USER CODE END TIM4_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_TIM4_CLK_ENABLE
();
__HAL_RCC_GPIOB_CLK_ENABLE
();
/**TIM4 GPIO Configuration
PB6 ------> TIM4_CH1
PB7 ------> TIM4_CH2
*/
GPIO_InitStruct
.
Pin
=
GPIO_PIN_6
|
GPIO_PIN_7
;
GPIO_InitStruct
.
Mode
=
GPIO_MODE_AF_PP
;
GPIO_InitStruct
.
Pull
=
GPIO_NOPULL
;
GPIO_InitStruct
.
Speed
=
GPIO_SPEED_FREQ_LOW
;
GPIO_InitStruct
.
Alternate
=
GPIO_AF2_TIM4
;
HAL_GPIO_Init
(
GPIOB
,
&
GPIO_InitStruct
);
/* USER CODE BEGIN TIM4_MspInit 1 */
/* USER CODE END TIM4_MspInit 1 */
}
}
void
HAL_TIM_MspPostInit
(
TIM_HandleTypeDef
*
htim
)
{
...
...
@@ -669,6 +706,37 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
}
/**
* @brief TIM_Encoder MSP De-Initialization
* This function freeze the hardware resources used in this example
* @param htim_encoder: TIM_Encoder handle pointer
* @retval None
*/
void
HAL_TIM_Encoder_MspDeInit
(
TIM_HandleTypeDef
*
htim_encoder
)
{
if
(
htim_encoder
->
Instance
==
TIM4
)
{
/* USER CODE BEGIN TIM4_MspDeInit 0 */
/* USER CODE END TIM4_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM4_CLK_DISABLE
();
/**TIM4 GPIO Configuration
PB6 ------> TIM4_CH1
PB7 ------> TIM4_CH2
*/
HAL_GPIO_DeInit
(
GPIOB
,
GPIO_PIN_6
|
GPIO_PIN_7
);
/* USER CODE BEGIN TIM4_MspDeInit 1 */
/* USER CODE END TIM4_MspDeInit 1 */
}
}
/**
* @brief UART MSP Initialization
* This function configures the hardware resources used in this example
...
...
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
浏览文件 @
94d7bdd0
...
...
@@ -293,6 +293,18 @@ menu "On-chip Peripheral Drivers"
select RT_USING_SDIO
select RT_USING_DFS
default n
menuconfig BSP_USING_ENCODER
bool "Enable Encoder"
default n
select RT_USING_ENCODER
if BSP_USING_ENCODER
config BSP_USING_ENCODER4
bool "Enable Encoder4"
default n
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录