Commit 54187b7e authored by 王佳伟's avatar 王佳伟

feat:新增适配天马屏

parent 078925ad
......@@ -340,56 +340,59 @@ void AIM951_i2c_sendreceive(uint8_t sendreceive_addr, uint8_t *receive_data)
BSP_WDT_Clear();
}
void switch_951_init(uint8_t work_mode)
{
if (work_mode == 0)
void switch_951_init(void)
{
AIM951_i2c_send(0xFF, 0x00);
AIM951_i2c_send(0x08, 0xAC);
AIM951_i2c_send(0x68, 0x02);
AIM951_i2c_send(0x04, 0x70);
AIM951_i2c_send(0xFF, 0x05);
AIM951_i2c_send(0x1B, 0x00);
AIM951_i2c_send(0x1F, 0x08);
AIM951_i2c_send(0xFF, 0x08);
AIM951_i2c_send(0x88, 0x1F);
AIM951_i2c_send(0xFF, 0x04);
AIM951_i2c_send(0x03, 0x50);
AIM951_i2c_send(0xFF, 0x03);
AIM951_i2c_send(0x03, 0x50);
// 1222
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x44, 0x0B);
BSP_Delay_ms(10);
AIM951_i2c_send(0x50, 0xC0);
BSP_Delay_ms(10);
AIM951_i2c_send(0x51, 0xF0);
BSP_Delay_ms(10);
AIM951_i2c_send(0x3B, 0x4C);
BSP_Delay_ms(10);
// 951 iic mapping
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x0E, 0x34);
BSP_Delay_ms(10);
AIM951_i2c_send(0x16, 0x34);
BSP_Delay_ms(10);
// intb enable
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x93, 0x10);
BSP_Delay_ms(10);
AIM951_i2c_send(0x5c, 0x21);
BSP_Delay_ms(10);
// 951 init end
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x04, 0x50);
BSP_Delay_ms(10);
AIM951_i2c_send(0x3B, 0xCC);
BSP_Delay_ms(10);
if(Touch_Status()== 0)
{
AIM951_i2c_send(0xFF, 0x00);
AIM951_i2c_send(0x08, 0xAC);
AIM951_i2c_send(0x68, 0x02);
AIM951_i2c_send(0x04, 0x70);
AIM951_i2c_send(0xFF, 0x05);
AIM951_i2c_send(0x1B, 0x00);
AIM951_i2c_send(0x1F, 0x08);
AIM951_i2c_send(0xFF, 0x08);
AIM951_i2c_send(0x88, 0x1F);
AIM951_i2c_send(0xFF, 0x04);
AIM951_i2c_send(0x03, 0x50);
AIM951_i2c_send(0xFF, 0x03);
AIM951_i2c_send(0x03, 0x50);
// 1112
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x44, 0x0A);
BSP_Delay_ms(10);
AIM951_i2c_send(0x50, 0xC0);
BSP_Delay_ms(10);
AIM951_i2c_send(0x51, 0x30);
BSP_Delay_ms(10);
AIM951_i2c_send(0x3B, 0x4C);
BSP_Delay_ms(10);
// 951 iic mapping
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x0E, 0x34);
BSP_Delay_ms(10);
AIM951_i2c_send(0x16, 0x34);
BSP_Delay_ms(10);
// INTB init
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x93, 0x10);
BSP_Delay_ms(10);
AIM951_i2c_send(0x5C, 0x21);
BSP_Delay_ms(10);
// 951 init end
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x04, 0x50);
BSP_Delay_ms(10);
AIM951_i2c_send(0x3B, 0xCC);
BSP_Delay_ms(10);
// 951 patternGen 1920*720P60 1222 mode
// 951 patternGen 1920*720P60 1222 mode 纯色(最初屏参)
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x5F, 0x60);
......@@ -424,76 +427,18 @@ void switch_951_init(uint8_t work_mode)
BSP_Delay_ms(10);
AIM951_i2c_send(0x11, 0x03);
BSP_Delay_ms(10);
AIM951_i2c_send(0x02, 0x44);
BSP_Delay_ms(10);
AIM951_i2c_send(0x00, 0x05);
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x31, 0x33);
AIM951_i2c_send(0x02, 0x06);
BSP_Delay_ms(10);
GPIO_OUT_PORT08_PIN12 = 1U;
GPIO_OUT_PORT08_PIN09 = 1U;
AIM951_i2c_send(0x00, 0x23);
}
if (work_mode == 1)
else
{
AIM951_i2c_send(0xFF, 0x00);
AIM951_i2c_send(0x08, 0xAC);
AIM951_i2c_send(0x68, 0x02);
AIM951_i2c_send(0x04, 0x70);
AIM951_i2c_send(0xFF, 0x05);
AIM951_i2c_send(0x1B, 0x00);
AIM951_i2c_send(0x1F, 0x08);
AIM951_i2c_send(0xFF, 0x08);
AIM951_i2c_send(0x88, 0x1F);
AIM951_i2c_send(0xFF, 0x04);
AIM951_i2c_send(0x03, 0x50);
AIM951_i2c_send(0xFF, 0x03);
AIM951_i2c_send(0x03, 0x50);
// 1222
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x44, 0x0B);
BSP_Delay_ms(10);
AIM951_i2c_send(0x50, 0xC0);
BSP_Delay_ms(10);
AIM951_i2c_send(0x51, 0xF0);
BSP_Delay_ms(10);
AIM951_i2c_send(0x3B, 0x4C);
BSP_Delay_ms(10);
// 951 iic mapping
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x0E, 0x34);
BSP_Delay_ms(10);
AIM951_i2c_send(0x16, 0x34);
BSP_Delay_ms(10);
// intb enable
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x93, 0x10);
BSP_Delay_ms(10);
AIM951_i2c_send(0x5c, 0x21);
BSP_Delay_ms(10);
// 951 init end
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x04, 0x50);
BSP_Delay_ms(10);
AIM951_i2c_send(0x3B, 0xCC);
BSP_Delay_ms(10);
// 951 patternGen 1920*720P60 1222 mode 纯色
// 951 patternGen 1920*720P60 1222 mode 纯色(更新后 天马屏参)
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x5F, 0x60);
BSP_Delay_ms(10);
AIM951_i2c_send(0x84, 0x15);
AIM951_i2c_send(0x84, 0x13);
BSP_Delay_ms(10);
AIM951_i2c_send(0x8C, 0x01);
BSP_Delay_ms(10);
......@@ -503,9 +448,9 @@ void switch_951_init(uint8_t work_mode)
BSP_Delay_ms(10);
AIM951_i2c_send(0x07, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x08, 0xD9);
AIM951_i2c_send(0x08, 0x0D);
BSP_Delay_ms(10);
AIM951_i2c_send(0x09, 0x82);
AIM951_i2c_send(0x09, 0x83);
BSP_Delay_ms(10);
AIM951_i2c_send(0x0A, 0x80);
BSP_Delay_ms(10);
......@@ -513,28 +458,28 @@ void switch_951_init(uint8_t work_mode)
BSP_Delay_ms(10);
AIM951_i2c_send(0x0C, 0x72);
BSP_Delay_ms(10);
AIM951_i2c_send(0x0D, 0x28);
AIM951_i2c_send(0x0D, 0x20);
BSP_Delay_ms(10);
AIM951_i2c_send(0x0E, 0x02);
AIM951_i2c_send(0x0E, 0x08);
BSP_Delay_ms(10);
AIM951_i2c_send(0x0F, 0x28);
AIM951_i2c_send(0x0F, 0x20);
BSP_Delay_ms(10);
AIM951_i2c_send(0x10, 0x02);
AIM951_i2c_send(0x10, 0x08);
BSP_Delay_ms(10);
AIM951_i2c_send(0x11, 0x03);
BSP_Delay_ms(10);
AIM951_i2c_send(0x02, 0x06);
BSP_Delay_ms(10);
AIM951_i2c_send(0x00, 0x23);
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x31, 0x33);
AIM951_i2c_send(0x02, 0x44);
BSP_Delay_ms(10);
GPIO_OUT_PORT08_PIN12 = 1U;
GPIO_OUT_PORT08_PIN09 = 1U;
AIM951_i2c_send(0x00, 0x05);
BSP_Delay_ms(10);
}
AIM951_i2c_send(0xFF, 0x00);
BSP_Delay_ms(10);
AIM951_i2c_send(0x31, 0x33);
BSP_Delay_ms(10);
GPIO_OUT_PORT08_PIN12 = 1U;
GPIO_OUT_PORT08_PIN09 = 1U;
}
// void switch_951_3G_6G(uint8_t work_mode)
......@@ -698,7 +643,7 @@ void switch_951_Color(uint8_t in)
case 0://白
AIM951_i2c_send(0xFF, 0x01);
BSP_Delay_ms(10);
AIM951_i2c_send(0x02, 0x04);
AIM951_i2c_send(0x02, 0x44);
BSP_Delay_ms(10);
AIM951_i2c_send(0x00, 0x13);
BSP_Delay_ms(10);
......@@ -707,7 +652,7 @@ void switch_951_Color(uint8_t in)
case 1://黑
AIM951_i2c_send(0xFF, 0x01);
BSP_Delay_ms(10);
AIM951_i2c_send(0x02, 0x04);
AIM951_i2c_send(0x02, 0x44);
BSP_Delay_ms(10);
AIM951_i2c_send(0x00, 0x23);
BSP_Delay_ms(10);
......@@ -716,7 +661,7 @@ void switch_951_Color(uint8_t in)
case 2://红
AIM951_i2c_send(0xFF, 0x01);
BSP_Delay_ms(10);
AIM951_i2c_send(0x02, 0x04);
AIM951_i2c_send(0x02, 0x44);
BSP_Delay_ms(10);
AIM951_i2c_send(0x00, 0x33);
BSP_Delay_ms(10);
......@@ -725,7 +670,7 @@ void switch_951_Color(uint8_t in)
case 3://绿
AIM951_i2c_send(0xFF, 0x01);
BSP_Delay_ms(10);
AIM951_i2c_send(0x02, 0x04);
AIM951_i2c_send(0x02, 0x44);
BSP_Delay_ms(10);
AIM951_i2c_send(0x00, 0x43);
BSP_Delay_ms(10);
......@@ -734,7 +679,7 @@ void switch_951_Color(uint8_t in)
case 4://蓝
AIM951_i2c_send(0xFF, 0x01);
BSP_Delay_ms(10);
AIM951_i2c_send(0x02, 0x04);
AIM951_i2c_send(0x02, 0x44);
BSP_Delay_ms(10);
AIM951_i2c_send(0x00, 0x53);
BSP_Delay_ms(10);
......@@ -755,12 +700,6 @@ void switch_951_Color(uint8_t in)
}
void init_951(void)
{
AIM951_i2c_send(0xFF, 0x01);
BSP_Delay_ms(10);
AIM951_i2c_send(0x02, 0x04);
BSP_Delay_ms(10);
AIM951_i2c_send(0x00, 0x23);
BSP_Delay_ms(10);
switch_951_init(1);
switch_951_init();
}
......@@ -101,7 +101,7 @@ uint8_t gpio_get_96751_lock(void);
//void init_96751(void);
void init_951(void);
//void switch_96751_3G_6G(uint8_t in);
void switch_951_init(uint8_t work_mode);
void switch_951_init(void);
void switch_951_Color(uint8_t in);
void AIM951_i2c_send(uint8_t addr, uint8_t data);
void AIM951_i2c_sendreceive(uint8_t sendreceive_addr,uint8_t *receive_data);
......
......@@ -29,6 +29,10 @@ uint32_t pwm_data;
uint32_t pwm_load_data;
uint8_t lock_flag = 0;
uint8_t Touch_data_last = 0;
uint8_t Touch_data_status = 0;
uint8_t Touch_Flag = 1;
uint32_t size;
uint32_t count;
......@@ -408,7 +412,7 @@ void fx12_test_server(void)
tft_switch_switch = 1;
}
TFT_LCD_Draw_Bmp(1, 32, (uint8_t *)gImage_point_right[1]); // 仪表选择显示
switch_951_init(1);
//switch_951_init();
}
}
else
......@@ -517,6 +521,11 @@ void fx12_test_server(void)
{
key3_flag = 0;
}
if(Touch_data_status == 1)
{
Touch_data_status = 0;
switch_951_init();
}
// lock功能检测
if (gpio_get_96751_lock() == 0)
......@@ -582,7 +591,7 @@ void fx12_test_server(void)
if (recive_buf[0] != 0x19)
{
version_flag = 0;
switch_951_init(1);
switch_951_init();
TFT_LCD_Draw_Bmp(80, 144, (uint8_t *)D[0]);
TFT_LCD_Draw_Bmp(116, 144, (uint8_t *)D[0]);
TFT_LCD_Draw_Bmp(152, 144, (uint8_t *)D[0]);
......@@ -640,6 +649,23 @@ void fx12_test_server(void)
touch_buff[11],
touch_buff[12]);
}
else if(touch_buff[0] == 0x4AU)
{
if(touch_buff[3] != Touch_data_last)
{
Touch_data_status = 1;
Touch_data_last = touch_buff[3];
if(touch_buff[3] == 0x04)
{
Touch_Flag = 1;
}
else
{
Touch_Flag = 0;
}
}
}
Clear_TOUCH_IRQHandler_flag();
}
}
......@@ -648,3 +674,8 @@ void BSP_SetBL_Brightness_PWM(uint32_t in)
{
PWM_Channel_Set_Duty(7, in); // 设置屏幕背光占空比
}
uint8_t Touch_Status(void)
{
return Touch_Flag;
}
......@@ -10,6 +10,6 @@
void Display_Init(void);
void fx12_test_server(void);
void BSP_SetBL_Brightness_PWM(uint32_t in);
extern uint8_t Touch_Status(void);
#endif /* MV1_TOUCH_TEST_H_ */
This diff is collapsed.
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