Format
This commit is contained in:
parent
6e55b2fa19
commit
28e812de22
1 changed files with 1053 additions and 1112 deletions
395
Core/Src/main.c
395
Core/Src/main.c
|
@ -97,7 +97,7 @@ static void MX_DAC_Init(void);
|
|||
static void MX_UART7_Init(void);
|
||||
static void MX_FMC_Init(void);
|
||||
static void MX_DMA2D_Init(void);
|
||||
void StartDefaultTask(void const * argument);
|
||||
void StartDefaultTask(void const *argument);
|
||||
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
|
@ -112,13 +112,12 @@ void StartDefaultTask(void const * argument);
|
|||
* @brief The application entry point.
|
||||
* @retval int
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
int main(void) {
|
||||
/* USER CODE BEGIN 1 */
|
||||
char text[50]={};
|
||||
char text[50] = { };
|
||||
static TS_StateTypeDef TS_State;
|
||||
uint32_t potl,potr,joystick_h, joystick_v;
|
||||
ADC_ChannelConfTypeDef sConfig = {0};
|
||||
uint32_t potl, potr, joystick_h, joystick_v;
|
||||
ADC_ChannelConfTypeDef sConfig = { 0 };
|
||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||
/* USER CODE END 1 */
|
||||
|
@ -162,7 +161,8 @@ int main(void)
|
|||
/* USER CODE BEGIN 2 */
|
||||
BSP_LCD_Init();
|
||||
BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
|
||||
BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS+ BSP_LCD_GetXSize()*BSP_LCD_GetYSize()*4);
|
||||
BSP_LCD_LayerDefaultInit(1,
|
||||
LCD_FB_START_ADDRESS + BSP_LCD_GetXSize() * BSP_LCD_GetYSize() * 4);
|
||||
BSP_LCD_DisplayOn();
|
||||
BSP_LCD_SelectLayer(1);
|
||||
BSP_LCD_Clear(LCD_COLOR_LIGHTGREEN);
|
||||
|
@ -201,46 +201,51 @@ int main(void)
|
|||
|
||||
/* Start scheduler */
|
||||
//osKernelStart();
|
||||
|
||||
/* We should never get here as control is now taken by the scheduler */
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
/* Code de base */
|
||||
HAL_GPIO_WritePin(LED13_GPIO_Port,LED13_Pin,HAL_GPIO_ReadPin(BP1_GPIO_Port,BP1_Pin));
|
||||
HAL_GPIO_WritePin(LED14_GPIO_Port,LED14_Pin,HAL_GPIO_ReadPin(BP2_GPIO_Port,BP2_Pin));
|
||||
sprintf(text,"BP1 : %d",HAL_GPIO_ReadPin(BP1_GPIO_Port,BP1_Pin));
|
||||
BSP_LCD_DisplayStringAtLine(5,(uint8_t*) text);
|
||||
HAL_GPIO_WritePin(LED13_GPIO_Port, LED13_Pin,
|
||||
HAL_GPIO_ReadPin(BP1_GPIO_Port, BP1_Pin));
|
||||
HAL_GPIO_WritePin(LED14_GPIO_Port, LED14_Pin,
|
||||
HAL_GPIO_ReadPin(BP2_GPIO_Port, BP2_Pin));
|
||||
sprintf(text, "BP1 : %d", HAL_GPIO_ReadPin(BP1_GPIO_Port, BP1_Pin));
|
||||
BSP_LCD_DisplayStringAtLine(5, (uint8_t*) text);
|
||||
|
||||
sConfig.Channel = ADC_CHANNEL_6;
|
||||
HAL_ADC_ConfigChannel(&hadc3, &sConfig);
|
||||
HAL_ADC_Start(&hadc3);
|
||||
while(HAL_ADC_PollForConversion(&hadc3, 100)!=HAL_OK);
|
||||
while (HAL_ADC_PollForConversion(&hadc3, 100) != HAL_OK)
|
||||
;
|
||||
potr = HAL_ADC_GetValue(&hadc3);
|
||||
|
||||
sConfig.Channel = ADC_CHANNEL_7;
|
||||
HAL_ADC_ConfigChannel(&hadc3, &sConfig);
|
||||
HAL_ADC_Start(&hadc3);
|
||||
while(HAL_ADC_PollForConversion(&hadc3, 100)!=HAL_OK);
|
||||
while (HAL_ADC_PollForConversion(&hadc3, 100) != HAL_OK)
|
||||
;
|
||||
potl = HAL_ADC_GetValue(&hadc3);
|
||||
|
||||
sConfig.Channel = ADC_CHANNEL_8;
|
||||
HAL_ADC_ConfigChannel(&hadc3, &sConfig);
|
||||
HAL_ADC_Start(&hadc3);
|
||||
while(HAL_ADC_PollForConversion(&hadc3, 100)!=HAL_OK);
|
||||
while (HAL_ADC_PollForConversion(&hadc3, 100) != HAL_OK)
|
||||
;
|
||||
joystick_v = HAL_ADC_GetValue(&hadc3);
|
||||
|
||||
HAL_ADC_Start(&hadc1);
|
||||
while(HAL_ADC_PollForConversion(&hadc1, 100)!=HAL_OK);
|
||||
while (HAL_ADC_PollForConversion(&hadc1, 100) != HAL_OK)
|
||||
;
|
||||
joystick_h = HAL_ADC_GetValue(&hadc1);
|
||||
|
||||
sprintf(text,"POTL : %4u POTR : %4u joy_v : %4u joy_h : %4u",(uint)potl,(uint)potr,(uint)joystick_v,(uint)joystick_h);
|
||||
BSP_LCD_DisplayStringAtLine(9,(uint8_t*) text);
|
||||
sprintf(text, "POTL : %4u POTR : %4u joy_v : %4u joy_h : %4u",
|
||||
(uint) potl, (uint) potr, (uint) joystick_v, (uint) joystick_h);
|
||||
BSP_LCD_DisplayStringAtLine(9, (uint8_t*) text);
|
||||
|
||||
BSP_TS_GetState(&TS_State);
|
||||
if(TS_State.touchDetected){
|
||||
BSP_LCD_FillCircle(TS_State.touchX[0],TS_State.touchY[0],4);
|
||||
if (TS_State.touchDetected) {
|
||||
BSP_LCD_FillCircle(TS_State.touchX[0], TS_State.touchY[0], 4);
|
||||
}
|
||||
BSP_LCD_DisplyString(0, "coucou");
|
||||
BSP_LCD_DisplyString(1, "Tu veux voir ma ****");
|
||||
|
@ -256,11 +261,10 @@ int main(void)
|
|||
* @brief System Clock Configuration
|
||||
* @retval None
|
||||
*/
|
||||
void SystemClock_Config(void)
|
||||
{
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
void SystemClock_Config(void) {
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = { 0 };
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = { 0 };
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = { 0 };
|
||||
|
||||
/** Configure LSE Drive Capability
|
||||
*/
|
||||
|
@ -272,7 +276,8 @@ void SystemClock_Config(void)
|
|||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* in the RCC_OscInitTypeDef structure.
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI
|
||||
| RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
|
@ -281,33 +286,29 @@ void SystemClock_Config(void)
|
|||
RCC_OscInitStruct.PLL.PLLN = 400;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 9;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Activate the Over-Drive mode
|
||||
*/
|
||||
if (HAL_PWREx_EnableOverDrive() != HAL_OK)
|
||||
{
|
||||
if (HAL_PWREx_EnableOverDrive() != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
|
||||
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_6) != HAL_OK)
|
||||
{
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_6) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC|RCC_PERIPHCLK_RTC
|
||||
|RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART6
|
||||
|RCC_PERIPHCLK_UART7|RCC_PERIPHCLK_I2C1
|
||||
|RCC_PERIPHCLK_I2C3;
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC
|
||||
| RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART6
|
||||
| RCC_PERIPHCLK_UART7 | RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_I2C3;
|
||||
PeriphClkInitStruct.PLLSAI.PLLSAIN = 384;
|
||||
PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;
|
||||
PeriphClkInitStruct.PLLSAI.PLLSAIQ = 2;
|
||||
|
@ -320,8 +321,7 @@ void SystemClock_Config(void)
|
|||
PeriphClkInitStruct.Uart7ClockSelection = RCC_UART7CLKSOURCE_PCLK1;
|
||||
PeriphClkInitStruct.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1;
|
||||
PeriphClkInitStruct.I2c3ClockSelection = RCC_I2C3CLKSOURCE_PCLK1;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
|
@ -331,14 +331,13 @@ void SystemClock_Config(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_ADC1_Init(void)
|
||||
{
|
||||
static void MX_ADC1_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN ADC1_Init 0 */
|
||||
|
||||
/* USER CODE END ADC1_Init 0 */
|
||||
|
||||
ADC_ChannelConfTypeDef sConfig = {0};
|
||||
ADC_ChannelConfTypeDef sConfig = { 0 };
|
||||
|
||||
/* USER CODE BEGIN ADC1_Init 1 */
|
||||
|
||||
|
@ -357,8 +356,7 @@ static void MX_ADC1_Init(void)
|
|||
hadc1.Init.NbrOfConversion = 1;
|
||||
hadc1.Init.DMAContinuousRequests = DISABLE;
|
||||
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||
if (HAL_ADC_Init(&hadc1) != HAL_OK)
|
||||
{
|
||||
if (HAL_ADC_Init(&hadc1) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
|
||||
|
@ -366,8 +364,7 @@ static void MX_ADC1_Init(void)
|
|||
sConfig.Channel = ADC_CHANNEL_0;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN ADC1_Init 2 */
|
||||
|
@ -381,14 +378,13 @@ static void MX_ADC1_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_ADC3_Init(void)
|
||||
{
|
||||
static void MX_ADC3_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN ADC3_Init 0 */
|
||||
|
||||
/* USER CODE END ADC3_Init 0 */
|
||||
|
||||
ADC_ChannelConfTypeDef sConfig = {0};
|
||||
ADC_ChannelConfTypeDef sConfig = { 0 };
|
||||
|
||||
/* USER CODE BEGIN ADC3_Init 1 */
|
||||
|
||||
|
@ -407,8 +403,7 @@ static void MX_ADC3_Init(void)
|
|||
hadc3.Init.NbrOfConversion = 1;
|
||||
hadc3.Init.DMAContinuousRequests = DISABLE;
|
||||
hadc3.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||
if (HAL_ADC_Init(&hadc3) != HAL_OK)
|
||||
{
|
||||
if (HAL_ADC_Init(&hadc3) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
|
||||
|
@ -416,8 +411,7 @@ static void MX_ADC3_Init(void)
|
|||
sConfig.Channel = ADC_CHANNEL_6;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||
if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN ADC3_Init 2 */
|
||||
|
@ -431,14 +425,13 @@ static void MX_ADC3_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_DAC_Init(void)
|
||||
{
|
||||
static void MX_DAC_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN DAC_Init 0 */
|
||||
|
||||
/* USER CODE END DAC_Init 0 */
|
||||
|
||||
DAC_ChannelConfTypeDef sConfig = {0};
|
||||
DAC_ChannelConfTypeDef sConfig = { 0 };
|
||||
|
||||
/* USER CODE BEGIN DAC_Init 1 */
|
||||
|
||||
|
@ -446,16 +439,14 @@ static void MX_DAC_Init(void)
|
|||
/** DAC Initialization
|
||||
*/
|
||||
hdac.Instance = DAC;
|
||||
if (HAL_DAC_Init(&hdac) != HAL_OK)
|
||||
{
|
||||
if (HAL_DAC_Init(&hdac) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** DAC channel OUT1 config
|
||||
*/
|
||||
sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
|
||||
sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
|
||||
if (HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_1) != HAL_OK)
|
||||
{
|
||||
if (HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_1) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN DAC_Init 2 */
|
||||
|
@ -469,8 +460,7 @@ static void MX_DAC_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_DMA2D_Init(void)
|
||||
{
|
||||
static void MX_DMA2D_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN DMA2D_Init 0 */
|
||||
|
||||
|
@ -487,12 +477,10 @@ static void MX_DMA2D_Init(void)
|
|||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888;
|
||||
hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
|
||||
hdma2d.LayerCfg[1].InputAlpha = 0;
|
||||
if (HAL_DMA2D_Init(&hdma2d) != HAL_OK)
|
||||
{
|
||||
if (HAL_DMA2D_Init(&hdma2d) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_DMA2D_ConfigLayer(&hdma2d, 1) != HAL_OK)
|
||||
{
|
||||
if (HAL_DMA2D_ConfigLayer(&hdma2d, 1) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN DMA2D_Init 2 */
|
||||
|
@ -506,8 +494,7 @@ static void MX_DMA2D_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_I2C1_Init(void)
|
||||
{
|
||||
static void MX_I2C1_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN I2C1_Init 0 */
|
||||
|
||||
|
@ -525,20 +512,18 @@ static void MX_I2C1_Init(void)
|
|||
hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
|
||||
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||
if (HAL_I2C_Init(&hi2c1) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2C_Init(&hi2c1) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Configure Analogue filter
|
||||
*/
|
||||
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE)
|
||||
!= HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Configure Digital filter
|
||||
*/
|
||||
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN I2C1_Init 2 */
|
||||
|
@ -552,8 +537,7 @@ static void MX_I2C1_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_I2C3_Init(void)
|
||||
{
|
||||
static void MX_I2C3_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN I2C3_Init 0 */
|
||||
|
||||
|
@ -571,20 +555,18 @@ static void MX_I2C3_Init(void)
|
|||
hi2c3.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
|
||||
hi2c3.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||
hi2c3.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||
if (HAL_I2C_Init(&hi2c3) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2C_Init(&hi2c3) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Configure Analogue filter
|
||||
*/
|
||||
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c3, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c3, I2C_ANALOGFILTER_ENABLE)
|
||||
!= HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Configure Digital filter
|
||||
*/
|
||||
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c3, 0) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c3, 0) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN I2C3_Init 2 */
|
||||
|
@ -598,14 +580,13 @@ static void MX_I2C3_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_LTDC_Init(void)
|
||||
{
|
||||
static void MX_LTDC_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN LTDC_Init 0 */
|
||||
|
||||
/* USER CODE END LTDC_Init 0 */
|
||||
|
||||
LTDC_LayerCfgTypeDef pLayerCfg = {0};
|
||||
LTDC_LayerCfgTypeDef pLayerCfg = { 0 };
|
||||
|
||||
/* USER CODE BEGIN LTDC_Init 1 */
|
||||
|
||||
|
@ -626,8 +607,7 @@ static void MX_LTDC_Init(void)
|
|||
hltdc.Init.Backcolor.Blue = 0;
|
||||
hltdc.Init.Backcolor.Green = 0;
|
||||
hltdc.Init.Backcolor.Red = 0;
|
||||
if (HAL_LTDC_Init(&hltdc) != HAL_OK)
|
||||
{
|
||||
if (HAL_LTDC_Init(&hltdc) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
pLayerCfg.WindowX0 = 0;
|
||||
|
@ -645,8 +625,7 @@ static void MX_LTDC_Init(void)
|
|||
pLayerCfg.Backcolor.Blue = 0;
|
||||
pLayerCfg.Backcolor.Green = 0;
|
||||
pLayerCfg.Backcolor.Red = 0;
|
||||
if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
|
||||
{
|
||||
if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN LTDC_Init 2 */
|
||||
|
@ -660,16 +639,15 @@ static void MX_LTDC_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_RTC_Init(void)
|
||||
{
|
||||
static void MX_RTC_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN RTC_Init 0 */
|
||||
|
||||
/* USER CODE END RTC_Init 0 */
|
||||
|
||||
RTC_TimeTypeDef sTime = {0};
|
||||
RTC_DateTypeDef sDate = {0};
|
||||
RTC_AlarmTypeDef sAlarm = {0};
|
||||
RTC_TimeTypeDef sTime = { 0 };
|
||||
RTC_DateTypeDef sDate = { 0 };
|
||||
RTC_AlarmTypeDef sAlarm = { 0 };
|
||||
|
||||
/* USER CODE BEGIN RTC_Init 1 */
|
||||
|
||||
|
@ -683,8 +661,7 @@ static void MX_RTC_Init(void)
|
|||
hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
|
||||
hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
|
||||
hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
|
||||
if (HAL_RTC_Init(&hrtc) != HAL_OK)
|
||||
{
|
||||
if (HAL_RTC_Init(&hrtc) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
|
@ -699,16 +676,14 @@ static void MX_RTC_Init(void)
|
|||
sTime.Seconds = 0x0;
|
||||
sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
|
||||
sTime.StoreOperation = RTC_STOREOPERATION_RESET;
|
||||
if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)
|
||||
{
|
||||
if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sDate.WeekDay = RTC_WEEKDAY_MONDAY;
|
||||
sDate.Month = RTC_MONTH_JANUARY;
|
||||
sDate.Date = 0x1;
|
||||
sDate.Year = 0x0;
|
||||
if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK)
|
||||
{
|
||||
if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Enable the Alarm A
|
||||
|
@ -724,21 +699,19 @@ static void MX_RTC_Init(void)
|
|||
sAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE;
|
||||
sAlarm.AlarmDateWeekDay = 0x1;
|
||||
sAlarm.Alarm = RTC_ALARM_A;
|
||||
if (HAL_RTC_SetAlarm(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK)
|
||||
{
|
||||
if (HAL_RTC_SetAlarm(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Enable the Alarm B
|
||||
*/
|
||||
sAlarm.Alarm = RTC_ALARM_B;
|
||||
if (HAL_RTC_SetAlarm(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK)
|
||||
{
|
||||
if (HAL_RTC_SetAlarm(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/** Enable the TimeStamp
|
||||
*/
|
||||
if (HAL_RTCEx_SetTimeStamp(&hrtc, RTC_TIMESTAMPEDGE_RISING, RTC_TIMESTAMPPIN_POS1) != HAL_OK)
|
||||
{
|
||||
if (HAL_RTCEx_SetTimeStamp(&hrtc, RTC_TIMESTAMPEDGE_RISING,
|
||||
RTC_TIMESTAMPPIN_POS1) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN RTC_Init 2 */
|
||||
|
@ -752,8 +725,7 @@ static void MX_RTC_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_SPI2_Init(void)
|
||||
{
|
||||
static void MX_SPI2_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN SPI2_Init 0 */
|
||||
|
||||
|
@ -777,8 +749,7 @@ static void MX_SPI2_Init(void)
|
|||
hspi2.Init.CRCPolynomial = 7;
|
||||
hspi2.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
|
||||
hspi2.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
|
||||
if (HAL_SPI_Init(&hspi2) != HAL_OK)
|
||||
{
|
||||
if (HAL_SPI_Init(&hspi2) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN SPI2_Init 2 */
|
||||
|
@ -792,15 +763,14 @@ static void MX_SPI2_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_TIM1_Init(void)
|
||||
{
|
||||
static void MX_TIM1_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN TIM1_Init 0 */
|
||||
|
||||
/* USER CODE END TIM1_Init 0 */
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = { 0 };
|
||||
TIM_MasterConfigTypeDef sMasterConfig = { 0 };
|
||||
|
||||
/* USER CODE BEGIN TIM1_Init 1 */
|
||||
|
||||
|
@ -812,20 +782,18 @@ static void MX_TIM1_Init(void)
|
|||
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim1.Init.RepetitionCounter = 0;
|
||||
htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_Base_Init(&htim1) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_Base_Init(&htim1) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
if (HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterOutputTrigger2 = TIM_TRGO2_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig)
|
||||
!= HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM1_Init 2 */
|
||||
|
@ -839,15 +807,14 @@ static void MX_TIM1_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_TIM2_Init(void)
|
||||
{
|
||||
static void MX_TIM2_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN TIM2_Init 0 */
|
||||
|
||||
/* USER CODE END TIM2_Init 0 */
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = { 0 };
|
||||
TIM_MasterConfigTypeDef sMasterConfig = { 0 };
|
||||
|
||||
/* USER CODE BEGIN TIM2_Init 1 */
|
||||
|
||||
|
@ -858,19 +825,17 @@ static void MX_TIM2_Init(void)
|
|||
htim2.Init.Period = 4294967295;
|
||||
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_Base_Init(&htim2) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_Base_Init(&htim2) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig)
|
||||
!= HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM2_Init 2 */
|
||||
|
@ -884,17 +849,16 @@ static void MX_TIM2_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_TIM3_Init(void)
|
||||
{
|
||||
static void MX_TIM3_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN TIM3_Init 0 */
|
||||
|
||||
/* USER CODE END TIM3_Init 0 */
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||
TIM_SlaveConfigTypeDef sSlaveConfig = {0};
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
TIM_OC_InitTypeDef sConfigOC = {0};
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = { 0 };
|
||||
TIM_SlaveConfigTypeDef sSlaveConfig = { 0 };
|
||||
TIM_MasterConfigTypeDef sMasterConfig = { 0 };
|
||||
TIM_OC_InitTypeDef sConfigOC = { 0 };
|
||||
|
||||
/* USER CODE BEGIN TIM3_Init 1 */
|
||||
|
||||
|
@ -905,37 +869,33 @@ static void MX_TIM3_Init(void)
|
|||
htim3.Init.Period = 65535;
|
||||
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_Base_Init(&htim3) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_Base_Init(&htim3) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
if (HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_TIM_PWM_Init(&htim3) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_PWM_Init(&htim3) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sSlaveConfig.SlaveMode = TIM_SLAVEMODE_DISABLE;
|
||||
sSlaveConfig.InputTrigger = TIM_TS_ITR0;
|
||||
if (HAL_TIM_SlaveConfigSynchro(&htim3, &sSlaveConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_SlaveConfigSynchro(&htim3, &sSlaveConfig) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig)
|
||||
!= HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||
sConfigOC.Pulse = 0;
|
||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1)
|
||||
!= HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM3_Init 2 */
|
||||
|
@ -950,15 +910,14 @@ static void MX_TIM3_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_TIM5_Init(void)
|
||||
{
|
||||
static void MX_TIM5_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN TIM5_Init 0 */
|
||||
|
||||
/* USER CODE END TIM5_Init 0 */
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = { 0 };
|
||||
TIM_MasterConfigTypeDef sMasterConfig = { 0 };
|
||||
|
||||
/* USER CODE BEGIN TIM5_Init 1 */
|
||||
|
||||
|
@ -969,19 +928,17 @@ static void MX_TIM5_Init(void)
|
|||
htim5.Init.Period = 4294967295;
|
||||
htim5.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim5.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_Base_Init(&htim5) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_Base_Init(&htim5) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
if (HAL_TIM_ConfigClockSource(&htim5, &sClockSourceConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_ConfigClockSource(&htim5, &sClockSourceConfig) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim5, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim5, &sMasterConfig)
|
||||
!= HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM5_Init 2 */
|
||||
|
@ -995,17 +952,16 @@ static void MX_TIM5_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_TIM8_Init(void)
|
||||
{
|
||||
static void MX_TIM8_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN TIM8_Init 0 */
|
||||
|
||||
/* USER CODE END TIM8_Init 0 */
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
TIM_OC_InitTypeDef sConfigOC = {0};
|
||||
TIM_BreakDeadTimeConfigTypeDef sBreakDeadTimeConfig = {0};
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = { 0 };
|
||||
TIM_MasterConfigTypeDef sMasterConfig = { 0 };
|
||||
TIM_OC_InitTypeDef sConfigOC = { 0 };
|
||||
TIM_BreakDeadTimeConfigTypeDef sBreakDeadTimeConfig = { 0 };
|
||||
|
||||
/* USER CODE BEGIN TIM8_Init 1 */
|
||||
|
||||
|
@ -1017,24 +973,21 @@ static void MX_TIM8_Init(void)
|
|||
htim8.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim8.Init.RepetitionCounter = 0;
|
||||
htim8.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_Base_Init(&htim8) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_Base_Init(&htim8) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
if (HAL_TIM_ConfigClockSource(&htim8, &sClockSourceConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_ConfigClockSource(&htim8, &sClockSourceConfig) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_TIM_PWM_Init(&htim8) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_PWM_Init(&htim8) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterOutputTrigger2 = TIM_TRGO2_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim8, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim8, &sMasterConfig)
|
||||
!= HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||
|
@ -1043,8 +996,8 @@ static void MX_TIM8_Init(void)
|
|||
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
||||
sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET;
|
||||
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim8, &sConfigOC, TIM_CHANNEL_4) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim8, &sConfigOC, TIM_CHANNEL_4)
|
||||
!= HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
sBreakDeadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE;
|
||||
|
@ -1058,8 +1011,8 @@ static void MX_TIM8_Init(void)
|
|||
sBreakDeadTimeConfig.Break2Polarity = TIM_BREAK2POLARITY_HIGH;
|
||||
sBreakDeadTimeConfig.Break2Filter = 0;
|
||||
sBreakDeadTimeConfig.AutomaticOutput = TIM_AUTOMATICOUTPUT_DISABLE;
|
||||
if (HAL_TIMEx_ConfigBreakDeadTime(&htim8, &sBreakDeadTimeConfig) != HAL_OK)
|
||||
{
|
||||
if (HAL_TIMEx_ConfigBreakDeadTime(&htim8, &sBreakDeadTimeConfig)
|
||||
!= HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM8_Init 2 */
|
||||
|
@ -1074,8 +1027,7 @@ static void MX_TIM8_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_UART7_Init(void)
|
||||
{
|
||||
static void MX_UART7_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN UART7_Init 0 */
|
||||
|
||||
|
@ -1094,8 +1046,7 @@ static void MX_UART7_Init(void)
|
|||
huart7.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
huart7.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||
huart7.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
if (HAL_UART_Init(&huart7) != HAL_OK)
|
||||
{
|
||||
if (HAL_UART_Init(&huart7) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN UART7_Init 2 */
|
||||
|
@ -1109,8 +1060,7 @@ static void MX_UART7_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_USART1_UART_Init(void)
|
||||
{
|
||||
static void MX_USART1_UART_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN USART1_Init 0 */
|
||||
|
||||
|
@ -1129,8 +1079,7 @@ static void MX_USART1_UART_Init(void)
|
|||
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
if (HAL_UART_Init(&huart1) != HAL_OK)
|
||||
{
|
||||
if (HAL_UART_Init(&huart1) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN USART1_Init 2 */
|
||||
|
@ -1144,8 +1093,7 @@ static void MX_USART1_UART_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_USART6_UART_Init(void)
|
||||
{
|
||||
static void MX_USART6_UART_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN USART6_Init 0 */
|
||||
|
||||
|
@ -1164,8 +1112,7 @@ static void MX_USART6_UART_Init(void)
|
|||
huart6.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
huart6.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||
huart6.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
if (HAL_UART_Init(&huart6) != HAL_OK)
|
||||
{
|
||||
if (HAL_UART_Init(&huart6) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN USART6_Init 2 */
|
||||
|
@ -1175,14 +1122,13 @@ static void MX_USART6_UART_Init(void)
|
|||
}
|
||||
|
||||
/* FMC initialization function */
|
||||
static void MX_FMC_Init(void)
|
||||
{
|
||||
static void MX_FMC_Init(void) {
|
||||
|
||||
/* USER CODE BEGIN FMC_Init 0 */
|
||||
|
||||
/* USER CODE END FMC_Init 0 */
|
||||
|
||||
FMC_SDRAM_TimingTypeDef SdramTiming = {0};
|
||||
FMC_SDRAM_TimingTypeDef SdramTiming = { 0 };
|
||||
|
||||
/* USER CODE BEGIN FMC_Init 1 */
|
||||
|
||||
|
@ -1211,9 +1157,8 @@ static void MX_FMC_Init(void)
|
|||
SdramTiming.RPDelay = 16;
|
||||
SdramTiming.RCDDelay = 16;
|
||||
|
||||
if (HAL_SDRAM_Init(&hsdram1, &SdramTiming) != HAL_OK)
|
||||
{
|
||||
Error_Handler( );
|
||||
if (HAL_SDRAM_Init(&hsdram1, &SdramTiming) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN FMC_Init 2 */
|
||||
|
@ -1226,9 +1171,8 @@ static void MX_FMC_Init(void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_GPIO_Init(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
static void MX_GPIO_Init(void) {
|
||||
GPIO_InitTypeDef GPIO_InitStruct = { 0 };
|
||||
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
|
@ -1244,10 +1188,11 @@ static void MX_GPIO_Init(void)
|
|||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOE, LED14_Pin|LED15_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOE, LED14_Pin | LED15_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(OTG_FS_PowerSwitchOn_GPIO_Port, OTG_FS_PowerSwitchOn_Pin, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(OTG_FS_PowerSwitchOn_GPIO_Port, OTG_FS_PowerSwitchOn_Pin,
|
||||
GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(LED16_GPIO_Port, LED16_Pin, GPIO_PIN_RESET);
|
||||
|
@ -1262,8 +1207,9 @@ static void MX_GPIO_Init(void)
|
|||
HAL_GPIO_WritePin(LCD_DISP_GPIO_Port, LCD_DISP_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOH, LED13_Pin|LED17_Pin|LED11_Pin|LED12_Pin
|
||||
|LED2_Pin|LED18_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOH,
|
||||
LED13_Pin | LED17_Pin | LED11_Pin | LED12_Pin | LED2_Pin | LED18_Pin,
|
||||
GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(EXT_RST_GPIO_Port, EXT_RST_Pin, GPIO_PIN_RESET);
|
||||
|
@ -1276,8 +1222,8 @@ static void MX_GPIO_Init(void)
|
|||
|
||||
/*Configure GPIO pins : ULPI_D7_Pin ULPI_D6_Pin ULPI_D5_Pin ULPI_D2_Pin
|
||||
ULPI_D1_Pin ULPI_D4_Pin */
|
||||
GPIO_InitStruct.Pin = ULPI_D7_Pin|ULPI_D6_Pin|ULPI_D5_Pin|ULPI_D2_Pin
|
||||
|ULPI_D1_Pin|ULPI_D4_Pin;
|
||||
GPIO_InitStruct.Pin = ULPI_D7_Pin | ULPI_D6_Pin | ULPI_D5_Pin | ULPI_D2_Pin
|
||||
| ULPI_D1_Pin | ULPI_D4_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
|
@ -1285,13 +1231,13 @@ static void MX_GPIO_Init(void)
|
|||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : BP2_Pin BP1_Pin */
|
||||
GPIO_InitStruct.Pin = BP2_Pin|BP1_Pin;
|
||||
GPIO_InitStruct.Pin = BP2_Pin | BP1_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : LED14_Pin LED15_Pin */
|
||||
GPIO_InitStruct.Pin = LED14_Pin|LED15_Pin;
|
||||
GPIO_InitStruct.Pin = LED14_Pin | LED15_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
@ -1310,14 +1256,14 @@ static void MX_GPIO_Init(void)
|
|||
HAL_GPIO_Init(Audio_INT_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : OTG_FS_PowerSwitchOn_Pin LED16_Pin */
|
||||
GPIO_InitStruct.Pin = OTG_FS_PowerSwitchOn_Pin|LED16_Pin;
|
||||
GPIO_InitStruct.Pin = OTG_FS_PowerSwitchOn_Pin | LED16_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : LED3_Pin LCD_DISP_Pin */
|
||||
GPIO_InitStruct.Pin = LED3_Pin|LCD_DISP_Pin;
|
||||
GPIO_InitStruct.Pin = LED3_Pin | LCD_DISP_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
@ -1343,15 +1289,15 @@ static void MX_GPIO_Init(void)
|
|||
HAL_GPIO_Init(OTG_FS_OverCurrent_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : TP3_Pin NC2_Pin */
|
||||
GPIO_InitStruct.Pin = TP3_Pin|NC2_Pin;
|
||||
GPIO_InitStruct.Pin = TP3_Pin | NC2_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : LED13_Pin LED17_Pin LED11_Pin LED12_Pin
|
||||
LED2_Pin LED18_Pin */
|
||||
GPIO_InitStruct.Pin = LED13_Pin|LED17_Pin|LED11_Pin|LED12_Pin
|
||||
|LED2_Pin|LED18_Pin;
|
||||
GPIO_InitStruct.Pin = LED13_Pin | LED17_Pin | LED11_Pin | LED12_Pin
|
||||
| LED2_Pin | LED18_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
@ -1372,13 +1318,13 @@ static void MX_GPIO_Init(void)
|
|||
HAL_GPIO_Init(ULPI_NXT_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : BP_JOYSTICK_Pin RMII_RXER_Pin */
|
||||
GPIO_InitStruct.Pin = BP_JOYSTICK_Pin|RMII_RXER_Pin;
|
||||
GPIO_InitStruct.Pin = BP_JOYSTICK_Pin | RMII_RXER_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : ULPI_STP_Pin ULPI_DIR_Pin */
|
||||
GPIO_InitStruct.Pin = ULPI_STP_Pin|ULPI_DIR_Pin;
|
||||
GPIO_InitStruct.Pin = ULPI_STP_Pin | ULPI_DIR_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
|
@ -1393,7 +1339,7 @@ static void MX_GPIO_Init(void)
|
|||
HAL_GPIO_Init(EXT_RST_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : ULPI_CLK_Pin ULPI_D0_Pin */
|
||||
GPIO_InitStruct.Pin = ULPI_CLK_Pin|ULPI_D0_Pin;
|
||||
GPIO_InitStruct.Pin = ULPI_CLK_Pin | ULPI_D0_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
|
@ -1413,18 +1359,16 @@ static void MX_GPIO_Init(void)
|
|||
* @retval None
|
||||
*/
|
||||
/* USER CODE END Header_StartDefaultTask */
|
||||
void StartDefaultTask(void const * argument)
|
||||
{
|
||||
void StartDefaultTask(void const *argument) {
|
||||
/* USER CODE BEGIN 5 */
|
||||
/* Infinite loop */
|
||||
for(;;)
|
||||
{
|
||||
for (;;) {
|
||||
osDelay(1);
|
||||
}
|
||||
/* USER CODE END 5 */
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Period elapsed callback in non blocking mode
|
||||
* @note This function is called when TIM6 interrupt took place, inside
|
||||
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
|
||||
|
@ -1432,8 +1376,7 @@ void StartDefaultTask(void const * argument)
|
|||
* @param htim : TIM handle
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
||||
{
|
||||
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
|
||||
/* USER CODE BEGIN Callback 0 */
|
||||
|
||||
/* USER CODE END Callback 0 */
|
||||
|
@ -1449,13 +1392,11 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
|||
* @brief This function is executed in case of error occurrence.
|
||||
* @retval None
|
||||
*/
|
||||
void Error_Handler(void)
|
||||
{
|
||||
void Error_Handler(void) {
|
||||
/* USER CODE BEGIN Error_Handler_Debug */
|
||||
/* User can add his own implementation to report the HAL error return state */
|
||||
__disable_irq();
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
}
|
||||
/* USER CODE END Error_Handler_Debug */
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue