Deplacement joueur fonctionnel
Problème de config. Je supprime la config de Léo et on garde la mienne Le deplacement du joueur est fonctionnel et borné correctement. Il faudrait rajouter une limite arbitraire horizontale définie par la position des monstres
This commit is contained in:
parent
ea4fb86ac1
commit
d74fef766f
8 changed files with 51686 additions and 51643 deletions
|
@ -108,13 +108,13 @@ static void MX_TIM5_Init(void);
|
||||||
static void MX_TIM8_Init(void);
|
static void MX_TIM8_Init(void);
|
||||||
static void MX_USART1_UART_Init(void);
|
static void MX_USART1_UART_Init(void);
|
||||||
static void MX_USART6_UART_Init(void);
|
static void MX_USART6_UART_Init(void);
|
||||||
static void MX_ADC1_Init(void);
|
|
||||||
static void MX_DAC_Init(void);
|
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);
|
||||||
static void MX_CRC_Init(void);
|
static void MX_CRC_Init(void);
|
||||||
static void MX_RNG_Init(void);
|
static void MX_RNG_Init(void);
|
||||||
|
static void MX_ADC1_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);
|
||||||
|
@ -226,13 +226,13 @@ int main(void)
|
||||||
MX_TIM8_Init();
|
MX_TIM8_Init();
|
||||||
MX_USART1_UART_Init();
|
MX_USART1_UART_Init();
|
||||||
MX_USART6_UART_Init();
|
MX_USART6_UART_Init();
|
||||||
MX_ADC1_Init();
|
|
||||||
MX_DAC_Init();
|
MX_DAC_Init();
|
||||||
MX_UART7_Init();
|
MX_UART7_Init();
|
||||||
MX_FMC_Init();
|
MX_FMC_Init();
|
||||||
MX_DMA2D_Init();
|
MX_DMA2D_Init();
|
||||||
MX_CRC_Init();
|
MX_CRC_Init();
|
||||||
MX_RNG_Init();
|
MX_RNG_Init();
|
||||||
|
MX_ADC1_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);
|
||||||
|
@ -515,7 +515,7 @@ static void MX_ADC3_Init(void)
|
||||||
}
|
}
|
||||||
/** Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
|
/** Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
|
||||||
*/
|
*/
|
||||||
sConfig.Channel = ADC_CHANNEL_6;
|
sConfig.Channel = ADC_CHANNEL_8;
|
||||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||||
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||||
if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK)
|
if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK)
|
||||||
|
@ -1637,14 +1637,20 @@ void f_Joueur_1(void const * argument)
|
||||||
|
|
||||||
struct Missile missile;
|
struct Missile missile;
|
||||||
|
|
||||||
ADC_ChannelConfTypeDef sConfig = {0};
|
ADC_ChannelConfTypeDef sConfig3 = {0};
|
||||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
sConfig3.Rank = ADC_REGULAR_RANK_1;
|
||||||
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
sConfig3.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||||
|
sConfig3.Channel = ADC_CHANNEL_8;
|
||||||
|
|
||||||
sConfig.Channel = ADC_CHANNEL_8;
|
HAL_ADC_ConfigChannel(&hadc3, &sConfig3);
|
||||||
HAL_ADC_ConfigChannel(&hadc3, &sConfig);
|
|
||||||
HAL_ADC_Start(&hadc3);
|
HAL_ADC_Start(&hadc3);
|
||||||
|
|
||||||
|
ADC_ChannelConfTypeDef sConfig1 = {0};
|
||||||
|
sConfig1.Rank = ADC_REGULAR_RANK_1;
|
||||||
|
sConfig1.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||||
|
sConfig1.Channel = ADC_CHANNEL_0;
|
||||||
|
|
||||||
|
HAL_ADC_ConfigChannel(&hadc1, &sConfig1);
|
||||||
HAL_ADC_Start(&hadc1);
|
HAL_ADC_Start(&hadc1);
|
||||||
|
|
||||||
// Paramètre de l'écran pour la reprouductibilité
|
// Paramètre de l'écran pour la reprouductibilité
|
||||||
|
@ -1661,16 +1667,21 @@ void f_Joueur_1(void const * argument)
|
||||||
BSP_LCD_FillRect(joueur.x, joueur.y, Width, Height);
|
BSP_LCD_FillRect(joueur.x, joueur.y, Width, Height);
|
||||||
|
|
||||||
// BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp)
|
// BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp)
|
||||||
|
HAL_ADC_ConfigChannel(&hadc3, &sConfig3);
|
||||||
|
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_h = HAL_ADC_GetValue(&hadc3);
|
||||||
|
|
||||||
|
HAL_ADC_ConfigChannel(&hadc1, &sConfig1);
|
||||||
|
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_v = HAL_ADC_GetValue(&hadc1);
|
||||||
|
|
||||||
if ((joueur.y < LCD_HEIGHT- Width - joueur.dy)&&(joystick_h < 1900)) joueur.y += joueur.dy;
|
if ((joueur.y < LCD_WIDTH- Width - joueur.dy)&&(joystick_h < 1900)) joueur.y += joueur.dy;
|
||||||
if ((joueur.y > Width + joueur.dy)&&(joystick_h > 2100)) joueur.y -= joueur.dy;
|
if ((joueur.y > joueur.dy)&&(joystick_h > 2100)) joueur.y -= joueur.dy;
|
||||||
|
|
||||||
if ((joueur.x > LCD_WIDTH + joueur.dx)&&(joystick_v < 1900)) joueur.x += joueur.dx;
|
if ((joueur.x < LCD_HEIGHT - Height - joueur.dx)&&(joystick_v < 1900)) joueur.x += joueur.dx;
|
||||||
if ((joueur.x < 480-Height - joueur.dx)&&(joystick_v > 2100)) joueur.x -= joueur.dx;
|
if ((joueur.x > joueur.dx)&&(joystick_v > 2100)) joueur.x -= joueur.dx;
|
||||||
|
|
||||||
|
|
||||||
BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
|
BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
|
||||||
|
|
Binary file not shown.
|
@ -23,8 +23,8 @@ main.c:1337:13:MX_FMC_Init 40 static
|
||||||
main.c:1388:13:MX_GPIO_Init 72 static
|
main.c:1388:13:MX_GPIO_Init 72 static
|
||||||
main.c:1565:5:envoie_score 16 static
|
main.c:1565:5:envoie_score 16 static
|
||||||
main.c:1581:6:f_GameMaster 32 static
|
main.c:1581:6:f_GameMaster 32 static
|
||||||
main.c:1628:6:f_Joueur_1 80 static
|
main.c:1628:6:f_Joueur_1 96 static
|
||||||
main.c:1699:6:f_block_enemie 1016 static
|
main.c:1710:6:f_block_enemie 1016 static
|
||||||
main.c:1752:6:f_projectile 384 static
|
main.c:1763:6:f_projectile 384 static
|
||||||
main.c:1842:6:HAL_TIM_PeriodElapsedCallback 16 static
|
main.c:1853:6:HAL_TIM_PeriodElapsedCallback 16 static
|
||||||
main.c:1859:6:Error_Handler 4 static,ignoring_inline_asm
|
main.c:1870:6:Error_Handler 4 static,ignoring_inline_asm
|
||||||
|
|
Binary file not shown.
Binary file not shown.
100240
Debug/Space_Invaders.list
100240
Debug/Space_Invaders.list
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,14 +1,12 @@
|
||||||
#MicroXplorer Configuration settings - do not modify
|
#MicroXplorer Configuration settings - do not modify
|
||||||
ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_0
|
ADC1.Channel-1\#ChannelRegularConversion=ADC_CHANNEL_0
|
||||||
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,master,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag
|
ADC1.IPParameters=Rank-1\#ChannelRegularConversion,master,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,NbrOfConversionFlag
|
||||||
ADC1.NbrOfConversionFlag=1
|
ADC1.NbrOfConversionFlag=1
|
||||||
ADC1.Rank-0\#ChannelRegularConversion=1
|
ADC1.Rank-1\#ChannelRegularConversion=1
|
||||||
ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_3CYCLES
|
ADC1.SamplingTime-1\#ChannelRegularConversion=ADC_SAMPLETIME_3CYCLES
|
||||||
ADC1.master=1
|
ADC1.master=1
|
||||||
ADC3.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_6
|
ADC3.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_8
|
||||||
ADC3.Channel-IN4=ADC_CHANNEL_4
|
ADC3.IPParameters=Channel-0\#ChannelRegularConversion
|
||||||
ADC3.Channel-IN5=ADC_CHANNEL_5
|
|
||||||
ADC3.IPParameters=Channel-IN5,Channel-0\#ChannelRegularConversion,Channel-IN4
|
|
||||||
ETH.IPParameters=MediaInterface
|
ETH.IPParameters=MediaInterface
|
||||||
ETH.MediaInterface=ETH_MEDIA_INTERFACE_RMII
|
ETH.MediaInterface=ETH_MEDIA_INTERFACE_RMII
|
||||||
FREERTOS.FootprintOK=true
|
FREERTOS.FootprintOK=true
|
||||||
|
@ -477,10 +475,8 @@ PF7.Locked=true
|
||||||
PF7.Mode=Asynchronous
|
PF7.Mode=Asynchronous
|
||||||
PF7.Signal=UART7_TX
|
PF7.Signal=UART7_TX
|
||||||
PF8.Locked=true
|
PF8.Locked=true
|
||||||
PF8.Mode=IN6
|
|
||||||
PF8.Signal=ADC3_IN6
|
PF8.Signal=ADC3_IN6
|
||||||
PF9.Locked=true
|
PF9.Locked=true
|
||||||
PF9.Mode=IN7
|
|
||||||
PF9.Signal=ADC3_IN7
|
PF9.Signal=ADC3_IN7
|
||||||
PG0.Signal=FMC_A10
|
PG0.Signal=FMC_A10
|
||||||
PG1.Signal=FMC_A11
|
PG1.Signal=FMC_A11
|
||||||
|
@ -770,7 +766,7 @@ ProjectManager.StackSize=0x400
|
||||||
ProjectManager.TargetToolchain=STM32CubeIDE
|
ProjectManager.TargetToolchain=STM32CubeIDE
|
||||||
ProjectManager.ToolChainLocation=
|
ProjectManager.ToolChainLocation=
|
||||||
ProjectManager.UnderRoot=true
|
ProjectManager.UnderRoot=true
|
||||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_ADC3_Init-ADC3-false-HAL-true,4-MX_I2C1_Init-I2C1-false-HAL-true,5-MX_I2C3_Init-I2C3-false-HAL-true,6-MX_LTDC_Init-LTDC-false-HAL-true,7-MX_RTC_Init-RTC-false-HAL-true,8-MX_SPI2_Init-SPI2-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM2_Init-TIM2-false-HAL-true,11-MX_TIM3_Init-TIM3-false-HAL-true,12-MX_TIM5_Init-TIM5-false-HAL-true,13-MX_TIM8_Init-TIM8-false-HAL-true,14-MX_USART1_UART_Init-USART1-false-HAL-true,15-MX_USART6_UART_Init-USART6-false-HAL-true,16-MX_ADC1_Init-ADC1-false-HAL-true,17-MX_DAC_Init-DAC-false-HAL-true,18-MX_UART7_Init-UART7-false-HAL-true,19-MX_FMC_Init-FMC-false-HAL-true,20-MX_DMA2D_Init-DMA2D-false-HAL-true,21-MX_CRC_Init-CRC-false-HAL-true,22-MX_RNG_Init-RNG-false-HAL-true,23-MX_LWIP_Init-LWIP-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_ADC3_Init-ADC3-false-HAL-true,4-MX_I2C1_Init-I2C1-false-HAL-true,5-MX_I2C3_Init-I2C3-false-HAL-true,6-MX_LTDC_Init-LTDC-false-HAL-true,7-MX_RTC_Init-RTC-false-HAL-true,8-MX_SPI2_Init-SPI2-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM2_Init-TIM2-false-HAL-true,11-MX_TIM3_Init-TIM3-false-HAL-true,12-MX_TIM5_Init-TIM5-false-HAL-true,13-MX_TIM8_Init-TIM8-false-HAL-true,14-MX_USART1_UART_Init-USART1-false-HAL-true,15-MX_USART6_UART_Init-USART6-false-HAL-true,16-MX_DAC_Init-DAC-false-HAL-true,17-MX_UART7_Init-UART7-false-HAL-true,18-MX_FMC_Init-FMC-false-HAL-true,19-MX_DMA2D_Init-DMA2D-false-HAL-true,20-MX_CRC_Init-CRC-false-HAL-true,21-MX_RNG_Init-RNG-false-HAL-true,22-MX_LWIP_Init-LWIP-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
||||||
RCC.AHBFreq_Value=200000000
|
RCC.AHBFreq_Value=200000000
|
||||||
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
||||||
RCC.APB1Freq_Value=50000000
|
RCC.APB1Freq_Value=50000000
|
||||||
|
|
Loading…
Reference in a new issue