Trying to fix timing issues
This commit is contained in:
parent
85a95e04b8
commit
6132478e3d
@ -1,4 +1,4 @@
|
|||||||
/* USER CODE BEGIN Header */
|
/* USER CODE BEGIN */
|
||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file : main.h
|
* @file : main.h
|
||||||
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef __MAIN_H
|
#ifndef __MAIN_H
|
||||||
@ -30,31 +30,31 @@ extern "C" {
|
|||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
|
|
||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN ET */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END ET */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN EC */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END EC */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN EM */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END EM */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Exported functions prototypes ---------------------------------------------*/
|
/* Exported functions prototypes ---------------------------------------------*/
|
||||||
void Error_Handler(void);
|
void Error_Handler(void);
|
||||||
|
|
||||||
/* USER CODE BEGIN EFP */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END EFP */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
#define DB10_Pin GPIO_PIN_13
|
#define DB10_Pin GPIO_PIN_13
|
||||||
@ -112,9 +112,9 @@ void Error_Handler(void);
|
|||||||
#define DB12_Pin GPIO_PIN_9
|
#define DB12_Pin GPIO_PIN_9
|
||||||
#define DB12_GPIO_Port GPIOB
|
#define DB12_GPIO_Port GPIOB
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
/* USER CODE END */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* USER CODE BEGIN Header */
|
/* USER CODE BEGIN */
|
||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file stm32f1xx_hal_conf.h
|
* @file stm32f1xx_hal_conf.h
|
||||||
@ -15,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef __STM32F1xx_HAL_CONF_H
|
#ifndef __STM32F1xx_HAL_CONF_H
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* USER CODE BEGIN Header */
|
/* USER CODE BEGIN */
|
||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file : main.c
|
* @file : main.c
|
||||||
@ -15,49 +15,49 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header */
|
/* USER CODE END */
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN PTD */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END PTD */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN PD */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END PD */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
/* Private macro -------------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN PM */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END PM */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
UART_HandleTypeDef huart1;
|
UART_HandleTypeDef huart1;
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END PV */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
void SystemClock_Config(void);
|
void SystemClock_Config(void);
|
||||||
static void MX_GPIO_Init(void);
|
static void MX_GPIO_Init(void);
|
||||||
static void MX_USART1_UART_Init(void);
|
static void MX_USART1_UART_Init(void);
|
||||||
/* USER CODE BEGIN PFP */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private user code ---------------------------------------------------------*/
|
/* Private user code ---------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN 0 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The application entry point.
|
* @brief The application entry point.
|
||||||
@ -66,45 +66,45 @@ static void MX_USART1_UART_Init(void);
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* MCU Configuration--------------------------------------------------------*/
|
/* MCU Configuration--------------------------------------------------------*/
|
||||||
|
|
||||||
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||||
HAL_Init();
|
HAL_Init();
|
||||||
|
|
||||||
/* USER CODE BEGIN Init */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END Init */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Configure the system clock */
|
/* Configure the system clock */
|
||||||
SystemClock_Config();
|
SystemClock_Config();
|
||||||
|
|
||||||
/* USER CODE BEGIN SysInit */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END SysInit */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Initialize all configured peripherals */
|
/* Initialize all configured peripherals */
|
||||||
MX_GPIO_Init();
|
MX_GPIO_Init();
|
||||||
MX_USART1_UART_Init();
|
MX_USART1_UART_Init();
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
/* USER CODE BEGIN WHILE */
|
/* USER CODE BEGIN */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
LCD_Init();
|
LCD_Init();
|
||||||
HAL_Delay(1000);
|
HAL_Delay(1000);
|
||||||
__NOP();
|
__NOP();
|
||||||
/* USER CODE END WHILE */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* USER CODE BEGIN 3 */
|
/* USER CODE BEGIN */
|
||||||
}
|
}
|
||||||
/* USER CODE END 3 */
|
/* USER CODE END */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -153,13 +153,13 @@ void SystemClock_Config(void)
|
|||||||
static void MX_USART1_UART_Init(void)
|
static void MX_USART1_UART_Init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* USER CODE BEGIN USART1_Init 0 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END USART1_Init 0 */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* USER CODE BEGIN USART1_Init 1 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END USART1_Init 1 */
|
/* USER CODE END */
|
||||||
huart1.Instance = USART1;
|
huart1.Instance = USART1;
|
||||||
huart1.Init.BaudRate = 115200;
|
huart1.Init.BaudRate = 115200;
|
||||||
huart1.Init.WordLength = UART_WORDLENGTH_8B;
|
huart1.Init.WordLength = UART_WORDLENGTH_8B;
|
||||||
@ -172,9 +172,9 @@ static void MX_USART1_UART_Init(void)
|
|||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
/* USER CODE BEGIN USART1_Init 2 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END USART1_Init 2 */
|
/* USER CODE END */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,9 +186,9 @@ static void MX_USART1_UART_Init(void)
|
|||||||
static void MX_GPIO_Init(void)
|
static void MX_GPIO_Init(void)
|
||||||
{
|
{
|
||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
/* USER CODE BEGIN MX_GPIO_Init_1 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END MX_GPIO_Init_1 */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* GPIO Ports Clock Enable */
|
/* GPIO Ports Clock Enable */
|
||||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
@ -277,14 +277,14 @@ static void MX_GPIO_Init(void)
|
|||||||
/*Configure peripheral I/O remapping */
|
/*Configure peripheral I/O remapping */
|
||||||
__HAL_AFIO_REMAP_PD01_ENABLE();
|
__HAL_AFIO_REMAP_PD01_ENABLE();
|
||||||
|
|
||||||
/* USER CODE BEGIN MX_GPIO_Init_2 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END MX_GPIO_Init_2 */
|
/* USER CODE END */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN 4 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END 4 */
|
/* USER CODE END */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function is executed in case of error occurrence.
|
* @brief This function is executed in case of error occurrence.
|
||||||
@ -292,13 +292,13 @@ static void MX_GPIO_Init(void)
|
|||||||
*/
|
*/
|
||||||
void Error_Handler(void)
|
void Error_Handler(void)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN Error_Handler_Debug */
|
/* USER CODE BEGIN */
|
||||||
/* User can add his own implementation to report the HAL error return state */
|
/* User can add his own implementation to report the HAL error return state */
|
||||||
__disable_irq();
|
__disable_irq();
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/* USER CODE END Error_Handler_Debug */
|
/* USER CODE END */
|
||||||
}
|
}
|
||||||
#ifdef USE_FULL_ASSERT
|
#ifdef USE_FULL_ASSERT
|
||||||
/**
|
/**
|
||||||
@ -310,9 +310,9 @@ void Error_Handler(void)
|
|||||||
*/
|
*/
|
||||||
void assert_failed(uint8_t *file, uint32_t line)
|
void assert_failed(uint8_t *file, uint32_t line)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN 6 */
|
/* USER CODE BEGIN */
|
||||||
/* User can add his own implementation to report the file name and line number,
|
/* User can add his own implementation to report the file name and line number,
|
||||||
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||||
/* USER CODE END 6 */
|
/* USER CODE END */
|
||||||
}
|
}
|
||||||
#endif /* USE_FULL_ASSERT */
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* USER CODE BEGIN Header */
|
/* USER CODE BEGIN */
|
||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file stm32f1xx_hal_msp.c
|
* @file stm32f1xx_hal_msp.c
|
||||||
@ -16,56 +16,56 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN TD */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END TD */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Define */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END Define */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
/* Private macro -------------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Macro */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END Macro */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END PV */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
/* USER CODE BEGIN PFP */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* External functions --------------------------------------------------------*/
|
/* External functions --------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN ExternalFunctions */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END ExternalFunctions */
|
/* USER CODE END */
|
||||||
|
|
||||||
/* USER CODE BEGIN 0 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END */
|
||||||
/**
|
/**
|
||||||
* Initializes the Global MSP.
|
* Initializes the Global MSP.
|
||||||
*/
|
*/
|
||||||
void HAL_MspInit(void)
|
void HAL_MspInit(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* USER CODE BEGIN MspInit 0 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END MspInit 0 */
|
/* USER CODE END */
|
||||||
|
|
||||||
__HAL_RCC_AFIO_CLK_ENABLE();
|
__HAL_RCC_AFIO_CLK_ENABLE();
|
||||||
__HAL_RCC_PWR_CLK_ENABLE();
|
__HAL_RCC_PWR_CLK_ENABLE();
|
||||||
@ -76,9 +76,9 @@ void HAL_MspInit(void)
|
|||||||
*/
|
*/
|
||||||
__HAL_AFIO_REMAP_SWJ_NOJTAG();
|
__HAL_AFIO_REMAP_SWJ_NOJTAG();
|
||||||
|
|
||||||
/* USER CODE BEGIN MspInit 1 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END MspInit 1 */
|
/* USER CODE END */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,9 +92,9 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
|||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
if(huart->Instance==USART1)
|
if(huart->Instance==USART1)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN USART1_MspInit 0 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END USART1_MspInit 0 */
|
/* USER CODE END */
|
||||||
/* Peripheral clock enable */
|
/* Peripheral clock enable */
|
||||||
__HAL_RCC_USART1_CLK_ENABLE();
|
__HAL_RCC_USART1_CLK_ENABLE();
|
||||||
|
|
||||||
@ -115,9 +115,9 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
|||||||
|
|
||||||
__HAL_AFIO_REMAP_USART1_ENABLE();
|
__HAL_AFIO_REMAP_USART1_ENABLE();
|
||||||
|
|
||||||
/* USER CODE BEGIN USART1_MspInit 1 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END USART1_MspInit 1 */
|
/* USER CODE END */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,9 +133,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
|||||||
{
|
{
|
||||||
if(huart->Instance==USART1)
|
if(huart->Instance==USART1)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN USART1_MspDeInit 0 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END USART1_MspDeInit 0 */
|
/* USER CODE END */
|
||||||
/* Peripheral clock disable */
|
/* Peripheral clock disable */
|
||||||
__HAL_RCC_USART1_CLK_DISABLE();
|
__HAL_RCC_USART1_CLK_DISABLE();
|
||||||
|
|
||||||
@ -145,13 +145,13 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
|||||||
*/
|
*/
|
||||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_7);
|
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_7);
|
||||||
|
|
||||||
/* USER CODE BEGIN USART1_MspDeInit 1 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END USART1_MspDeInit 1 */
|
/* USER CODE END */
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN */
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user