all
This commit is contained in:
parent
4b5e25f05e
commit
fbfbcfde44
@ -52,7 +52,7 @@ void MemManage_Handler(void);
|
||||
void BusFault_Handler(void);
|
||||
void UsageFault_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void TIM2_IRQHandler(void);
|
||||
void TIM3_IRQHandler(void);
|
||||
void SPI1_IRQHandler(void);
|
||||
void DMA2_Stream0_IRQHandler(void);
|
||||
void DMA2_Stream3_IRQHandler(void);
|
||||
|
||||
803
Core/Src/main.c
803
Core/Src/main.c
File diff suppressed because it is too large
Load Diff
@ -327,14 +327,14 @@ void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef* htim_encoder)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM_Base MSP Initialization
|
||||
* @brief TIM_PWM MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param htim_base: TIM_Base handle pointer
|
||||
* @param htim_pwm: TIM_PWM handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
|
||||
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* htim_pwm)
|
||||
{
|
||||
if(htim_base->Instance==TIM5)
|
||||
if(htim_pwm->Instance==TIM5)
|
||||
{
|
||||
/* USER CODE BEGIN TIM5_MspInit 0 */
|
||||
|
||||
@ -426,14 +426,14 @@ void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef* htim_encoder)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM_Base MSP De-Initialization
|
||||
* @brief TIM_PWM MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param htim_base: TIM_Base handle pointer
|
||||
* @param htim_pwm: TIM_PWM handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
||||
void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* htim_pwm)
|
||||
{
|
||||
if(htim_base->Instance==TIM5)
|
||||
if(htim_pwm->Instance==TIM5)
|
||||
{
|
||||
/* USER CODE BEGIN TIM5_MspDeInit 0 */
|
||||
|
||||
|
||||
@ -25,12 +25,12 @@
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
TIM_HandleTypeDef htim2;
|
||||
TIM_HandleTypeDef htim3;
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief This function configures the TIM2 as a time base source.
|
||||
* @brief This function configures the TIM3 as a time base source.
|
||||
* The time source is configured to have 1ms time base with a dedicated
|
||||
* Tick interrupt priority.
|
||||
* @note This function is called automatically at the beginning of program after
|
||||
@ -48,15 +48,15 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
|
||||
HAL_StatusTypeDef status;
|
||||
|
||||
/* Enable TIM2 clock */
|
||||
__HAL_RCC_TIM2_CLK_ENABLE();
|
||||
/* Enable TIM3 clock */
|
||||
__HAL_RCC_TIM3_CLK_ENABLE();
|
||||
|
||||
/* Get clock configuration */
|
||||
HAL_RCC_GetClockConfig(&clkconfig, &pFLatency);
|
||||
|
||||
/* Get APB1 prescaler */
|
||||
uwAPB1Prescaler = clkconfig.APB1CLKDivider;
|
||||
/* Compute TIM2 clock */
|
||||
/* Compute TIM3 clock */
|
||||
if (uwAPB1Prescaler == RCC_HCLK_DIV1)
|
||||
{
|
||||
uwTimclock = HAL_RCC_GetPCLK1Freq();
|
||||
@ -66,38 +66,38 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
uwTimclock = 2UL * HAL_RCC_GetPCLK1Freq();
|
||||
}
|
||||
|
||||
/* Compute the prescaler value to have TIM2 counter clock equal to 1MHz */
|
||||
/* Compute the prescaler value to have TIM3 counter clock equal to 1MHz */
|
||||
uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000U) - 1U);
|
||||
|
||||
/* Initialize TIM2 */
|
||||
htim2.Instance = TIM2;
|
||||
/* Initialize TIM3 */
|
||||
htim3.Instance = TIM3;
|
||||
|
||||
/* Initialize TIMx peripheral as follow:
|
||||
* Period = [(TIM2CLK/1000) - 1]. to have a (1/1000) s time base.
|
||||
* Period = [(TIM3CLK/1000) - 1]. to have a (1/1000) s time base.
|
||||
* Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock.
|
||||
* ClockDivision = 0
|
||||
* Counter direction = Up
|
||||
*/
|
||||
htim2.Init.Period = (1000000U / 1000U) - 1U;
|
||||
htim2.Init.Prescaler = uwPrescalerValue;
|
||||
htim2.Init.ClockDivision = 0;
|
||||
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
htim3.Init.Period = (1000000U / 1000U) - 1U;
|
||||
htim3.Init.Prescaler = uwPrescalerValue;
|
||||
htim3.Init.ClockDivision = 0;
|
||||
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
|
||||
status = HAL_TIM_Base_Init(&htim2);
|
||||
status = HAL_TIM_Base_Init(&htim3);
|
||||
if (status == HAL_OK)
|
||||
{
|
||||
/* Start the TIM time Base generation in interrupt mode */
|
||||
status = HAL_TIM_Base_Start_IT(&htim2);
|
||||
status = HAL_TIM_Base_Start_IT(&htim3);
|
||||
if (status == HAL_OK)
|
||||
{
|
||||
/* Enable the TIM2 global Interrupt */
|
||||
HAL_NVIC_EnableIRQ(TIM2_IRQn);
|
||||
/* Enable the TIM3 global Interrupt */
|
||||
HAL_NVIC_EnableIRQ(TIM3_IRQn);
|
||||
/* Configure the SysTick IRQ priority */
|
||||
if (TickPriority < (1UL << __NVIC_PRIO_BITS))
|
||||
{
|
||||
/* Configure the TIM IRQ priority */
|
||||
HAL_NVIC_SetPriority(TIM2_IRQn, TickPriority, 0U);
|
||||
HAL_NVIC_SetPriority(TIM3_IRQn, TickPriority, 0U);
|
||||
uwTickPrio = TickPriority;
|
||||
}
|
||||
else
|
||||
@ -113,25 +113,25 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
|
||||
/**
|
||||
* @brief Suspend Tick increment.
|
||||
* @note Disable the tick increment by disabling TIM2 update interrupt.
|
||||
* @note Disable the tick increment by disabling TIM3 update interrupt.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_SuspendTick(void)
|
||||
{
|
||||
/* Disable TIM2 update Interrupt */
|
||||
__HAL_TIM_DISABLE_IT(&htim2, TIM_IT_UPDATE);
|
||||
/* Disable TIM3 update Interrupt */
|
||||
__HAL_TIM_DISABLE_IT(&htim3, TIM_IT_UPDATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resume Tick increment.
|
||||
* @note Enable the tick increment by Enabling TIM2 update interrupt.
|
||||
* @note Enable the tick increment by Enabling TIM3 update interrupt.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ResumeTick(void)
|
||||
{
|
||||
/* Enable TIM2 Update interrupt */
|
||||
__HAL_TIM_ENABLE_IT(&htim2, TIM_IT_UPDATE);
|
||||
/* Enable TIM3 Update interrupt */
|
||||
__HAL_TIM_ENABLE_IT(&htim3, TIM_IT_UPDATE);
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ extern DMA_HandleTypeDef hdma_spi1_rx;
|
||||
extern DMA_HandleTypeDef hdma_spi1_tx;
|
||||
extern SPI_HandleTypeDef hspi1;
|
||||
extern UART_HandleTypeDef huart6;
|
||||
extern TIM_HandleTypeDef htim2;
|
||||
extern TIM_HandleTypeDef htim3;
|
||||
|
||||
/* USER CODE BEGIN EV */
|
||||
|
||||
@ -163,17 +163,17 @@ void DebugMon_Handler(void)
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles TIM2 global interrupt.
|
||||
* @brief This function handles TIM3 global interrupt.
|
||||
*/
|
||||
void TIM2_IRQHandler(void)
|
||||
void TIM3_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN TIM2_IRQn 0 */
|
||||
/* USER CODE BEGIN TIM3_IRQn 0 */
|
||||
|
||||
/* USER CODE END TIM2_IRQn 0 */
|
||||
HAL_TIM_IRQHandler(&htim2);
|
||||
/* USER CODE BEGIN TIM2_IRQn 1 */
|
||||
/* USER CODE END TIM3_IRQn 0 */
|
||||
HAL_TIM_IRQHandler(&htim3);
|
||||
/* USER CODE BEGIN TIM3_IRQn 1 */
|
||||
|
||||
/* USER CODE END TIM2_IRQn 1 */
|
||||
/* USER CODE END TIM3_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -228,7 +228,7 @@ void USART6_IRQHandler(void)
|
||||
/* USER CODE END USART6_IRQn 0 */
|
||||
HAL_UART_IRQHandler(&huart6);
|
||||
/* USER CODE BEGIN USART6_IRQn 1 */
|
||||
UART_CALLBACK();
|
||||
//UART_CALLBACK();
|
||||
/* USER CODE END USART6_IRQn 1 */
|
||||
}
|
||||
|
||||
|
||||
44
touchscreengames Debug.cfg
Normal file
44
touchscreengames Debug.cfg
Normal file
@ -0,0 +1,44 @@
|
||||
# This is an genericBoard board with a single STM32F401CCUx chip
|
||||
#
|
||||
# Generated by STM32CubeIDE
|
||||
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
|
||||
|
||||
source [find interface/stlink-dap.cfg]
|
||||
|
||||
|
||||
set WORKAREASIZE 0x8000
|
||||
|
||||
transport select "dapdirect_swd"
|
||||
|
||||
set CHIPNAME STM32F401CCUx
|
||||
set BOARDNAME genericBoard
|
||||
|
||||
# Enable debug when in low power modes
|
||||
set ENABLE_LOW_POWER 1
|
||||
|
||||
# Stop Watchdog counters when halt
|
||||
set STOP_WATCHDOG 1
|
||||
|
||||
# STlink Debug clock frequency
|
||||
set CLOCK_FREQ 8000
|
||||
|
||||
# Reset configuration
|
||||
# use hardware reset, connect under reset
|
||||
# connect_assert_srst needed if low power mode application running (WFI...)
|
||||
reset_config srst_only srst_nogate connect_assert_srst
|
||||
set CONNECT_UNDER_RESET 1
|
||||
set CORE_RESET 0
|
||||
|
||||
# ACCESS PORT NUMBER
|
||||
set AP_NUM 0
|
||||
# GDB PORT
|
||||
set GDB_PORT 3333
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# BCTM CPU variables
|
||||
|
||||
source [find target/stm32f4x.cfg]
|
||||
|
||||
@ -70,8 +70,7 @@ Mcu.Pin21=PB7
|
||||
Mcu.Pin22=PB8
|
||||
Mcu.Pin23=PB9
|
||||
Mcu.Pin24=VP_FREERTOS_VS_CMSIS_V2
|
||||
Mcu.Pin25=VP_SYS_VS_tim2
|
||||
Mcu.Pin26=VP_TIM5_VS_ClockSourceINT
|
||||
Mcu.Pin25=VP_SYS_VS_tim3
|
||||
Mcu.Pin3=PA2
|
||||
Mcu.Pin4=PA3
|
||||
Mcu.Pin5=PA4
|
||||
@ -79,7 +78,7 @@ Mcu.Pin6=PA5
|
||||
Mcu.Pin7=PA6
|
||||
Mcu.Pin8=PA7
|
||||
Mcu.Pin9=PB2
|
||||
Mcu.PinsNb=27
|
||||
Mcu.PinsNb=26
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F401CCUx
|
||||
@ -101,9 +100,9 @@ NVIC.SavedPendsvIrqHandlerGenerated=true
|
||||
NVIC.SavedSvcallIrqHandlerGenerated=true
|
||||
NVIC.SavedSystickIrqHandlerGenerated=true
|
||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:true\:false
|
||||
NVIC.TIM2_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true
|
||||
NVIC.TimeBase=TIM2_IRQn
|
||||
NVIC.TimeBaseIP=TIM2
|
||||
NVIC.TIM3_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true
|
||||
NVIC.TimeBase=TIM3_IRQn
|
||||
NVIC.TimeBaseIP=TIM3
|
||||
NVIC.USART6_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
PA0-WKUP.Signal=S_TIM5_CH1
|
||||
@ -191,7 +190,7 @@ ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_SPI1_Init-SPI1-false-HAL-true,5-MX_SPI2_Init-SPI2-false-HAL-true,5-MX_TIM1_Init-TIM1-false-HAL-true,6-MX_TIM4_Init-TIM4-false-HAL-true,7-MX_TIM5_Init-TIM5-false-HAL-true,8-MX_USART6_UART_Init-USART6-false-HAL-true,9-MX_I2C1_Init-I2C1-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_SPI1_Init-SPI1-false-HAL-true,5-MX_TIM1_Init-TIM1-false-HAL-true,6-MX_TIM4_Init-TIM4-false-HAL-true,7-MX_TIM5_Init-TIM5-false-HAL-true,8-MX_USART6_UART_Init-USART6-false-HAL-true,9-MX_I2C1_Init-I2C1-false-HAL-true
|
||||
RCC.AHBFreq_Value=16000000
|
||||
RCC.APB1Freq_Value=16000000
|
||||
RCC.APB2Freq_Value=16000000
|
||||
@ -234,23 +233,31 @@ SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler
|
||||
SPI1.Mode=SPI_MODE_MASTER
|
||||
SPI1.VirtualType=VM_MASTER
|
||||
TIM1.EncoderMode=TIM_ENCODERMODE_TI12
|
||||
TIM1.IPParameters=EncoderMode
|
||||
TIM1.IC1Filter=15
|
||||
TIM1.IC1Prescaler=TIM_ICPSC_DIV8
|
||||
TIM1.IC2Filter=15
|
||||
TIM1.IC2Prescaler=TIM_ICPSC_DIV8
|
||||
TIM1.IPParameters=EncoderMode,IC1Prescaler,IC2Prescaler,IC2Filter,IC1Filter
|
||||
TIM4.EncoderMode=TIM_ENCODERMODE_TI12
|
||||
TIM4.IPParameters=EncoderMode
|
||||
TIM4.IC1Filter=15
|
||||
TIM4.IC1Prescaler=TIM_ICPSC_DIV8
|
||||
TIM4.IC2Filter=15
|
||||
TIM4.IC2Prescaler=TIM_ICPSC_DIV8
|
||||
TIM4.IPParameters=EncoderMode,IC1Prescaler,IC1Filter,IC2Prescaler,IC2Filter
|
||||
TIM5.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
||||
TIM5.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||
TIM5.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
|
||||
TIM5.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
|
||||
TIM5.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3,Channel-PWM Generation4 CH4
|
||||
TIM5.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3,Channel-PWM Generation4 CH4,Prescaler,Period
|
||||
TIM5.Period=10000
|
||||
TIM5.Prescaler=92
|
||||
USART6.BaudRate=115200
|
||||
USART6.IPParameters=VirtualMode,BaudRate
|
||||
USART6.VirtualMode=VM_ASYNC
|
||||
VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2
|
||||
VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2
|
||||
VP_SYS_VS_tim2.Mode=TIM2
|
||||
VP_SYS_VS_tim2.Signal=SYS_VS_tim2
|
||||
VP_TIM5_VS_ClockSourceINT.Mode=Internal
|
||||
VP_TIM5_VS_ClockSourceINT.Signal=TIM5_VS_ClockSourceINT
|
||||
VP_SYS_VS_tim3.Mode=TIM3
|
||||
VP_SYS_VS_tim3.Signal=SYS_VS_tim3
|
||||
board=custom
|
||||
rtos.0.ip=FREERTOS
|
||||
isbadioc=false
|
||||
|
||||
Loading…
Reference in New Issue
Block a user