#include "main.h"

SPI_HandleTypeDef hspi1;

/* TFT display settings */
#define TFT_WIDTH  240
#define TFT_HEIGHT 320

/* Pin definitions for TFT control */
#define TFT_CS_PIN    GPIO_PIN_4
#define TFT_CS_PORT   GPIOA
#define TFT_DC_PIN    GPIO_PIN_1
#define TFT_DC_PORT   GPIOA
#define TFT_RST_PIN   GPIO_PIN_0
#define TFT_RST_PORT  GPIOA

/* Color definitions (RGB565 format) */
#define BLACK    0x0000
#define BLUE     0x001F
#define RED      0xF800
#define GREEN    0x07E0
#define WHITE    0xFFFF

void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_SPI1_Init(void);
void Error_Handler(void);

/* Private function prototypes for TFT control */
static void TFT_Select(void);
static void TFT_Deselect(void);
static void TFT_DataMode(void);
static void TFT_CommandMode(void);
static void TFT_WriteCommand(uint8_t cmd);
static void T?FT_WriteData(uint8_t data);
static void TFT_Reset(void);
static void TFT_Init(void);
static void TFT_FillScreen(uint16_t color);

/**
  * @brief  Select TFT (set CS low)
  * @retval None
  */
static void TFT_Select(void) {
    HAL_GPIO_WritePin(TFT_CS_PORT, TFT_CS_PIN, GPIO_PIN_RESET);
}

/**
  * @brief  Deselect TFT (set CS high)
  * @retval None
  */
static void TFT_Deselect(void) {
    HAL_GPIO_WritePin(TFT_CS_PORT, TFT_CS_PIN, GPIO_PIN_SET);
}

/**
  * @brief  Set TFT to data mode (set DC high)
  * @retval None
  */
static void TFT_DataMode(void) {
    HAL_GPIO_WritePin(TFT_DC_PORT, TFT_DC_PIN, GPIO_PIN_SET);
}

/**
  * @brief  Set TFT to command mode (set DC low)
  * @retval None
  */
static void TFT_CommandMode(void) {
    HAL_GPIO_WritePin(TFT_DC_PORT, TFT_DC_PIN, GPIO_PIN_RESET);
}

/**
  * @brief  Write a command to the TFT
  * @param  cmd: Command to be sent
  * @retval None
  */
static void TFT_WriteCommand(uint8_t cmd) {
    TFT_CommandMode();
    HAL_SPI_Transmit(&hspi1, &cmd, 1, HAL_MAX_DELAY);
}

/**
  * @brief  Write data to the TFT
  * @param  data: Data to be sent
  * @retval None
  */
static void TFT_WriteData(uint8_t data) {
    TFT_DataMode();
    HAL_SPI_Transmit(&hspi1, &data, 1, HAL_MAX_DELAY);
}

/**
  * @brief  Reset the TFT
  * @retval None
  */
static void TFT_Reset(void) {
    HAL_GPIO_WritePin(TFT_RST_PORT, TFT_RST_PIN, GPIO_PIN_RESET);
    HAL_Delay(100);
    HAL_GPIO_WritePin(TFT_RST_PORT, TFT_RST_PIN, GPIO_PIN_SET);
    HAL_Delay(150);
}

/**
  * @brief  Initialize the TFT display
  * @retval None
  */
