Commit 154c9f0a authored by 李冠华's avatar 李冠华

🐞 fix:增加段码屏热插拔功能

parent adbda899
......@@ -14,6 +14,8 @@
#define BU98R10_NOP_TIME 5U
static uint16_t BU98R10ResetCount = 0;
uint8_t BU98R10_CHIP0_GET_SD_LEVEL(void);
uint8_t BU98R10_CHIP0_GET_SD_LEVEL(void)
{
......@@ -280,6 +282,7 @@ uint32_t u32BU98R10ForcedUpdate = 0UL;
void BU98R10_Init(void)
{
uint8_t i;
BU98R10ResetCount = 0;
#if BU98R10_WRITE_AT_SAME_TIME
#if BU98R10_COLORFUL_LCD_MODE
......@@ -563,6 +566,88 @@ void BU98R10_Init(void)
#endif
}
/*****************************************************************************************************
* @brief BU98R10_Reset
*
* @version 0.1
* @author (kaiwen.jiang@hljtyw.com)
* @date 2024-11-07
* @copyright Copyright (c) 2024
*
* 1s调用一次
*****************************************************************************************************/
void BU98R10_Reset(void)
{
// uint8_t i;
/* IC模式复位 */
BU98R10_0_Command_Write(BU98R10_CMD_ICSET | BU98R10_PAR_ICSET_RGB);
BU98R10_1_Command_Write(BU98R10_CMD_ICSET | BU98R10_PAR_ICSET_RGB);
/* 驱动控制复位 */
BU98R10_0_Command_Write(BU98R10_CMD_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
BU98R10_1_Command_Write(BU98R10_CMD_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
/* 设置段码频率,0x98是指令,0x08是值(120hz) */
BU98R10_0_Command_Write(BU98R10_CMD_FREQ);
BU98R10_0_Data_Write(BU98R10_FRAME_FREQ);
BU98R10_1_Command_Write(BU98R10_CMD_FREQ);
BU98R10_1_Data_Write(BU98R10_FRAME_FREQ);
/* LED控制 */
// BU98R10_0_Command_Write(BU98R10_CMD_LED_CTRL);
// BU98R10_0_Data_Write(0x12u);
/* 定时控制--R段 */
// BU98R10_0_Command_Write(BU98R10_CMD_SEG_R);
// BU98R10_0_Data_Write(BU98R10_REG_SEG_R);
/* 定时控制--G段 */
// BU98R10_0_Command_Write(BU98R10_CMD_SEG_G);
// BU98R10_0_Data_Write(BU98R10_REG_SEG_G);
/* 定时控制--B段 */
// BU98R10_0_Command_Write(BU98R10_CMD_SEG_B);
// BU98R10_0_Data_Write(BU98R10_REG_SEG_B);
/**< 灰度------------------------------------------------- */
// BU98R10_All_Command_Write(BU98R10_CMD_LED_STARTR);
// BU98R10_All_Data_Write(BU98R10_LRS, BU98R10_LRS);
// BU98R10_All_Command_Write(BU98R10_CMD_LED_STARTG);
// BU98R10_All_Data_Write(BU98R10_LGS, BU98R10_LGS);
// BU98R10_All_Command_Write(BU98R10_CMD_LED_STARTB);
// BU98R10_All_Data_Write(BU98R10_LBS, BU98R10_LBS);
// BU98R10_All_Command_Write(BU98R10_CMD_LED_WIDTHR);
// BU98R10_All_Data_Write(BU98R10_LRW, BU98R10_LRW);
// BU98R10_All_Command_Write(BU98R10_CMD_LED_WIDTHG);
// BU98R10_All_Data_Write(BU98R10_LGW, BU98R10_LGW);
// BU98R10_All_Command_Write(BU98R10_CMD_LED_WIDTHB);
// BU98R10_All_Data_Write(BU98R10_LBW, BU98R10_LBW);
/**< 灰度------------------------------------------------- */
/* 设置RAM地址 */
// BU98R10_0_Command_Write(BU98R10_CMD_ADSET);
// BU98R10_0_Data_Write(0x00u);
/* 写入数据 */
// BU98R10_All_Command_Write(BU98R10_CMD_DATWR);
// for (i = 0; i < BU98R10_DDRAM_SIZE; i++)
// {
// BU98R10_All_Data_Write(BU98R10Chip0DDRAMBackup.Byte[i], BU98R10Chip1DDRAMBackup.Byte[i]);
// }
/* 正常显示模式 */
BU98R10_0_Command_Write(BU98R10_CMD_DISPON);
BU98R10_1_Command_Write(BU98R10_CMD_DISPON);
}
void BU98R10_Shutdown(void)
{
#if BU98R10_WRITE_AT_SAME_TIME
......@@ -581,6 +666,19 @@ void BU98R10_Shutdown(void)
#define BU98R10_FORCED_SEG_NUM 2U
void BU98R10_Update_Request(void)
{
if (BU98R10ResetCount >= 100)
{
if (BU98R10Update.En == 0)
{
BU98R10_Reset();
BU98R10ResetCount = 0u;
}
}
else
{
BU98R10ResetCount++;
}
if (BU98R10Update.En == 0)
{
if (u32BU98R10ForcedUpdate <= (BU98R10_DDRAM_SIZE - BU98R10_FORCED_SEG_NUM))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment