Skip to content

Commit

Permalink
fix ac6 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
YXZhu committed Nov 26, 2023
1 parent a52bfd8 commit 7af5e79
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions SDK/STM32F411CEU6/HAL/F411_ST7735/Hardware/ST7735/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,50 +275,58 @@ static int32_t lcd_gettick(void)

static int32_t lcd_writereg(uint8_t reg,uint8_t* pdata,uint32_t length)
{
int32_t result;
HAL_StatusTypeDef result;
LCD_CS_RESET;
LCD_RS_RESET;
result = HAL_SPI_Transmit(SPI_Drv,&reg,1,100);
LCD_RS_SET;
if(length > 0)
result += HAL_SPI_Transmit(SPI_Drv,pdata,length,500);
LCD_CS_SET;
result /= -result;
return result;
if(result != HAL_OK)
return -1;
else
return 0;
}

static int32_t lcd_readreg(uint8_t reg,uint8_t* pdata)
{
int32_t result;
HAL_StatusTypeDef result;
LCD_CS_RESET;
LCD_RS_RESET;
result = HAL_SPI_Transmit(SPI_Drv,&reg,1,100);
LCD_RS_SET;
result += HAL_SPI_Receive(SPI_Drv,pdata,1,500);
LCD_CS_SET;
result /= -result;
return result;
if(result != HAL_OK)
return -1;
else
return 0;
}

static int32_t lcd_senddata(uint8_t* pdata,uint32_t length)
{
int32_t result;
HAL_StatusTypeDef result;
LCD_CS_RESET;
//LCD_RS_SET;
result =HAL_SPI_Transmit(SPI_Drv,pdata,length,100);
LCD_CS_SET;
result /= -result;
return result;
if(result != HAL_OK)
return -1;
else
return 0;
}

static int32_t lcd_recvdata(uint8_t* pdata,uint32_t length)
{
int32_t result;
HAL_StatusTypeDef result;
LCD_CS_RESET;
//LCD_RS_SET;
result = HAL_SPI_Receive(SPI_Drv,pdata,length,500);
LCD_CS_SET;
result /= -result;
return result;
if(result != HAL_OK)
return -1;
else
return 0;
}

0 comments on commit 7af5e79

Please sign in to comment.