Formattage du code

This commit is contained in:
leo 2021-04-04 18:24:01 +02:00
parent 7639207df4
commit e117dbd01b

View file

@ -100,10 +100,10 @@ static void MX_DAC_Init(void);
static void MX_UART7_Init(void); static void MX_UART7_Init(void);
static void MX_FMC_Init(void); static void MX_FMC_Init(void);
static void MX_DMA2D_Init(void); static void MX_DMA2D_Init(void);
void f_GameMaster(void const * argument); void f_GameMaster(void const *argument);
void f_Joueur_1(void const * argument); void f_Joueur_1(void const *argument);
void f_block_enemie(void const * argument); void f_block_enemie(void const *argument);
void f_projectile(void const * argument); void f_projectile(void const *argument);
/* USER CODE BEGIN PFP */ /* USER CODE BEGIN PFP */
@ -121,12 +121,12 @@ void f_projectile(void const * argument);
int main(void) int main(void)
{ {
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
char text[50] = { }; char text[50] = {};
static TS_StateTypeDef TS_State; static TS_StateTypeDef TS_State;
uint32_t potl, potr, joystick_h, joystick_v; uint32_t potl, potr, joystick_h, joystick_v;
ADC_ChannelConfTypeDef sConfig = { 0 }; ADC_ChannelConfTypeDef sConfig = {0};
sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES; sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
/* USER CODE END 1 */ /* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/ /* MCU Configuration--------------------------------------------------------*/
@ -166,35 +166,35 @@ int main(void)
MX_FMC_Init(); MX_FMC_Init();
MX_DMA2D_Init(); MX_DMA2D_Init();
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
BSP_LCD_Init(); BSP_LCD_Init();
BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
BSP_LCD_LayerDefaultInit(1, BSP_LCD_LayerDefaultInit(1,
LCD_FB_START_ADDRESS + BSP_LCD_GetXSize() * BSP_LCD_GetYSize() * 4); LCD_FB_START_ADDRESS + BSP_LCD_GetXSize() * BSP_LCD_GetYSize() * 4);
BSP_LCD_DisplayOn(); BSP_LCD_DisplayOn();
BSP_LCD_SelectLayer(1); BSP_LCD_SelectLayer(1);
BSP_LCD_Clear(LCD_COLOR_LIGHTGREEN); BSP_LCD_Clear(LCD_COLOR_LIGHTGREEN);
BSP_LCD_SetFont(&Font12); BSP_LCD_SetFont(&Font12);
BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
BSP_LCD_SetBackColor(LCD_COLOR_LIGHTGREEN); BSP_LCD_SetBackColor(LCD_COLOR_LIGHTGREEN);
BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()); BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize());
/* USER CODE END 2 */ /* USER CODE END 2 */
/* USER CODE BEGIN RTOS_MUTEX */ /* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */ /* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */ /* USER CODE END RTOS_MUTEX */
/* USER CODE BEGIN RTOS_SEMAPHORES */ /* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */ /* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */ /* USER CODE END RTOS_SEMAPHORES */
/* USER CODE BEGIN RTOS_TIMERS */ /* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */ /* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */ /* USER CODE END RTOS_TIMERS */
/* USER CODE BEGIN RTOS_QUEUES */ /* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */ /* add queues, ... */
/* USER CODE END RTOS_QUEUES */ /* USER CODE END RTOS_QUEUES */
/* Create the thread(s) */ /* Create the thread(s) */
@ -212,10 +212,10 @@ int main(void)
/* definition and creation of Projectile */ /* definition and creation of Projectile */
osThreadStaticDef(Projectile, f_projectile, osPriorityNormal, 0, 128, Dynamic, &NULL); osThreadStaticDef(Projectile, f_projectile, osPriorityNormal, 0, 128, Dynamic, &NULL);
ProjectileHandle = osThreadCreate(osThread(Projectile), (void*) sens); ProjectileHandle = osThreadCreate(osThread(Projectile), (void *)sens);
/* USER CODE BEGIN RTOS_THREADS */ /* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */ /* add threads, ... */
/* USER CODE END RTOS_THREADS */ /* USER CODE END RTOS_THREADS */
/* Start scheduler */ /* Start scheduler */
@ -224,56 +224,57 @@ int main(void)
/* We should never get here as control is now taken by the scheduler */ /* We should never get here as control is now taken by the scheduler */
/* Infinite loop */ /* Infinite loop */
/* USER CODE BEGIN WHILE */ /* USER CODE BEGIN WHILE */
while (1) { while (1)
/* Code de base */ {
HAL_GPIO_WritePin(LED13_GPIO_Port, LED13_Pin, /* Code de base */
HAL_GPIO_ReadPin(BP1_GPIO_Port, BP1_Pin)); HAL_GPIO_WritePin(LED13_GPIO_Port, LED13_Pin,
HAL_GPIO_WritePin(LED14_GPIO_Port, LED14_Pin, HAL_GPIO_ReadPin(BP1_GPIO_Port, BP1_Pin));
HAL_GPIO_ReadPin(BP2_GPIO_Port, BP2_Pin)); HAL_GPIO_WritePin(LED14_GPIO_Port, LED14_Pin,
sprintf(text, "BP1 : %d", HAL_GPIO_ReadPin(BP1_GPIO_Port, BP1_Pin)); HAL_GPIO_ReadPin(BP2_GPIO_Port, BP2_Pin));
BSP_LCD_DisplayStringAtLine(5, (uint8_t*) text); sprintf(text, "BP1 : %d", HAL_GPIO_ReadPin(BP1_GPIO_Port, BP1_Pin));
BSP_LCD_DisplayStringAtLine(5, (uint8_t *)text);
sConfig.Channel = ADC_CHANNEL_6; sConfig.Channel = ADC_CHANNEL_6;
HAL_ADC_ConfigChannel(&hadc3, &sConfig); HAL_ADC_ConfigChannel(&hadc3, &sConfig);
HAL_ADC_Start(&hadc3); 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); potr = HAL_ADC_GetValue(&hadc3);
sConfig.Channel = ADC_CHANNEL_7; sConfig.Channel = ADC_CHANNEL_7;
HAL_ADC_ConfigChannel(&hadc3, &sConfig); HAL_ADC_ConfigChannel(&hadc3, &sConfig);
HAL_ADC_Start(&hadc3); 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); potl = HAL_ADC_GetValue(&hadc3);
sConfig.Channel = ADC_CHANNEL_8; sConfig.Channel = ADC_CHANNEL_8;
HAL_ADC_ConfigChannel(&hadc3, &sConfig); HAL_ADC_ConfigChannel(&hadc3, &sConfig);
HAL_ADC_Start(&hadc3); 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); joystick_v = HAL_ADC_GetValue(&hadc3);
HAL_ADC_Start(&hadc1); 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); joystick_h = HAL_ADC_GetValue(&hadc1);
sprintf(text, "POTL : %4u POTR : %4u joy_v : %4u joy_h : %4u", sprintf(text, "POTL : %4u POTR : %4u joy_v : %4u joy_h : %4u",
(uint) potl, (uint) potr, (uint) joystick_v, (uint) joystick_h); (uint)potl, (uint)potr, (uint)joystick_v, (uint)joystick_h);
BSP_LCD_DisplayStringAtLine(9, (uint8_t*) text); BSP_LCD_DisplayStringAtLine(9, (uint8_t *)text);
BSP_TS_GetState(&TS_State); BSP_TS_GetState(&TS_State);
if (TS_State.touchDetected) { if (TS_State.touchDetected)
BSP_LCD_FillCircle(TS_State.touchX[0], TS_State.touchY[0], 4); {
} 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 ****"); BSP_LCD_DisplyString(0, "coucou");
BSP_LCD_DisplyString(1, "Tu veux voir ma ****");
/* USER CODE END WHILE */ /* USER CODE END WHILE */
/* USER CODE BEGIN 3 */ /* USER CODE BEGIN 3 */
}
}
/* USER CODE END 3 */ /* USER CODE END 3 */
} }
@ -297,7 +298,7 @@ void SystemClock_Config(void)
/** Initializes the RCC Oscillators according to the specified parameters /** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure. * 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.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.LSIState = RCC_LSI_ON; RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
@ -318,8 +319,7 @@ void SystemClock_Config(void)
} }
/** Initializes the CPU, AHB and APB buses clocks /** Initializes the CPU, AHB and APB buses clocks
*/ */
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
@ -329,10 +329,7 @@ void SystemClock_Config(void)
{ {
Error_Handler(); Error_Handler();
} }
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC|RCC_PERIPHCLK_RTC PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC | RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART6 | RCC_PERIPHCLK_UART7 | RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_I2C3;
|RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART6
|RCC_PERIPHCLK_UART7|RCC_PERIPHCLK_I2C1
|RCC_PERIPHCLK_I2C3;
PeriphClkInitStruct.PLLSAI.PLLSAIN = 384; PeriphClkInitStruct.PLLSAI.PLLSAIN = 384;
PeriphClkInitStruct.PLLSAI.PLLSAIR = 5; PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;
PeriphClkInitStruct.PLLSAI.PLLSAIQ = 2; PeriphClkInitStruct.PLLSAI.PLLSAIQ = 2;
@ -398,7 +395,6 @@ static void MX_ADC1_Init(void)
/* USER CODE BEGIN ADC1_Init 2 */ /* USER CODE BEGIN ADC1_Init 2 */
/* USER CODE END ADC1_Init 2 */ /* USER CODE END ADC1_Init 2 */
} }
/** /**
@ -448,7 +444,6 @@ static void MX_ADC3_Init(void)
/* USER CODE BEGIN ADC3_Init 2 */ /* USER CODE BEGIN ADC3_Init 2 */
/* USER CODE END ADC3_Init 2 */ /* USER CODE END ADC3_Init 2 */
} }
/** /**
@ -486,7 +481,6 @@ static void MX_DAC_Init(void)
/* USER CODE BEGIN DAC_Init 2 */ /* USER CODE BEGIN DAC_Init 2 */
/* USER CODE END DAC_Init 2 */ /* USER CODE END DAC_Init 2 */
} }
/** /**
@ -523,7 +517,6 @@ static void MX_DMA2D_Init(void)
/* USER CODE BEGIN DMA2D_Init 2 */ /* USER CODE BEGIN DMA2D_Init 2 */
/* USER CODE END DMA2D_Init 2 */ /* USER CODE END DMA2D_Init 2 */
} }
/** /**
@ -569,7 +562,6 @@ static void MX_I2C1_Init(void)
/* USER CODE BEGIN I2C1_Init 2 */ /* USER CODE BEGIN I2C1_Init 2 */
/* USER CODE END I2C1_Init 2 */ /* USER CODE END I2C1_Init 2 */
} }
/** /**
@ -615,7 +607,6 @@ static void MX_I2C3_Init(void)
/* USER CODE BEGIN I2C3_Init 2 */ /* USER CODE BEGIN I2C3_Init 2 */
/* USER CODE END I2C3_Init 2 */ /* USER CODE END I2C3_Init 2 */
} }
/** /**
@ -677,7 +668,6 @@ static void MX_LTDC_Init(void)
/* USER CODE BEGIN LTDC_Init 2 */ /* USER CODE BEGIN LTDC_Init 2 */
/* USER CODE END LTDC_Init 2 */ /* USER CODE END LTDC_Init 2 */
} }
/** /**
@ -769,7 +759,6 @@ static void MX_RTC_Init(void)
/* USER CODE BEGIN RTC_Init 2 */ /* USER CODE BEGIN RTC_Init 2 */
/* USER CODE END RTC_Init 2 */ /* USER CODE END RTC_Init 2 */
} }
/** /**
@ -809,7 +798,6 @@ static void MX_SPI2_Init(void)
/* USER CODE BEGIN SPI2_Init 2 */ /* USER CODE BEGIN SPI2_Init 2 */
/* USER CODE END SPI2_Init 2 */ /* USER CODE END SPI2_Init 2 */
} }
/** /**
@ -856,7 +844,6 @@ static void MX_TIM1_Init(void)
/* USER CODE BEGIN TIM1_Init 2 */ /* USER CODE BEGIN TIM1_Init 2 */
/* USER CODE END TIM1_Init 2 */ /* USER CODE END TIM1_Init 2 */
} }
/** /**
@ -901,7 +888,6 @@ static void MX_TIM2_Init(void)
/* USER CODE BEGIN TIM2_Init 2 */ /* USER CODE BEGIN TIM2_Init 2 */
/* USER CODE END TIM2_Init 2 */ /* USER CODE END TIM2_Init 2 */
} }
/** /**
@ -967,7 +953,6 @@ static void MX_TIM3_Init(void)
/* USER CODE END TIM3_Init 2 */ /* USER CODE END TIM3_Init 2 */
HAL_TIM_MspPostInit(&htim3); HAL_TIM_MspPostInit(&htim3);
} }
/** /**
@ -1012,7 +997,6 @@ static void MX_TIM5_Init(void)
/* USER CODE BEGIN TIM5_Init 2 */ /* USER CODE BEGIN TIM5_Init 2 */
/* USER CODE END TIM5_Init 2 */ /* USER CODE END TIM5_Init 2 */
} }
/** /**
@ -1091,7 +1075,6 @@ static void MX_TIM8_Init(void)
/* USER CODE END TIM8_Init 2 */ /* USER CODE END TIM8_Init 2 */
HAL_TIM_MspPostInit(&htim8); HAL_TIM_MspPostInit(&htim8);
} }
/** /**
@ -1126,7 +1109,6 @@ static void MX_UART7_Init(void)
/* USER CODE BEGIN UART7_Init 2 */ /* USER CODE BEGIN UART7_Init 2 */
/* USER CODE END UART7_Init 2 */ /* USER CODE END UART7_Init 2 */
} }
/** /**
@ -1161,7 +1143,6 @@ static void MX_USART1_UART_Init(void)
/* USER CODE BEGIN USART1_Init 2 */ /* USER CODE BEGIN USART1_Init 2 */
/* USER CODE END USART1_Init 2 */ /* USER CODE END USART1_Init 2 */
} }
/** /**
@ -1196,7 +1177,6 @@ static void MX_USART6_UART_Init(void)
/* USER CODE BEGIN USART6_Init 2 */ /* USER CODE BEGIN USART6_Init 2 */
/* USER CODE END USART6_Init 2 */ /* USER CODE END USART6_Init 2 */
} }
/* FMC initialization function */ /* FMC initialization function */
@ -1238,7 +1218,7 @@ static void MX_FMC_Init(void)
if (HAL_SDRAM_Init(&hsdram1, &SdramTiming) != HAL_OK) if (HAL_SDRAM_Init(&hsdram1, &SdramTiming) != HAL_OK)
{ {
Error_Handler( ); Error_Handler();
} }
/* USER CODE BEGIN FMC_Init 2 */ /* USER CODE BEGIN FMC_Init 2 */
@ -1269,7 +1249,7 @@ static void MX_GPIO_Init(void)
__HAL_RCC_GPIOH_CLK_ENABLE(); __HAL_RCC_GPIOH_CLK_ENABLE();
/*Configure GPIO pin Output Level */ /*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 */ /*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);
@ -1287,8 +1267,7 @@ static void MX_GPIO_Init(void)
HAL_GPIO_WritePin(LCD_DISP_GPIO_Port, LCD_DISP_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(LCD_DISP_GPIO_Port, LCD_DISP_Pin, GPIO_PIN_SET);
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOH, LED13_Pin|LED17_Pin|LED11_Pin|LED12_Pin HAL_GPIO_WritePin(GPIOH, LED13_Pin | LED17_Pin | LED11_Pin | LED12_Pin | LED2_Pin | LED18_Pin, GPIO_PIN_RESET);
|LED2_Pin|LED18_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(EXT_RST_GPIO_Port, EXT_RST_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(EXT_RST_GPIO_Port, EXT_RST_Pin, GPIO_PIN_RESET);
@ -1301,8 +1280,7 @@ static void MX_GPIO_Init(void)
/*Configure GPIO pins : ULPI_D7_Pin ULPI_D6_Pin ULPI_D5_Pin ULPI_D2_Pin /*Configure GPIO pins : ULPI_D7_Pin ULPI_D6_Pin ULPI_D5_Pin ULPI_D2_Pin
ULPI_D1_Pin ULPI_D4_Pin */ ULPI_D1_Pin ULPI_D4_Pin */
GPIO_InitStruct.Pin = ULPI_D7_Pin|ULPI_D6_Pin|ULPI_D5_Pin|ULPI_D2_Pin GPIO_InitStruct.Pin = ULPI_D7_Pin | ULPI_D6_Pin | ULPI_D5_Pin | ULPI_D2_Pin | ULPI_D1_Pin | ULPI_D4_Pin;
|ULPI_D1_Pin|ULPI_D4_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
@ -1310,13 +1288,13 @@ static void MX_GPIO_Init(void)
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pins : BP2_Pin BP1_Pin */ /*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.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pins : LED14_Pin LED15_Pin */ /*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.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
@ -1335,14 +1313,14 @@ static void MX_GPIO_Init(void)
HAL_GPIO_Init(Audio_INT_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(Audio_INT_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : OTG_FS_PowerSwitchOn_Pin LED16_Pin */ /*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.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/*Configure GPIO pins : LED3_Pin LCD_DISP_Pin */ /*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.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
@ -1368,15 +1346,14 @@ static void MX_GPIO_Init(void)
HAL_GPIO_Init(OTG_FS_OverCurrent_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(OTG_FS_OverCurrent_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : TP3_Pin NC2_Pin */ /*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.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
/*Configure GPIO pins : LED13_Pin LED17_Pin LED11_Pin LED12_Pin /*Configure GPIO pins : LED13_Pin LED17_Pin LED11_Pin LED12_Pin
LED2_Pin LED18_Pin */ LED2_Pin LED18_Pin */
GPIO_InitStruct.Pin = LED13_Pin|LED17_Pin|LED11_Pin|LED12_Pin GPIO_InitStruct.Pin = LED13_Pin | LED17_Pin | LED11_Pin | LED12_Pin | LED2_Pin | LED18_Pin;
|LED2_Pin|LED18_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
@ -1397,13 +1374,13 @@ static void MX_GPIO_Init(void)
HAL_GPIO_Init(ULPI_NXT_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(ULPI_NXT_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : BP_JOYSTICK_Pin RMII_RXER_Pin */ /*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.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
/*Configure GPIO pins : ULPI_STP_Pin ULPI_DIR_Pin */ /*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.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
@ -1418,13 +1395,12 @@ static void MX_GPIO_Init(void)
HAL_GPIO_Init(EXT_RST_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(EXT_RST_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : ULPI_CLK_Pin ULPI_D0_Pin */ /*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.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS; GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
} }
/* USER CODE BEGIN 4 */ /* USER CODE BEGIN 4 */
@ -1438,15 +1414,16 @@ static void MX_GPIO_Init(void)
* @retval None * @retval None
*/ */
/* USER CODE END Header_f_GameMaster */ /* USER CODE END Header_f_GameMaster */
void f_GameMaster(void const * argument) void f_GameMaster(void const *argument)
{ {
/* USER CODE BEGIN 5 */ /* USER CODE BEGIN 5 */
TickType_t xLastWakeTime; TickType_t xLastWakeTime;
const TickType_t xPeriodeTache = 10; const TickType_t xPeriodeTache = 10;
/* Infinite loop */ /* Infinite loop */
for (;;) { for (;;)
vTaskDelayUntil( &xLastWakeTime, xPeriodeTache ); {
} vTaskDelayUntil(&xLastWakeTime, xPeriodeTache);
}
/* USER CODE END 5 */ /* USER CODE END 5 */
} }
@ -1457,15 +1434,15 @@ void f_GameMaster(void const * argument)
* @retval None * @retval None
*/ */
/* USER CODE END Header_f_Joueur_1 */ /* USER CODE END Header_f_Joueur_1 */
void f_Joueur_1(void const * argument) void f_Joueur_1(void const *argument)
{ {
/* USER CODE BEGIN f_Joueur_1 */ /* USER CODE BEGIN f_Joueur_1 */
TickType_t xLastWakeTime; TickType_t xLastWakeTime;
const TickType_t xPeriodeTache = 10; const TickType_t xPeriodeTache = 10;
/* Infinite loop */ /* Infinite loop */
for(;;) for (;;)
{ {
vTaskDelayUntil( &xLastWakeTime, xPeriodeTache ); vTaskDelayUntil(&xLastWakeTime, xPeriodeTache);
} }
/* USER CODE END f_Joueur_1 */ /* USER CODE END f_Joueur_1 */
} }
@ -1477,15 +1454,15 @@ void f_Joueur_1(void const * argument)
* @retval None * @retval None
*/ */
/* USER CODE END Header_f_block_enemie */ /* USER CODE END Header_f_block_enemie */
void f_block_enemie(void const * argument) void f_block_enemie(void const *argument)
{ {
/* USER CODE BEGIN f_block_enemie */ /* USER CODE BEGIN f_block_enemie */
TickType_t xLastWakeTime; TickType_t xLastWakeTime;
const TickType_t xPeriodeTache = 10; const TickType_t xPeriodeTache = 10;
/* Infinite loop */ /* Infinite loop */
for(;;) for (;;)
{ {
vTaskDelayUntil( &xLastWakeTime, xPeriodeTache ); vTaskDelayUntil(&xLastWakeTime, xPeriodeTache);
} }
/* USER CODE END f_block_enemie */ /* USER CODE END f_block_enemie */
} }
@ -1497,20 +1474,20 @@ void f_block_enemie(void const * argument)
* @retval None * @retval None
*/ */
/* USER CODE END Header_f_projectile */ /* USER CODE END Header_f_projectile */
void f_projectile(void const * argument) void f_projectile(void const *argument)
{ {
/* USER CODE BEGIN f_projectile */ /* USER CODE BEGIN f_projectile */
TickType_t xLastWakeTime; TickType_t xLastWakeTime;
const TickType_t xPeriodeTache = 10; const TickType_t xPeriodeTache = 10;
/* Infinite loop */ /* Infinite loop */
for(;;) for (;;)
{ {
vTaskDelayUntil( &xLastWakeTime, xPeriodeTache ); vTaskDelayUntil(&xLastWakeTime, xPeriodeTache);
} }
/* USER CODE END f_projectile */ /* USER CODE END f_projectile */
} }
/** /**
* @brief Period elapsed callback in non blocking mode * @brief Period elapsed callback in non blocking mode
* @note This function is called when TIM6 interrupt took place, inside * @note This function is called when TIM6 interrupt took place, inside
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
@ -1523,7 +1500,8 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
/* USER CODE BEGIN Callback 0 */ /* USER CODE BEGIN Callback 0 */
/* USER CODE END Callback 0 */ /* USER CODE END Callback 0 */
if (htim->Instance == TIM6) { if (htim->Instance == TIM6)
{
HAL_IncTick(); HAL_IncTick();
} }
/* USER CODE BEGIN Callback 1 */ /* USER CODE BEGIN Callback 1 */
@ -1538,14 +1516,15 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
void Error_Handler(void) void Error_Handler(void)
{ {
/* USER CODE BEGIN Error_Handler_Debug */ /* USER CODE BEGIN Error_Handler_Debug */
/* 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 Error_Handler_Debug */
} }
#ifdef USE_FULL_ASSERT #ifdef USE_FULL_ASSERT
/** /**
* @brief Reports the name of the source file and the source line number * @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred. * where the assert_param error has occurred.