From 057fe64a60bd19de3cf08e33defd2bb15a60bbfc Mon Sep 17 00:00:00 2001 From: Muhammad Lutfi Santoso Date: Wed, 10 Oct 2018 23:27:30 +0700 Subject: [PATCH] Update ILI9341_GFX.c change &hspi5 to HSPI_INSTANCE and port & pin so just edit ILI9341_STM32_Driver.h if use different pin and spi --- Src/ILI9341/ILI9341_GFX.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Src/ILI9341/ILI9341_GFX.c b/Src/ILI9341/ILI9341_GFX.c index 0de05d2..007cd01 100644 --- a/Src/ILI9341/ILI9341_GFX.c +++ b/Src/ILI9341/ILI9341_GFX.c @@ -278,8 +278,8 @@ void ILI9341_Draw_Image(const char* Image_Array, uint8_t Orientation) ILI9341_Set_Rotation(SCREEN_HORIZONTAL_1); ILI9341_Set_Address(0,0,ILI9341_SCREEN_WIDTH,ILI9341_SCREEN_HEIGHT); - HAL_GPIO_WritePin(GPIOC, DC_Pin, GPIO_PIN_SET); - HAL_GPIO_WritePin(GPIOC, CS_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(LCD_DC_PORT, LCD_DC_PIN, GPIO_PIN_SET); + HAL_GPIO_WritePin(LCD_CS_PORT, LCD_CS_PIN, GPIO_PIN_RESET); unsigned char Temp_small_buffer[BURST_MAX_SIZE]; uint32_t counter = 0; @@ -289,18 +289,18 @@ void ILI9341_Draw_Image(const char* Image_Array, uint8_t Orientation) { Temp_small_buffer[k] = Image_Array[counter+k]; } - HAL_SPI_Transmit(&hspi5, (unsigned char*)Temp_small_buffer, BURST_MAX_SIZE, 10); + HAL_SPI_Transmit(HSPI_INSTANCE, (unsigned char*)Temp_small_buffer, BURST_MAX_SIZE, 10); counter += BURST_MAX_SIZE; } - HAL_GPIO_WritePin(GPIOC, CS_Pin, GPIO_PIN_SET); + HAL_GPIO_WritePin(LCD_CS_PORT, LCD_CS_PIN, GPIO_PIN_SET); } else if(Orientation == SCREEN_HORIZONTAL_2) { ILI9341_Set_Rotation(SCREEN_HORIZONTAL_2); ILI9341_Set_Address(0,0,ILI9341_SCREEN_WIDTH,ILI9341_SCREEN_HEIGHT); - HAL_GPIO_WritePin(GPIOC, DC_Pin, GPIO_PIN_SET); - HAL_GPIO_WritePin(GPIOC, CS_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(LCD_DC_PORT, LCD_DC_PIN, GPIO_PIN_SET); + HAL_GPIO_WritePin(LCD_CS_PORT, LCD_CS_PIN, GPIO_PIN_RESET); unsigned char Temp_small_buffer[BURST_MAX_SIZE]; uint32_t counter = 0; @@ -310,18 +310,18 @@ void ILI9341_Draw_Image(const char* Image_Array, uint8_t Orientation) { Temp_small_buffer[k] = Image_Array[counter+k]; } - HAL_SPI_Transmit(&hspi5, (unsigned char*)Temp_small_buffer, BURST_MAX_SIZE, 10); + HAL_SPI_Transmit(HSPI_INSTANCE, (unsigned char*)Temp_small_buffer, BURST_MAX_SIZE, 10); counter += BURST_MAX_SIZE; } - HAL_GPIO_WritePin(GPIOC, CS_Pin, GPIO_PIN_SET); + HAL_GPIO_WritePin(LCD_CS_PORT, LCD_CS_PIN, GPIO_PIN_SET); } else if(Orientation == SCREEN_VERTICAL_2) { ILI9341_Set_Rotation(SCREEN_VERTICAL_2); ILI9341_Set_Address(0,0,ILI9341_SCREEN_HEIGHT,ILI9341_SCREEN_WIDTH); - HAL_GPIO_WritePin(GPIOC, DC_Pin, GPIO_PIN_SET); - HAL_GPIO_WritePin(GPIOC, CS_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(LCD_DC_PORT, LCD_DC_PIN, GPIO_PIN_SET); + HAL_GPIO_WritePin(LCD_CS_PORT, LCD_CS_PIN, GPIO_PIN_RESET); unsigned char Temp_small_buffer[BURST_MAX_SIZE]; uint32_t counter = 0; @@ -331,18 +331,18 @@ void ILI9341_Draw_Image(const char* Image_Array, uint8_t Orientation) { Temp_small_buffer[k] = Image_Array[counter+k]; } - HAL_SPI_Transmit(&hspi5, (unsigned char*)Temp_small_buffer, BURST_MAX_SIZE, 10); + HAL_SPI_Transmit(HSPI_INSTANCE, (unsigned char*)Temp_small_buffer, BURST_MAX_SIZE, 10); counter += BURST_MAX_SIZE; } - HAL_GPIO_WritePin(GPIOC, CS_Pin, GPIO_PIN_SET); + HAL_GPIO_WritePin(LCD_CS_PORT, LCD_CS_PIN, GPIO_PIN_SET); } else if(Orientation == SCREEN_VERTICAL_1) { ILI9341_Set_Rotation(SCREEN_VERTICAL_1); ILI9341_Set_Address(0,0,ILI9341_SCREEN_HEIGHT,ILI9341_SCREEN_WIDTH); - HAL_GPIO_WritePin(GPIOC, DC_Pin, GPIO_PIN_SET); - HAL_GPIO_WritePin(GPIOC, CS_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(LCD_DC_PORT, LCD_DC_PIN, GPIO_PIN_SET); + HAL_GPIO_WritePin(LCD_CS_PORT, LCD_CS_PIN, GPIO_PIN_RESET); unsigned char Temp_small_buffer[BURST_MAX_SIZE]; uint32_t counter = 0; @@ -352,10 +352,10 @@ void ILI9341_Draw_Image(const char* Image_Array, uint8_t Orientation) { Temp_small_buffer[k] = Image_Array[counter+k]; } - HAL_SPI_Transmit(&hspi5, (unsigned char*)Temp_small_buffer, BURST_MAX_SIZE, 10); + HAL_SPI_Transmit(HSPI_INSTANCE, (unsigned char*)Temp_small_buffer, BURST_MAX_SIZE, 10); counter += BURST_MAX_SIZE; } - HAL_GPIO_WritePin(GPIOC, CS_Pin, GPIO_PIN_SET); + HAL_GPIO_WritePin(LCD_CS_PORT, LCD_CS_PIN, GPIO_PIN_SET); } }