static void TFT_Init(void) {
    TFT_Reset();
    TFT_Select();
    
    // Software reset
    TFT_WriteCommand(0x01);
    HAL_Delay(150);
    
    // Power control B
    TFT_WriteCommand(0xCF);
    TFT_WriteData(0x00);
    TFT_WriteData(0xC1);
    TFT_WriteData(0x30);
    
    // Power on sequence control
    TFT_WriteCommand(0xED);
    TFT_WriteData(0x64);
    TFT_WriteData(0x03);
    TFT_WriteData(0x12);
    TFT_WriteData(0x81);
    
    // Driver timing control A
    TFT_WriteCommand(0xE8);
    TFT_WriteData(0x85);
    TFT_WriteData(0x00);
    TFT_WriteData(0x78);
    
    // Power control A
    TFT_WriteCommand(0xCB);
    TFT_WriteData(0x39);
    TFT_WriteData(0x2C);
    TFT_WriteData(0x00);
    TFT_WriteData(0x34);
    TFT_WriteData(0x02);
    
    // Pump ratio control
    TFT_WriteCommand(0xF7);
    TFT_WriteData(0x20);
    
    // Driver timing control B
    TFT_WriteCommand(0xEA);
    TFT_WriteData(0x00);
    TFT_WriteData(0x00);
    
    // Power control 1
    TFT_WriteCommand(0xC0);
    TFT_WriteData(0x23);
    
    // Power control 2
    TFT_WriteCommand(0xC1);
    TFT_WriteData(0x10);
    
    // VCOM control 1
    TFT_WriteCommand(0xC5);
    TFT_WriteData(0x3E);
    TFT_WriteData(0x28);
    
    // VCOM control 2
    TFT_WriteCommand(0xC7);
    TFT_WriteData(0x86);
    
    // Memory Access Control
    TFT_WriteCommand(0x36);
    TFT_WriteData(0x48);  // Portrait with BGR ordering
    
    // Pixel Format Set
    TFT_WriteCommand(0x3A);
    TFT_WriteData(0x55);  // 16-bit color
    
    // Frame Rate Control
    TFT_WriteCommand(0xB1);
    TFT_WriteData(0x00);
    TFT_WriteData(0x18);
    
    // Display Function Control
    TFT_WriteCommand(0xB6);
    TFT_WriteData(0x08);
    TFT_WriteData(0x82);
    TFT_WriteData(0x27);
    
    // 3Gamma Function Disable
    TFT_WriteCommand(0xF2);
    TFT_WriteData(0x00);
    
    // Gamma curve selected
    TFT_WriteCommand(0x26);
    TFT_WriteData(0x01);
    
    // Positive Gamma Correction
    TFT_WriteCommand(0xE0);
    TFT_WriteData(0x0F); TFT_WriteData(0x31); TFT_WriteData(0x2B);
    TFT_WriteData(0x0C); TFT_WriteData(0x0E); TFT_WriteData(0x08);
    TFT_WriteData(0x4E); TFT_WriteData(0xF1); TFT_WriteData(0x37);
    TFT_WriteData(0x07); TFT_WriteData(0x10); TFT_WriteData(0x03);
    TFT_WriteData(0x0E); TFT_WriteData(0x09); TFT_WriteData(0x00);
    
    // Negative Gamma Correction
    TFT_WriteCommand(0xE1);
    TFT_WriteData(0x00); TFT_WriteData(0x0E); TFT_WriteData(0x14);
    TFT_WriteData(0x03); TFT_WriteData(0x11); TFT_WriteData(0x07);
    TFT_WriteData(0x31); TFT_WriteData(0xC1); TFT_WriteData(0x48);
    TFT_WriteData(0x08); TFT_WriteData(0x0F); TFT_WriteData(0x0C);
    TFT_WriteData(0x31); TFT_WriteData(0x36); TFT_WriteData(0x0F);
    
    // Sleep Out
    TFT_WriteCommand(0x11);
    HAL_Delay(150);
    
    // Display On
    TFT_WriteCommand(0x29);
    HAL_Delay(50);
    
    TFT_Deselect();
}

/**
  * @brief  Fill the entire screen with a color
  * @param  color: Color in RGB565 format
  * @retval None
  */
static void TFT_FillScreen(uint16_t color) {
    uint8_t color_high = color >> 8;
    uint8_t color_low = color & 0xFF;
    
    TFT_Select();
    
    // Set column address range (0-239)
    TFT_WriteCommand(0x2A);
    TFT_WriteData(0x00); TFT_WriteData(0x00);
    TFT_WriteData(0x00); TFT_WriteData(0xEF);
    
    // Set page address range (0-319)
    TFT_WriteCommand(0x2B);
    TFT_WriteData(0x00); TFT_WriteData(0x00);
    TFT_WriteData(0x01); TFT_WriteData(0x3F);
    
    // Memory write
    TFT_WriteCommand(0x2C);
    
    // Fill the screen
    TFT_DataMode();
    for (uint32_t i = 0; i < TFT_WIDTH * TFT_HEIGHT; i++) {
        HAL_SPI_Transmit(&hspi1, &color_high, 1, HAL_MAX_DELAY);
        HAL_SPI_Transmit(&hspi1, &color_low, 1, HAL_MAX_DELAY);
    }
    
    TFT_Deselect();
}

/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void) {
    /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
    HAL_Init();
    
    /* Configure the system clock */
    SystemClock_Config();
    
    /* Initialize all configured peripherals */
    MX_GPIO_Init();
    MX_SPI1_Init();
    
    /* Initialize the TFT display */
    TFT_Init();
    
    /* Main loop: fill the screen with different colors */
    while (1) {
        TFT_FillScreen(RED);
        HAL_Delay(1000);
        
        TFT_FillScreen(GREEN);
        HAL_Delay(1000);
        
        TFT_FillScreen(BLUE);
        HAL_Delay(1000);
        
        TFT_FillScreen(WHITE);
        HAL_Delay(1000);
    }
}

/**
  * @brief System Clock Configuration
  * @retval None
  */
void SystemClock_Config(void) {
    RCC_OscInitTypeDef RCC_OscInitStruct = {0};
    RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
    
    /** Configure the main internal regulator output voltage */
    __HAL_RCC_PWR_CLK_ENABLE();
    __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
    
    /** Initializes the RCC Oscillators according to the specified parameters
     * in the RCC_OscInitTypeDef structure.
     */
    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
    RCC_OscInitStruct.HSEState = RCC_HSE_ON;
    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
    RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
    RCC_OscInitStruct.PLL.PLLM = 8;
    RCC_OscInitStruct.PLL.PLLN = 336;
    RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
    RCC_OscInitStruct.PLL.PLLQ = 7;
    if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != 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.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_5) != HAL_OK) {
        Error_Handler();
    }
}

/**
  * @brief SPI1 Initialization
  * @retval None
  */
static void MX_SPI1_Init(void) {
    /* SPI1 parameter configuration */
    hspi1.Instance = SPI1;
    hspi1.Init.Mode = SPI_MODE_MASTER;
    hspi1.Init.Direction = SPI_DIRECTION_2LINES;
    hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
    hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
    hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
    hspi1.Init.NSS = SPI_NSS_SOFT;
    hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
    hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
    hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
    hspi1.In?it.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
    hspi1.Init.CRCPolynomial = 10;
    if (HAL_SPI_Init(&hspi1) != HAL_OK) {
        Error_Handler();
    }
}

/**
  * @brief GPIO Initialization
  * @retval None
  */
static void MX_GPIO_Init(void) {
    GPIO_InitTypeDef GPIO_InitStruct = {0};
    
    /* GPIO Ports Clock Enable */
    __HAL_RCC_GPIOA_CLK_ENABLE();
    
    /* Configure GPIO pins for TFT control: PA0 (RST), PA1 (DC), PA4 (CS) */
    GPIO_InitStruct.Pin = TFT_RST_PIN | TFT_DC_PIN | TFT_CS_PIN;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
    
    /* Set initial states */
    HAL_GPIO_WritePin(TFT_CS_PORT, TFT_CS_PIN, GPIO_PIN_SET);   // Deselect TFT
    HAL_GPIO_WritePin(TFT_DC_PORT, TFT_DC_PIN, GPIO_PIN_RESET); // Command mode
    HAL_GPIO_WritePin(TFT_RST_PORT, TFT_RST_PIN, GPIO_PIN_SET); // Reset inactive
}

/**
  * @brief  This function is executed in case of error occurrence.
  * @retval None
  */
void Error_Handler(void) {
    /* User can add his own implementation to report the HAL error return state */
    __disable_irq();
    while (1) {
    }
}

#ifdef USE_FULL_ASSERT
/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t *file, uint32_t line) {
    /* 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) */
}
#endif /* USE_FULL_ASSERT */
Can you please solve all the errors in this code 
Rebuild started: Project: smart_mirror(TFT)
*** Using Compiler 'V6.18', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Rebuild target 'smart_mirror(TFT)'
../Core/Src/main.c(35): error: variable has incomplete type 'void'
static void T?FT_WriteData(uint8_t data);
            ^
../Core/Src/main.c(35): error: expected ';' after top level declarator
static void T?FT_WriteData(uint8_t data);
             ^
             ;
../Core/Src/main.c(347): error: no member named 'In' in 'struct __SPI_HandleTypeDef'
    hspi1.In?it.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
    ~~~~~ ^
../Core/Src/main.c(347): error: expected ':'
    hspi1.In?it.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
                                                           ^
                                                           : 
../Core/Src/main.c(347): note: to match this '?'
    hspi1.In?it.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
            ^
../Core/Src/main.c(347): error: expected expression
    hspi1.In?it.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
                                                           ^
../Core/Src/main.c(347): error: use of undeclared identifier 'it'
    hspi1.In?it.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
             ^
6 errors generated.
compiling main.c...
assembling startup_stm32f407xx.s...
compiling stm32f4xx_it.c...
compiling stm32f4xx_hal_msp.c...
compiling stm32f4xx_hal_rcc_ex.c...
compiling stm32f4xx_hal_flash.c...
compiling stm32f4xx_hal_rcc.c...
compiling stm32f4xx_hal_rtc.c...
compiling stm32f4xx_hal_rtc_ex.c...
compiling stm32f4xx_hal_flash_ramfunc.c...
compiling stm32f4xx_hal_flash_ex.c...
compiling stm32f4xx_hal_gpio.c...
compiling stm32f4xx_hal_dma_ex.c...
compiling stm32f4xx_hal_pwr.c...
compiling stm32f4xx_hal_pwr_ex.c...
compiling stm32f4xx_hal_dma.c...
compiling stm32f4xx_hal.c...
compiling stm32f4xx_hal_tim.c...
compiling stm32f4xx_hal_exti.c...
compiling stm32f4xx_hal_cortex.c...
compiling stm32f4xx_hal_tim_ex.c...
compiling system_stm32f4xx.c...
compiling stm32f4xx_hal_spi.c...
compiling stm32f4xx_hal_uart.c...
"smart_mirror(TFT)\smart_mirror(TFT).axf" - 6 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:03