增加TP校准功能

This commit is contained in:
邱淑萍 2023-07-05 15:00:38 +08:00
parent 3340d545a8
commit c194a1b790
22 changed files with 16527 additions and 12771 deletions

View File

@ -50,7 +50,7 @@
<InvalidFlash>1</InvalidFlash> <InvalidFlash>1</InvalidFlash>
</TargetStatus> </TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory> <OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>ISP_568T_S21P_20230517</OutputName> <OutputName>ISP_568T_S21P_20230628</OutputName>
<CreateExecutable>1</CreateExecutable> <CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib> <CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile> <CreateHexFile>1</CreateHexFile>
@ -313,7 +313,7 @@
</ArmAdsMisc> </ArmAdsMisc>
<Cads> <Cads>
<interw>1</interw> <interw>1</interw>
<Optim>1</Optim> <Optim>2</Optim>
<oTime>0</oTime> <oTime>0</oTime>
<SplitLS>0</SplitLS> <SplitLS>0</SplitLS>
<OneElfS>1</OneElfS> <OneElfS>1</OneElfS>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637] ; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave --gnu -o.\objects\board.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\board.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\app\demo -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\module_demo -I..\..\src\app\touch -I..\..\src\app\S8 -I..\..\src\app\S9 -I..\CVWL568 -I..\..\src\app\s21p -I.\RTE\_ISP_568T -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 -DISP_568 --omf_browse=.\objects\board.crf ..\..\src\board\board.c] ; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave --gnu -o.\objects\board.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\board.d --cpu=Cortex-M0 --apcs=interwork -O1 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\app\demo -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\module_demo -I..\..\src\app\touch -I..\..\src\app\S8 -I..\..\src\app\S9 -I..\CVWL568 -I..\..\src\app\s21p -I.\RTE\_ISP_568T -IC:\Users\55\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Users\55\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 -DISP_568 --omf_browse=.\objects\board.crf ..\..\src\board\board.c]
THUMB THUMB
AREA ||i.board_Init||, CODE, READONLY, ALIGN=2 AREA ||i.board_Init||, CODE, READONLY, ALIGN=2
@ -42,7 +42,7 @@
AREA ||.rev16_text||, CODE AREA ||.rev16_text||, CODE
THUMB THUMB
EXPORT |__asm___7_board_c_bcd01269____REV16| EXPORT |__asm___7_board_c_bcd01269____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h" #line 467 "C:\\Users\\55\\AppData\\Local\\Arm\\Packs\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___7_board_c_bcd01269____REV16| PROC |__asm___7_board_c_bcd01269____REV16| PROC
#line 468 #line 468

View File

@ -1,5 +1,5 @@
; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637] ; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave --gnu -o.\objects\main.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\main.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\app\demo -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\module_demo -I..\..\src\app\touch -I..\..\src\app\S8 -I..\..\src\app\S9 -I..\CVWL568 -I..\..\src\app\s21p -I.\RTE\_ISP_568T -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 -DISP_568 --omf_browse=.\objects\main.crf ..\..\src\app\main.c] ; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave --gnu -o.\objects\main.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\main.d --cpu=Cortex-M0 --apcs=interwork -O1 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\app\demo -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\module_demo -I..\..\src\app\touch -I..\..\src\app\S8 -I..\..\src\app\S9 -I..\CVWL568 -I..\..\src\app\s21p -I.\RTE\_ISP_568T -IC:\Users\55\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Users\55\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 -DISP_568 --omf_browse=.\objects\main.crf ..\..\src\app\main.c]
THUMB THUMB
AREA ||i.main||, CODE, READONLY, ALIGN=1 AREA ||i.main||, CODE, READONLY, ALIGN=1
@ -12,8 +12,6 @@
;;;11 board_Init(); ;;;11 board_Init();
;;;12 ;;;12
;;;13 while (1) ;;;13 while (1)
000004 e003 B |L1.14|
|L1.6|
;;;14 { ;;;14 {
;;;15 #if _DEMO_DSI_TX_EN ;;;15 #if _DEMO_DSI_TX_EN
;;;16 demo_dsi_tx_case(); ;;;16 demo_dsi_tx_case();
@ -59,14 +57,11 @@
;;;56 ;;;56
;;;57 #if _DEMO_S21P_EN ;;;57 #if _DEMO_S21P_EN
;;;58 S21P_demo(); ;;;58 S21P_demo();
000006 f7fffffe BL S21P_demo 000004 f7fffffe BL S21P_demo
|L1.8|
;;;59 #endif ;;;59 #endif
;;;60 while (1); ;;;60 while (1);
00000a bf00 NOP 000008 e7fe B |L1.8|
|L1.12|
00000c e7fe B |L1.12|
|L1.14|
00000e e7fa B |L1.6|
;;;61 } ;;;61 }
;;;62 } ;;;62 }
ENDP ENDP
@ -78,7 +73,7 @@
AREA ||.rev16_text||, CODE AREA ||.rev16_text||, CODE
THUMB THUMB
EXPORT |__asm___6_main_c_main____REV16| EXPORT |__asm___6_main_c_main____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h" #line 467 "C:\\Users\\55\\AppData\\Local\\Arm\\Packs\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___6_main_c_main____REV16| PROC |__asm___6_main_c_main____REV16| PROC
#line 468 #line 468

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -115,16 +115,20 @@
#define g_swire_num 40 #define g_swire_num 40
#define SWIRE_MAX_NUM 10 #define SWIRE_MAX_NUM 10
#define AUTO_CAL_TP 0
#define RUN_TEST 0
#if AUTO_CAL_TP
static uint16_t g_cal_cnt = 300; //3s倒计时进入TP校准
#endif
/* /*
RX Filter 1~3 齿 RX Filter 1~3 齿
TX Filter 1~3 齿齿 TX Filter 1~3 齿齿
*/ */
uint32_t s_heartbeat = 0; uint32_t s_heartbeat = 0;
#if ENABLE_TP_WAKE_UP #if ENABLE_TP_WAKE_UP
static bool g_need_enter_sleep_mode = false; static bool g_need_enter_sleep_mode = false;
#endif #endif
/******************************************************/ /******************************************************/
@ -135,6 +139,8 @@ static hal_dsi_tx_ctrl_handle_t* g_tx_ctrl_handle = NULL;
static volatile bool start_display_on = true; static volatile bool start_display_on = true;
/* 屏初始化完成标志位 */ /* 屏初始化完成标志位 */
static bool panel_display_done = true; static bool panel_display_done = true;
static bool g_exit_sleep_mode = false;
extern volatile bool s_calibration_flag;
uint8_t s_swire_pwm_counter = 0; uint8_t s_swire_pwm_counter = 0;
@ -147,16 +153,16 @@ static void soft_swire_init(void);
#if ENABLE_TP_WAKE_UP #if ENABLE_TP_WAKE_UP
static void ap_reset_cb(void *data) static void ap_reset_cb(void* data)
{ {
/* 切换电源 */ /* 切换电源 */
// hal_gpio_set_output_data_ex(POWER_IO_B, IO_LVL_HIGH, POWER_IO_A, IO_LVL_LOW); // hal_gpio_set_output_data_ex(POWER_IO_B, IO_LVL_HIGH, POWER_IO_A, IO_LVL_LOW);
// hal_gpio_set_output_data(POWER_IO_A, IO_LVL_LOW);// // hal_gpio_set_output_data(POWER_IO_A, IO_LVL_LOW);//
/* 打开VCC供电 */ /* 打开VCC供电 */
TAU_LOGD("disable reset!!!!!!!!!!!!!!!!!!!!!!!!!!"); TAU_LOGD("disable reset!!!!!!!!!!!!!");
hal_system_set_pvd(true); hal_system_set_pvd(true);
hal_system_set_vcc(true); hal_system_set_vcc(true);
NVIC_SystemReset(); NVIC_SystemReset();
} }
#endif #endif
@ -1235,9 +1241,9 @@ static bool ap_dcs_read(uint8_t data_type, uint8_t dcs_cmd, uint8_t param)
TAU_LOGD("resp error [%d]!\n", return_size); TAU_LOGD("resp error [%d]!\n", return_size);
} }
} }
else if (dcs_cmd == 0x01) else if(dcs_cmd == 0x01)
{ {
ap_get_tp_calibration_status_01(g_rx_ctrl_handle,param); ap_get_tp_calibration_status_01(g_rx_ctrl_handle, param);
} }
else else
{ {
@ -1262,6 +1268,7 @@ static bool pps_update_handle(uint8_t* pps, uint8_t size, uint32_t pic_width, ui
hal_dsi_rx_ctrl_toggle_resolution(g_rx_ctrl_handle); hal_dsi_rx_ctrl_toggle_resolution(g_rx_ctrl_handle);
// TAU_LOGD("resolution update w[%d] h[%d] compress[%d]\n", pic_width, pic_height, g_rx_ctrl_handle->compress_en); // TAU_LOGD("resolution update w[%d] h[%d] compress[%d]\n", pic_width, pic_height, g_rx_ctrl_handle->compress_en);
} }
g_exit_sleep_mode = true;
TAU_LOGD("PPS Update\n"); TAU_LOGD("PPS Update\n");
// hal_dsi_rx_ctrl_set_hw_tear_mode(g_rx_ctrl_handle); // hal_dsi_rx_ctrl_set_hw_tear_mode(g_rx_ctrl_handle);
return true; return true;
@ -1278,68 +1285,54 @@ static bool ap_set_display_off(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet
// hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x28); // hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x28);
// hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_LOW); // hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_LOW);
hal_dsi_rx_ctrl_set_sw_tear_mode(g_rx_ctrl_handle); hal_dsi_rx_ctrl_set_sw_tear_mode(g_rx_ctrl_handle);
hal_dsi_tx_ctrl_write_cmd(0x29, 0, 3, 0x51, 0x00, 0x00); hal_dsi_tx_ctrl_write_cmd(0x29, 0, 3, 0x51, 0x00, 0x00);
delayMs(10); delayMs(10);
hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x28); hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x28);
// delayMs(50); // delayMs(50);
hal_gpio_set_output_data(IO_PAD_ADCIN, IO_LVL_LOW); hal_gpio_set_output_data(IO_PAD_ADCIN, IO_LVL_LOW);
hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x10); hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x10);
delayMs(50); delayMs(50);
hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_LOW); hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_LOW);
#if ENABLE_TP_WAKE_UP #if ENABLE_TP_WAKE_UP
g_need_enter_sleep_mode = true; g_need_enter_sleep_mode = true;
#endif #endif
TAU_LOGD("disp off \n"); TAU_LOGD("disp off \n");
return true; return true;
} }
static bool ap_set_enter_sleep_mode(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet_t* dcs_packet) static bool ap_set_enter_sleep_mode(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet_t* dcs_packet)
{ {
/* hal_dsi_rx_ctrl_set_sw_tear_mode(g_rx_ctrl_handle); /* hal_dsi_rx_ctrl_set_sw_tear_mode(g_rx_ctrl_handle);
hal_dsi_tx_ctrl_write_cmd(0x29, 0, 3, 0x51, 0x00, 0x00); hal_dsi_tx_ctrl_write_cmd(0x29, 0, 3, 0x51, 0x00, 0x00);
delayMs(10); delayMs(10);
hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x28); hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x28);
// delayMs(50); // delayMs(50);
hal_gpio_set_output_data(IO_PAD_ADCIN, IO_LVL_LOW); hal_gpio_set_output_data(IO_PAD_ADCIN, IO_LVL_LOW);
hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x10); hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x10);
delayMs(50); delayMs(50);
hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_LOW); hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_LOW);
#if ENABLE_TP_WAKE_UP #if ENABLE_TP_WAKE_UP
g_need_enter_sleep_mode = true; g_need_enter_sleep_mode = true;
#endif #endif
*/ */
TAU_LOGD("enter sleep mode"); TAU_LOGD("enter sleep mode");
g_exit_sleep_mode = false;
return true; return true;
} }
static bool ap_set_exit_sleep_mode(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet_t* dcs_packet) static bool ap_set_exit_sleep_mode(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet_t* dcs_packet)
{ {
TAU_LOGD("enter exit sleep mode\n"); TAU_LOGD("enter exit sleep mode\n");
g_exit_sleep_mode = true;
/* AVDD 上电, 用于解决息屏开屏PPS不更新问题 */ /* AVDD 上电, 用于解决息屏开屏PPS不更新问题 */
// hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_HIGH); // hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_HIGH);
// hal_gpio_set_output_data(IO_PAD_ADCIN, IO_LVL_HIGH); // hal_gpio_set_output_data(IO_PAD_ADCIN, IO_LVL_HIGH);
return true; return true;
} }
static bool ap_set_tear_on(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet_t* dcs_packet)
{
if(panel_display_done == true)
{
hal_dsi_rx_ctrl_set_hw_tear_mode(g_rx_ctrl_handle);
TAU_LOGD("hw te\n");
}
else
{
//soft_te_timer_init();
hal_dsi_rx_ctrl_set_sw_tear_mode(g_rx_ctrl_handle);
hal_dsi_rx_ctrl_gen_a_tear_signal(g_rx_ctrl_handle);
TAU_LOGD("sw gen te\n");
}
return true;
}
static bool ap_update_frame_rate(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet_t* dcs_packet) static bool ap_update_frame_rate(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet_t* dcs_packet)
{ {
static uint8_t frame_rate = 100; static uint8_t frame_rate = 100;
@ -1394,15 +1387,15 @@ static bool ap_set_backlight_51(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packe
static bool ap_set_hbm_53(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet_t* dcs_packet) static bool ap_set_hbm_53(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet_t* dcs_packet)
{ {
if(dcs_packet->packet_param[0] == 0x22) // 进入AOD模式 if(dcs_packet->packet_param[0] == 0x22) // 进入AOD模式
{ {
g_tp_sleep_in = true; g_tp_sleep_in = true;
} }
else else
{ {
g_tp_sleep_in = false; g_tp_sleep_in = false;
} }
TAU_LOGD("53:[%2x]", dcs_packet->packet_param[0]); // TAU_LOGD("53:[%2x]", dcs_packet->packet_param[0]);
return true; return true;
} }
@ -1475,7 +1468,7 @@ static const hal_dcs_execute_entry_t g_cus_rx_dcs_execute_table[] =
{0xDF, ap_get_reg_df, false}, //蓝光 {0xDF, ap_get_reg_df, false}, //蓝光
{0xBB, ap_MIPI_RX_CMD_bb, false},//息屏时钟亮度 {0xBB, ap_MIPI_RX_CMD_bb, false},//息屏时钟亮度
// TP calibration // TP calibration
{0x04, ap_set_tp_calibration_04, true}, {0x04, ap_set_tp_calibration_04, true},
{DCS_ENTER_SLEEP_MODE, ap_set_enter_sleep_mode, true}, {DCS_ENTER_SLEEP_MODE, ap_set_enter_sleep_mode, true},
{DCS_EXIT_SLEEP_MODE, ap_set_exit_sleep_mode, true}, {DCS_EXIT_SLEEP_MODE, ap_set_exit_sleep_mode, true},
{0x60, ap_update_frame_rate, true}, {0x60, ap_update_frame_rate, true},
@ -1517,10 +1510,11 @@ static void send_panel_init_code(uint32_t size, uint8_t* data)
//#define USE_PARAS_OLED_HD_1101 //#define USE_PARAS_OLED_HD_1101
#if 1 #if 1
const uint8_t panel_init_code[] = { const uint8_t panel_init_code[] =
{
#if 1 //S21P ICNA3511 #if 1 //S21P ICNA3511
0x29, 0, 3, 0x9C, 0xA5, 0xA5, 0x29, 0, 3, 0x9C, 0xA5, 0xA5,
0x29, 0, 3, 0xFD, 0x5A, 0x5A, 0x29, 0, 3, 0xFD, 0x5A, 0x5A,
0x29, 0, 2, 0x9F, 0x0F, 0x29, 0, 2, 0x9F, 0x0F,
0x29, 0, 2, 0xB3, 0x00, 0x29, 0, 2, 0xB3, 0x00,
@ -1568,7 +1562,7 @@ const uint8_t panel_init_code[] = {
0x29, 0, 14, 0xB5, 0x11, 0x10, 0x27, 0x1C, 0xD0, 0x00, 0x64, 0x64, 0x10, 0x3F, 0xFF, 0xFF, 0xFF, 0x29, 0, 14, 0xB5, 0x11, 0x10, 0x27, 0x1C, 0xD0, 0x00, 0x64, 0x64, 0x10, 0x3F, 0xFF, 0xFF, 0xFF,
0x29, 0, 7, 0xB6, 0x11, 0x00, 0x00, 0x0F, 0xF0, 0x10, 0x29, 0, 7, 0xB6, 0x11, 0x00, 0x00, 0x0F, 0xF0, 0x10,
0x29, 0, 3, 0xB9, 0x91, 0x83, 0x29, 0, 3, 0xB9, 0x91, 0x83,
// 0x29, 0, 3, 0xBA, 0x10, 0x00, // 0x29, 0, 3, 0xBA, 0x10, 0x00,
0x29, 0, 5, 0xC4, 0x01, 0x10, 0x00, 0x00, 0x29, 0, 5, 0xC4, 0x01, 0x10, 0x00, 0x00,
0x29, 0, 20, 0xC5, 0x00, 0x20, 0x88, 0xC1, 0xCF, 0x50, 0x4F, 0x00, 0x4E, 0x57, 0x35, 0x22, 0x22, 0x2A, 0x05, 0x3F, 0x00, 0x20, 0x0F, 0x29, 0, 20, 0xC5, 0x00, 0x20, 0x88, 0xC1, 0xCF, 0x50, 0x4F, 0x00, 0x4E, 0x57, 0x35, 0x22, 0x22, 0x2A, 0x05, 0x3F, 0x00, 0x20, 0x0F,
0x29, 0, 13, 0xC6, 0x4B, 0x00, 0x90, 0x00, 0x02, 0xD5, 0x00, 0x02, 0xCB, 0x01, 0x10, 0x43, 0x29, 0, 13, 0xC6, 0x4B, 0x00, 0x90, 0x00, 0x02, 0xD5, 0x00, 0x02, 0xCB, 0x01, 0x10, 0x43,
@ -2284,7 +2278,7 @@ const uint8_t panel_init_code[] = {
0x29, 0, 3, 0x51, 0x00, 0x00, 0x29, 0, 3, 0x51, 0x00, 0x00,
0x29, 0, 2, 0x53, 0xE0, 0x29, 0, 2, 0x53, 0xE0,
0x29, 0, 2, 0x35, 0x00, 0x29, 0, 2, 0x35, 0x00,
// 0x05, 0, 1, 0x38, // 0x05, 0, 1, 0x38,
// bist mode // bist mode
// 0x29, 0, 2, 0xA5, 0xA5, // 0x29, 0, 2, 0xA5, 0xA5,
@ -2342,7 +2336,7 @@ const uint8_t panel_init_code[] = {
0x39, 0, 14, 0xB5, 0x11, 0x10, 0x27, 0x1C, 0xD0, 0x00, 0x64, 0x64, 0x10, 0x3F, 0xFF, 0xFF, 0xFF, 0x39, 0, 14, 0xB5, 0x11, 0x10, 0x27, 0x1C, 0xD0, 0x00, 0x64, 0x64, 0x10, 0x3F, 0xFF, 0xFF, 0xFF,
0x39, 0, 7, 0xB6, 0x11, 0x00, 0x00, 0x0F, 0xF0, 0x10, 0x39, 0, 7, 0xB6, 0x11, 0x00, 0x00, 0x0F, 0xF0, 0x10,
0x39, 0, 3, 0xB9, 0x91, 0x83, 0x39, 0, 3, 0xB9, 0x91, 0x83,
// 0x39, 0, 3, 0xBA, 0x10, 0x00, // 0x39, 0, 3, 0xBA, 0x10, 0x00,
0x39, 0, 5, 0xC4, 0x01, 0x10, 0x00, 0x00, 0x39, 0, 5, 0xC4, 0x01, 0x10, 0x00, 0x00,
0x39, 0, 20, 0xC5, 0x00, 0x20, 0x88, 0xC1, 0xCF, 0x50, 0x4F, 0x00, 0x4E, 0x57, 0x35, 0x22, 0x22, 0x2A, 0x05, 0x3F, 0x00, 0x20, 0x0F, 0x39, 0, 20, 0xC5, 0x00, 0x20, 0x88, 0xC1, 0xCF, 0x50, 0x4F, 0x00, 0x4E, 0x57, 0x35, 0x22, 0x22, 0x2A, 0x05, 0x3F, 0x00, 0x20, 0x0F,
0x39, 0, 13, 0xC6, 0x4B, 0x00, 0x90, 0x00, 0x02, 0xD5, 0x00, 0x02, 0xCB, 0x01, 0x10, 0x43, 0x39, 0, 13, 0xC6, 0x4B, 0x00, 0x90, 0x00, 0x02, 0xD5, 0x00, 0x02, 0xCB, 0x01, 0x10, 0x43,
@ -3539,7 +3533,7 @@ static void init_panel(void)
/* reset panel*/ /* reset panel*/
tx_panel_reset(); tx_panel_reset();
hal_gpio_init_output(IO_PAD_TD_LEDPWM, IO_LVL_HIGH); hal_gpio_init_output(IO_PAD_TD_LEDPWM, IO_LVL_LOW);
/* enter send initial code mode*/ /* enter send initial code mode*/
hal_dsi_tx_ctrl_enter_init_panel_mode(); hal_dsi_tx_ctrl_enter_init_panel_mode();
@ -3551,8 +3545,8 @@ static void init_panel(void)
delayMs(40); delayMs(40);
hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_HIGH); //LED_ON hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_HIGH); //LED_ON
delayMs(60); delayMs(60);
// hal_gpio_set_output_data(IO_PAD_ADCIN, IO_LVL_HIGH); // hal_gpio_set_output_data(IO_PAD_ADCIN, IO_LVL_HIGH);
soft_swire_init(); soft_swire_init();
// bist mode // bist mode
// hal_dsi_tx_ctrl_write_cmd(0x39, 0, 3, 0x9C,0xA5,0xA5); // hal_dsi_tx_ctrl_write_cmd(0x39, 0, 3, 0x9C,0xA5,0xA5);
// hal_dsi_tx_ctrl_write_cmd(0x39, 0, 3, 0xFD,0x5A,0x5A); // hal_dsi_tx_ctrl_write_cmd(0x39, 0, 3, 0xFD,0x5A,0x5A);
@ -3568,10 +3562,10 @@ static void init_panel(void)
delayMs(10); delayMs(10);
} }
static void frame_start_cb(hal_rx_dbg_event_e event) //static void frame_start_cb(hal_rx_dbg_event_e event)
{ //{
TAU_LOGD("frame start\n"); // TAU_LOGD("frame start\n");
} //}
static void open_mipi_rx(void) static void open_mipi_rx(void)
{ {
@ -3675,66 +3669,40 @@ static void tx_display_on(void)
delayMs(20); delayMs(20);
} }
static void swire_timer_callback(void* data)
{
hal_swire_start(12, 12, 12, 12, 36);
}
static void swire_callback(void* data)
{
/* swire 的是否需要一直发送需要根据手机定,不同手机不同 */
//if(start_display_on == false)
{
hal_timer_start(SWIRE_TIMER, 16, swire_timer_callback, NULL);
}
}
/* swire 初始化,通过 hal_swire_start 调整波形, 这里在循坏一直发送 */
static void swire_init()
{
hal_swire_open(DISABLE);
hal_swire_init();
/* swire 波形发生完成后回调函数 */
hal_swire_register_callback(swire_callback);
hal_swire_open(ENABLE);
hal_swire_start(12, 12, 12, 12, 36);
hal_timer_init(SWIRE_TIMER);
hal_timer_start(SWIRE_TIMER, 16, swire_timer_callback, NULL);
}
static void soft_swire_start(uint8_t pulse) static void soft_swire_start(uint8_t pulse)
{ {
do do
{ {
hal_gpio_init_output(IO_PAD_ADCIN, IO_LVL_LOW); // 3us hal_gpio_init_output(IO_PAD_ADCIN, IO_LVL_LOW); // 3us
delayUs(10); delayUs(10);
hal_gpio_init_output(IO_PAD_ADCIN, IO_LVL_HIGH); // 3us hal_gpio_init_output(IO_PAD_ADCIN, IO_LVL_HIGH); // 3us
delayUs(10); delayUs(10);
}while(pulse--); }
while(pulse--);
} }
static void soft_swire_timer_callback(void *data) static void soft_swire_timer_callback(void* data)
{ {
s_swire_pwm_counter++; s_swire_pwm_counter++;
if( s_swire_pwm_counter < SWIRE_MAX_NUM ) if(s_swire_pwm_counter < SWIRE_MAX_NUM)
{ {
soft_swire_start(g_swire_num); soft_swire_start(g_swire_num);
hal_timer_start(SWIRE_TIMER, 16, soft_swire_timer_callback, NULL); hal_timer_start(SWIRE_TIMER, 16, soft_swire_timer_callback, NULL);
} }
else else
{ {
hal_timer_deinit(SWIRE_TIMER); hal_timer_deinit(SWIRE_TIMER);
hal_timer_stop(SWIRE_TIMER); hal_timer_stop(SWIRE_TIMER);
hal_gpio_init_output(IO_PAD_ADCIN, IO_LVL_HIGH); hal_gpio_init_output(IO_PAD_ADCIN, IO_LVL_HIGH);
} }
} }
static void soft_swire_init(void) static void soft_swire_init(void)
{ {
hal_gpio_init_output(IO_PAD_ADCIN, IO_LVL_HIGH); hal_gpio_init_output(IO_PAD_ADCIN, IO_LVL_HIGH);
delayMs(3); delayMs(3);
s_swire_pwm_counter = 0; s_swire_pwm_counter = 0;
soft_swire_start(g_swire_num); soft_swire_start(g_swire_num);
hal_timer_init(SWIRE_TIMER); hal_timer_init(SWIRE_TIMER);
hal_timer_start(SWIRE_TIMER, 16, soft_swire_timer_callback, NULL); hal_timer_start(SWIRE_TIMER, 16, soft_swire_timer_callback, NULL);
} }
@ -3754,43 +3722,58 @@ static void soft_te_timer_cb(void* data)
} }
} }
static void soft_te_timer_init() //static void soft_te_timer_init()
{ //{
TAU_LOGD("soft_te_timer_init\n"); // TAU_LOGD("soft_te_timer_init\n");
hal_dsi_rx_ctrl_set_sw_tear_mode(g_rx_ctrl_handle); // hal_dsi_rx_ctrl_set_sw_tear_mode(g_rx_ctrl_handle);
hal_timer_init(TE_TIMER); // hal_timer_init(TE_TIMER);
hal_timer_start(TE_TIMER, 1, soft_te_timer_cb, NULL); // hal_timer_start(TE_TIMER, 1, soft_te_timer_cb, NULL);
} //}
void tp_heartbeat_exec(void) void tp_heartbeat_exec(void)
{ {
if (s_screen_init_complate) if(s_screen_init_complate)
{ {
if(hal_gpio_get_input_data(IO_PAD_TD_INT)) if(hal_gpio_get_input_data(IO_PAD_TD_INT))
{ {
s_heartbeat = 0; s_heartbeat = 0;
} }
else else
{ {
if(s_heartbeat < (65536/50)) // 65536*3 = 900ms 65536/50 = 6ms if(s_heartbeat < (65536 / 50)) // 65536*3 = 900ms 65536/50 = 6ms
{ {
s_heartbeat ++; s_heartbeat ++;
}else }
{ else
TAU_LOGD("hb..."); {
s_heartbeat = 0; TAU_LOGD("hb...");
ap_tp_st_touch_software_reset(); s_heartbeat = 0;
} ap_tp_st_touch_software_reset();
} }
} }
}
} }
#ifdef ADD_TIMER3_FUNCTION #ifdef ADD_TIMER3_FUNCTION
static void soft_timer3_cb(void *data) static void soft_timer3_cb(void* data)
{ {
hal_timer_start(TIMER_NUM3, 10, soft_timer3_cb, NULL); hal_timer_start(TIMER_NUM3, 10, soft_timer3_cb, NULL);
g_tp_sleep_delay_count++; g_tp_sleep_delay_count++;
#if AUTO_CAL_TP
if(g_exit_sleep_mode)
{
if(g_cal_cnt > 0)
{
g_cal_cnt--;
if(g_cal_cnt == 0)
{
s_calibration_flag = true;
TAU_LOGD("Start cal tp!\n");
}
}
}
#endif
} }
#endif #endif
@ -3809,7 +3792,7 @@ void S21P_demo(void)
TAU_LOGD("S21P rx done \n"); TAU_LOGD("S21P rx done \n");
/* swire 初始化 */ /* swire 初始化 */
// swire_init(); // swire_init();
app_tp_init(); app_tp_init();
/* 次应用中,屏的1.8V 接 AP TP1.8, PWMEN 接到 AP AVDD_SWIRE, 用于检查是息屏开屏还是AC */ /* 次应用中,屏的1.8V 接 AP TP1.8, PWMEN 接到 AP AVDD_SWIRE, 用于检查是息屏开屏还是AC */
if(hal_gpio_get_input_data(IO_PAD_AP_TPRSTN)) /* S9 可以删掉 */ if(hal_gpio_get_input_data(IO_PAD_AP_TPRSTN)) /* S9 可以删掉 */
{ {
@ -3832,62 +3815,73 @@ void S21P_demo(void)
app_tp_transfer_screen_start(); app_tp_transfer_screen_start();
#ifdef ADD_TIMER3_FUNCTION #ifdef ADD_TIMER3_FUNCTION
g_tp_sleep_delay_count = 0; g_tp_sleep_delay_count = 0;
hal_timer_init(TIMER_NUM3); hal_timer_init(TIMER_NUM3);
hal_timer_start(TIMER_NUM3, 10, soft_timer3_cb, NULL); hal_timer_start(TIMER_NUM3, 10, soft_timer3_cb, NULL);
TAU_LOGD("start timer3"); TAU_LOGD("start timer3");
#endif #endif
while(1) while(1)
{ {
/* 等待 AP TP 上电*/ /* 等待 AP TP 上电*/
if(start_display_on == true) if(start_display_on == true)
{ {
/* 屏初始化 */ if(g_exit_sleep_mode)
tx_display_on(); {
TAU_LOGD("tx_display_on\n"); /* 屏初始化 */
tx_display_on();
TAU_LOGD("tx_display_on\n");
start_display_on = false; start_display_on = false;
panel_display_done = true; panel_display_done = true;
#if ENABLE_TP_WAKE_UP//将启动中断放这里的原因是当开机时,复位会有一个连续拉低拉高(70ms)的过程为了区分开机和待机所以将中断启动放这里大于70ms,使得复位连续第二次拉高时不识别 #if ENABLE_TP_WAKE_UP//将启动中断放这里的原因是当开机时,复位会有一个连续拉低拉高(70ms)的过程为了区分开机和待机所以将中断启动放这里大于70ms,使得复位连续第二次拉高时不识别
hal_gpio_set_ap_reset_int(ENABLE, ap_reset_cb, DETECT_RISING_EDGE); hal_gpio_set_ap_reset_int(ENABLE, ap_reset_cb, DETECT_RISING_EDGE);
#endif #endif
}
} }
/* 与屏的TP 模块通讯并初始化 */ /* 与屏的TP 模块通讯并初始化 */
app_tp_transfer_screen_int(); app_tp_transfer_screen_int();
// tp_heartbeat_exec(); tp_heartbeat_exec();
// app_tp_calibration_exec(); app_tp_calibration_exec();
// ap_tp_st_touch_scan_point_record_event_exec(); ap_tp_st_touch_scan_point_record_event_exec();
while(hal_dsi_rx_ctrl_dsc_async_handler(g_rx_ctrl_handle)) while(hal_dsi_rx_ctrl_dsc_async_handler(g_rx_ctrl_handle))
{ {
} }
#if ENABLE_TP_WAKE_UP #if ENABLE_TP_WAKE_UP
if (g_need_enter_sleep_mode) if(g_need_enter_sleep_mode)
{ {
// g_mipi_path_off = true; // g_mipi_path_off = true;
// hal_gpio_set_output_data(IO_PAD_TD_LEDPWM, IO_LVL_HIGH); // hal_gpio_set_output_data(IO_PAD_TD_LEDPWM, IO_LVL_HIGH);
/* FIXME stop more model */ /* FIXME stop more model */
hal_dsi_tx_ctrl_stop(g_tx_ctrl_handle); hal_dsi_tx_ctrl_stop(g_tx_ctrl_handle);
hal_dsi_tx_ctrl_deinit(g_tx_ctrl_handle); hal_dsi_tx_ctrl_deinit(g_tx_ctrl_handle);
hal_dsi_rx_ctrl_stop(g_rx_ctrl_handle); hal_dsi_rx_ctrl_stop(g_rx_ctrl_handle);
hal_dsi_rx_ctrl_deinit(g_rx_ctrl_handle); hal_dsi_rx_ctrl_deinit(g_rx_ctrl_handle);
hal_swire_open(DISABLE); hal_swire_open(DISABLE);
hal_swire_deinit(); hal_swire_deinit();
hal_timer_stop(SWIRE_TIMER); hal_timer_stop(SWIRE_TIMER);
hal_timer_deinit(SWIRE_TIMER); hal_timer_deinit(SWIRE_TIMER);
g_tp_sleep_in = true; g_tp_sleep_in = true;
//hal_gpio_init_output(IO_PAD_TD_TPRSTN, IO_LVL_LOW); //hal_gpio_init_output(IO_PAD_TD_TPRSTN, IO_LVL_LOW);
// hal_system_set_vcc(false); //关VCC有屏唤不醒 // hal_system_set_vcc(false); //关VCC有屏唤不醒
// hal_system_set_pvd(false); // // hal_system_set_pvd(false); //
hal_gpio_set_output_data(IO_PAD_TD_LEDPWM, IO_LVL_HIGH);
TAU_LOGD("disable video path \n"); TAU_LOGD("disable video path \n");
g_need_enter_sleep_mode = false; g_need_enter_sleep_mode = false;
} }
#endif #endif
#if RUN_TEST
static uint32_t test_cnt = 0;
if(test_cnt++ > 0x1fffff)
{
test_cnt = 0;
TAU_LOGD("System run 1...");
}
#endif
/* enter idle mode*/ /* enter idle mode*/
//hal_system_idle_mode(true); //hal_system_idle_mode(true);
} }

View File

@ -545,7 +545,7 @@ uint8_t app_tp_screen_analysis_int(uint8_t transfer_now, uint8_t *rxbuffer, size
Touch.Event_Single_Flag = 1; Touch.Event_Single_Flag = 1;
// phone_reg_coord_BUF_NUM = 0; // phone_reg_coord_BUF_NUM = 0;
TAU_LOGD("TP [%d]\n", g_tp_sleep_in); // TAU_LOGD("TP [%d]\n", g_tp_sleep_in);
if (g_tp_sleep_in == false) if (g_tp_sleep_in == false)
{ {

View File

@ -21,30 +21,31 @@
#include "hal_spi_master.h" #include "hal_spi_master.h"
#include "hal_spi_slave.h" #include "hal_spi_slave.h"
#include "tau_log.h" #include "tau_log.h"
#include "tau_delay.h"
#include "app_tp_st_touch.h" #include "app_tp_st_touch.h"
#define ST_TP_CALIBRATION_SUCCESS 0x5A // У׼³É¹¦±êÖ¾ #define ST_TP_CALIBRATION_SUCCESS 0x5A // У׼³É¹¦±êÖ¾
static volatile bool s_calibration_flag = false; volatile bool s_calibration_flag = false;
static volatile uint8_t s_calibration_correct_flag = false; static volatile uint8_t s_calibration_correct_flag = false;
st_tp_scan_data tp_scan_data; st_tp_scan_data tp_scan_data;
uint8_t st_touch_init_sensor_off[3] = {0xA0,0x00,0x00}; //2 sensor OFF uint8_t st_touch_init_sensor_off[3] = {0xA0, 0x00, 0x00}; //2 sensor OFF
uint8_t st_touch_init_sensor_on[3] = {0xA0,0x00,0x01}; //2 sensor on uint8_t st_touch_init_sensor_on[3] = {0xA0, 0x00, 0x01}; //2 sensor on
uint8_t st_touch_tp_tuning_reset[3] = {0xA4,0x00,0x00}; // 3 System Reset uint8_t st_touch_tp_tuning_reset[3] = {0xA4, 0x00, 0x00}; // 3 System Reset
uint8_t st_touch_tp_tuning_FpnlInit[3] = {0xA4,0x00,0x03}; // FPnl Init uint8_t st_touch_tp_tuning_FpnlInit[3] = {0xA4, 0x00, 0x03}; // FPnl Init
uint8_t st_touch_tp_tuning_PnlInit[3] = {0xA4,0x00,0x02}; // Pnl Init uint8_t st_touch_tp_tuning_PnlInit[3] = {0xA4, 0x00, 0x02}; // Pnl Init
uint8_t st_touch_tp_tuning_TuneM[4] = {0xA4,0x03,0x13,0x00}; // TuneM uint8_t st_touch_tp_tuning_TuneM[4] = {0xA4, 0x03, 0x13, 0x00}; // TuneM
uint8_t st_touch_tp_tuning_TuneS[4] = {0xA4,0x03,0x0C,0x00}; // TuneS uint8_t st_touch_tp_tuning_TuneS[4] = {0xA4, 0x03, 0x0C, 0x00}; // TuneS
uint8_t st_touch_tp_tuning_SvCfg[3] = {0xA4,0x05,0x01}; // SvCfg uint8_t st_touch_tp_tuning_SvCfg[3] = {0xA4, 0x05, 0x01}; // SvCfg
uint8_t st_touch_tp_tuning_SvCx[3] = {0xA4,0x05,0x02}; // SvCx uint8_t st_touch_tp_tuning_SvCx[3] = {0xA4, 0x05, 0x02}; // SvCx
uint8_t st_touch_tp_tuning_SvPnl[3] = {0xA4,0x05,0x04}; // SvPnl uint8_t st_touch_tp_tuning_SvPnl[3] = {0xA4, 0x05, 0x04}; // SvPnl
uint8_t st_touch_tp_tuning_clearfifo[3] = {0xA4,0x00,0x01}; // 1 clear fifo uint8_t st_touch_tp_tuning_clearfifo[3] = {0xA4, 0x00, 0x01}; // 1 clear fifo
uint8_t st_touch_tp_tuning_clkreset[3] = {0xA4,0x00,0x05}; // clk reset uint8_t st_touch_tp_tuning_clkreset[3] = {0xA4, 0x00, 0x05}; // clk reset
/************************************************************************** /**************************************************************************
* @name : ap_tp_st_touch_get_calibration_success_mark * @name : ap_tp_st_touch_get_calibration_success_mark
@ -56,40 +57,40 @@ uint8_t st_touch_tp_tuning_clkreset[3] = {0xA4,0x00,0x05}; // clk reset
void ap_tp_st_touch_get_calibration_success_mark(void) void ap_tp_st_touch_get_calibration_success_mark(void)
{ {
uint8_t cali_send_buff[6] = {0xFA,0x20,0x01,0x00,0x00,0x00}; uint8_t cali_send_buff[6] = {0xFA, 0x20, 0x01, 0x00, 0x00, 0x00};
uint8_t cali_send_buff1[3] = {0xA4,0x06,0x01}; uint8_t cali_send_buff1[3] = {0xA4, 0x06, 0x01};
uint8_t cali_read_buff[40] = {0}; uint8_t cali_read_buff[40] = {0};
uint8_t i = 0; uint8_t i = 0;
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 4); app_tp_m_read(cali_send_buff, 5, cali_read_buff, 4);
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(1); delayMs(1);
app_tp_m_write(cali_send_buff1, 3); app_tp_m_write(cali_send_buff1, 3);
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(1); delayMs(1);
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 4); app_tp_m_read(cali_send_buff, 5, cali_read_buff, 4);
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(1); delayMs(1);
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 32); app_tp_m_read(cali_send_buff, 5, cali_read_buff, 32);
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
if((cali_read_buff[20] == 0xFF) && (cali_read_buff[21] == 0xFF)) if((cali_read_buff[20] == 0xFF) && (cali_read_buff[21] == 0xFF))
{ {
s_calibration_correct_flag = ST_TP_CALIBRATION_SUCCESS; // 校准成功 s_calibration_correct_flag = ST_TP_CALIBRATION_SUCCESS; // 校准成功
} }
else else
{ {
s_calibration_correct_flag = 0x00; // 校准失败 s_calibration_correct_flag = 0x00; // 校准失败
} }
/* /*
for(i=0;i<32;i++) for(i=0;i<32;i++)
{ {
printf("%02x ",cali_read_buff[i]); printf("%02x ",cali_read_buff[i]);
} }
*/ */
} }
/************************************************************************** /**************************************************************************
@ -102,36 +103,36 @@ void ap_tp_st_touch_get_calibration_success_mark(void)
void ap_tp_st_touch_calibration(void) void ap_tp_st_touch_calibration(void)
{ {
// app_tp_m_write(st_touch_tp_tuning_reset, sizeof(st_touch_tp_tuning_reset)); // System Reset // app_tp_m_write(st_touch_tp_tuning_reset, sizeof(st_touch_tp_tuning_reset)); // System Reset
// while(!hal_i2c_m_transfer_complate()); // while(!hal_i2c_m_transfer_complate());
// delayMs(10); // delayMs(10);
app_tp_m_write(st_touch_tp_tuning_FpnlInit, sizeof(st_touch_tp_tuning_FpnlInit)); // FPnl Init app_tp_m_write(st_touch_tp_tuning_FpnlInit, sizeof(st_touch_tp_tuning_FpnlInit)); // FPnl Init
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(1); delayMs(1);
app_tp_m_write(st_touch_tp_tuning_PnlInit, sizeof(st_touch_tp_tuning_PnlInit)); // Pnl Init app_tp_m_write(st_touch_tp_tuning_PnlInit, sizeof(st_touch_tp_tuning_PnlInit)); // Pnl Init
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(1); delayMs(1);
app_tp_m_write(st_touch_tp_tuning_TuneM, sizeof(st_touch_tp_tuning_TuneM)); // TuneM app_tp_m_write(st_touch_tp_tuning_TuneM, sizeof(st_touch_tp_tuning_TuneM)); // TuneM
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(1); delayMs(1);
app_tp_m_write(st_touch_tp_tuning_TuneS, sizeof(st_touch_tp_tuning_TuneS)); // TuneS app_tp_m_write(st_touch_tp_tuning_TuneS, sizeof(st_touch_tp_tuning_TuneS)); // TuneS
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(1); delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvCfg, sizeof(st_touch_tp_tuning_SvCfg)); // SvCfg app_tp_m_write(st_touch_tp_tuning_SvCfg, sizeof(st_touch_tp_tuning_SvCfg)); // SvCfg
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(1); delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvCx, sizeof(st_touch_tp_tuning_SvCx)); // SvCx app_tp_m_write(st_touch_tp_tuning_SvCx, sizeof(st_touch_tp_tuning_SvCx)); // SvCx
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(1); delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvPnl, sizeof(st_touch_tp_tuning_SvPnl)); // SvPnl app_tp_m_write(st_touch_tp_tuning_SvPnl, sizeof(st_touch_tp_tuning_SvPnl)); // SvPnl
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(1); delayMs(1);
} }
const unsigned short wCRCTalbeAbs[] = const unsigned short wCRCTalbeAbs[] =
{ {
0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401, 0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401,
0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400, 0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400,
}; };
/************************************************************************** /**************************************************************************
@ -142,13 +143,13 @@ const unsigned short wCRCTalbeAbs[] =
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
unsigned short CRC16_2(unsigned char *pchMsg, unsigned short wDataLen) unsigned short CRC16_2(unsigned char* pchMsg, unsigned short wDataLen)
{ {
unsigned short wCRC = 0xFFFF; unsigned short wCRC = 0xFFFF;
unsigned short i; unsigned short i;
unsigned char chChar; unsigned char chChar;
for (i = 0; i < wDataLen; i++) for(i = 0; i < wDataLen; i++)
{ {
chChar = *pchMsg++; chChar = *pchMsg++;
wCRC = wCRCTalbeAbs[(chChar ^ wCRC) & 15] ^ (wCRC >> 4); wCRC = wCRCTalbeAbs[(chChar ^ wCRC) & 15] ^ (wCRC >> 4);
@ -166,95 +167,95 @@ unsigned short CRC16_2(unsigned char *pchMsg, unsigned short wDataLen)
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
bool ap_set_tp_calibration_04(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_packet_t *dcs_packet) bool ap_set_tp_calibration_04(hal_dsi_rx_ctrl_handle_t* handler, hal_dcs_packet_t* dcs_packet)
{ {
uint8_t i,crch,crcl,command,param[30] = {0}; uint8_t i, crch, crcl, command, param[30] = {0};
unsigned short crc; unsigned short crc;
// 计算CRC值 // 计算CRC值
for(i=0;i<dcs_packet->param_length;i++) for(i = 0; i < dcs_packet->param_length; i++)
{ {
param[i+1] = dcs_packet->packet_param[i]; param[i + 1] = dcs_packet->packet_param[i];
printf("%02x ",dcs_packet->packet_param[i]); // printf("%02x ",dcs_packet->packet_param[i]);
} }
param[0] = 0x04; param[0] = 0x04;
crc = CRC16_2(param,dcs_packet->param_length-1); crc = CRC16_2(param, dcs_packet->param_length - 1);
crch = (crc>>8); crch = (crc >> 8);
crcl = crc; crcl = crc;
// CRC校验判断 // CRC校验判断
// if(crch == dcs_packet->packet_param[dcs_packet->param_length-2] && crcl == dcs_packet->packet_param[dcs_packet->param_length-1]) // if(crch == dcs_packet->packet_param[dcs_packet->param_length-2] && crcl == dcs_packet->packet_param[dcs_packet->param_length-1])
{
command = param[3];
switch(command)
{
case CMD_TP_CABLIBRATION: // Touch校准
if( (param[4] == 0x01) && (param[5] == 0x01) && (param[6] == 0x01) )
{
s_calibration_flag = true;
s_calibration_correct_flag = false;
}
/* if( (param[4] == 0xA5) && (param[5] == 0x5A) && (param[6] == 0xA5) )
{
if(s_calibration_correct_flag) // 校准成功
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,ST_TP_CALIBRATION_SUCCESS,0x00,0x00);
printf("cali. send ok ");
}
else // 校准失败
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,0x00,0x00,0x00);
}
printf("%02x ",s_calibration_correct_flag);
}
*/
break;
case CMD_SET_IMAGE_RGB: // Image RGB发送
break;
case CMD_SEND_COMMAND: // Command Send
break;
case CMD_WRITE_GAMMA: // Gamma校正写入
break;
case CMD_START_GAMMA:
break;
default:
break;
}
}
// 兼容旧版本tp calibration
if( (dcs_packet->packet_param[0] == 0x01) && (dcs_packet->packet_param[1] == 0x01) && (dcs_packet->packet_param[2] == 0x01) )
{ {
s_calibration_flag = true; command = param[3];
s_calibration_correct_flag = false; switch(command)
{
case CMD_TP_CABLIBRATION: // Touch校准
if((param[4] == 0x01) && (param[5] == 0x01) && (param[6] == 0x01))
{
s_calibration_flag = true;
s_calibration_correct_flag = false;
}
/* if( (param[4] == 0xA5) && (param[5] == 0x5A) && (param[6] == 0xA5) )
{
if(s_calibration_correct_flag) // 校准成功
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,ST_TP_CALIBRATION_SUCCESS,0x00,0x00);
printf("cali. send ok ");
}
else // 校准失败
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,0x00,0x00,0x00);
}
printf("%02x ",s_calibration_correct_flag);
}
*/
break;
case CMD_SET_IMAGE_RGB: // Image RGB发送
break;
case CMD_SEND_COMMAND: // Command Send
break;
case CMD_WRITE_GAMMA: // Gamma校正写入
break;
case CMD_START_GAMMA:
break;
default:
break;
}
} }
/*
if( (dcs_packet->packet_param[0] == 0xA5) && (dcs_packet->packet_param[1] == 0x5A) && (dcs_packet->packet_param[2] == 0xA5) ) // 兼容旧版本tp calibration
if((dcs_packet->packet_param[0] == 0x01) && (dcs_packet->packet_param[1] == 0x01) && (dcs_packet->packet_param[2] == 0x01))
{ {
if(s_calibration_correct_flag) // 校准成功 s_calibration_flag = true;
{ s_calibration_correct_flag = false;
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,ST_TP_CALIBRATION_SUCCESS,0x00,0x00);
}
else // 校准失败
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,0x00,0x00,0x00);
}
} }
*/ /*
if( (dcs_packet->packet_param[0] == 0xA5) && (dcs_packet->packet_param[1] == 0x5A) && (dcs_packet->packet_param[2] == 0xA5) )
{
if(s_calibration_correct_flag) // 校准成功
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,ST_TP_CALIBRATION_SUCCESS,0x00,0x00);
}
else // 校准失败
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,0x00,0x00,0x00);
}
}
*/
return true; return true;
} }
@ -267,24 +268,24 @@ bool ap_set_tp_calibration_04(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_packet_
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
bool ap_get_tp_calibration_status_01(hal_dsi_rx_ctrl_handle_t *handler, uint8_t param) bool ap_get_tp_calibration_status_01(hal_dsi_rx_ctrl_handle_t* handler, uint8_t param)
{ {
// if( param == 0x5A ) // if( param == 0x5A )
{ {
if(s_calibration_correct_flag) // 校准成功 if(s_calibration_correct_flag) // 校准成功
{ {
hal_dsi_rx_ctrl_send_ack_cmd(handler, hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_DSC_SHORT_RESPONSE_1B, //xxx DSI_ACK_DT_DSC_SHORT_RESPONSE_1B, //xxx
DSI_VC_0, DSI_VC_0,
1,ST_TP_CALIBRATION_SUCCESS); 1, ST_TP_CALIBRATION_SUCCESS);
} }
else // 校准失败 else // 校准失败
{ {
hal_dsi_rx_ctrl_send_ack_cmd(handler, hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_DSC_SHORT_RESPONSE_1B, //xxx DSI_ACK_DT_DSC_SHORT_RESPONSE_1B, //xxx
DSI_VC_0, DSI_VC_0,
1,0x00); 1, 0x00);
} }
} }
return true; return true;
@ -300,28 +301,28 @@ bool ap_get_tp_calibration_status_01(hal_dsi_rx_ctrl_handle_t *handler, uint8_t
void app_tp_calibration_exec(void) void app_tp_calibration_exec(void)
{ {
uint8_t i = 0; uint8_t i = 0;
if(s_calibration_flag) if(s_calibration_flag)
{ {
s_calibration_flag = false; s_calibration_flag = false;
for(i=0;i<3;i++) for(i = 0; i < 3; i++)
{ {
ap_tp_st_touch_calibration(); ap_tp_st_touch_calibration();
delayMs(4000); delayMs(4000);
ap_tp_st_touch_get_calibration_success_mark(); ap_tp_st_touch_get_calibration_success_mark();
if(s_calibration_correct_flag == ST_TP_CALIBRATION_SUCCESS) if(s_calibration_correct_flag == ST_TP_CALIBRATION_SUCCESS)
{ {
TAU_LOGD("calibration successful \n"); TAU_LOGD("calibration successful \n");
break; break;
} }
else else
{ {
TAU_LOGD("calibration failure \n"); TAU_LOGD("calibration failure \n");
} }
} }
} }
} }
@ -335,13 +336,13 @@ void app_tp_calibration_exec(void)
void ap_tp_st_touch_scan_point_init(void) void ap_tp_st_touch_scan_point_init(void)
{ {
uint8_t i=0; uint8_t i = 0;
for(i=0;i<ST_TP_SCAN_POINT_NUMBER_MAX;i++) for(i = 0; i < ST_TP_SCAN_POINT_NUMBER_MAX; i++)
tp_scan_data.tp_point_buffer[i] = 0; tp_scan_data.tp_point_buffer[i] = 0;
tp_scan_data.tp_point_up_error_flag = 0; tp_scan_data.tp_point_up_error_flag = 0;
tp_scan_data.tp_read_point_counter = 0; tp_scan_data.tp_read_point_counter = 0;
tp_scan_data.tp_point_error_time_counter = 0; tp_scan_data.tp_point_error_time_counter = 0;
} }
@ -355,17 +356,17 @@ void ap_tp_st_touch_scan_point_init(void)
void ap_tp_st_touch_simulate_finger_release_event(void) void ap_tp_st_touch_simulate_finger_release_event(void)
{ {
uint8_t i,temp=0,ap_tp_release_buf[8] = {0x33,0x01,0x00,0x00,0x00,0x00,0x00,0x00}; uint8_t i, temp = 0, ap_tp_release_buf[8] = {0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
for(i=0;i<5;i++) for(i = 0; i < 5; i++)
{ {
temp = i; temp = i;
ap_tp_release_buf[1] = (temp<<4)|0x01; ap_tp_release_buf[1] = (temp << 4) | 0x01;
app_tp_screen_analysis_int(0, ap_tp_release_buf,8); app_tp_screen_analysis_int(0, ap_tp_release_buf, 8);
delayMs(6); delayMs(6);
} }
} }
/************************************************************************** /**************************************************************************
@ -378,25 +379,25 @@ void ap_tp_st_touch_simulate_finger_release_event(void)
void ap_tp_st_touch_software_reset(void) void ap_tp_st_touch_software_reset(void)
{ {
TAU_LOGD("st_touch_software_reset \n"); TAU_LOGD("st_touch_software_reset \n");
ap_tp_st_touch_simulate_finger_release_event(); ap_tp_st_touch_simulate_finger_release_event();
ap_tp_st_touch_scan_point_init(); ap_tp_st_touch_scan_point_init();
app_tp_m_write(st_touch_tp_tuning_clkreset, sizeof(st_touch_tp_tuning_clkreset)); // clk reset app_tp_m_write(st_touch_tp_tuning_clkreset, sizeof(st_touch_tp_tuning_clkreset)); // clk reset
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(5); delayMs(5);
app_tp_m_write(st_touch_tp_tuning_reset, sizeof(st_touch_tp_tuning_reset)); // System Reset A4 00 00 app_tp_m_write(st_touch_tp_tuning_reset, sizeof(st_touch_tp_tuning_reset)); // System Reset A4 00 00
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(5); delayMs(5);
app_tp_m_write(st_touch_tp_tuning_clearfifo, sizeof(st_touch_tp_tuning_clearfifo));//0xA4,0x00,0x01 app_tp_m_write(st_touch_tp_tuning_clearfifo, sizeof(st_touch_tp_tuning_clearfifo));//0xA4,0x00,0x01
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(5); delayMs(5);
app_tp_m_write(st_touch_init_sensor_on, sizeof(st_touch_init_sensor_on));//0xA0,0x00,0x01 app_tp_m_write(st_touch_init_sensor_on, sizeof(st_touch_init_sensor_on));//0xA0,0x00,0x01
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(5); delayMs(5);
// app_tp_screen_reset(); // app_tp_screen_reset();
} }
@ -411,25 +412,25 @@ void ap_tp_st_touch_software_reset(void)
**************************************************************************/ **************************************************************************/
void ap_tp_st_touch_hardware_reset(void) void ap_tp_st_touch_hardware_reset(void)
{ {
TAU_LOGD("st_touch_hardware_reset \n"); TAU_LOGD("st_touch_hardware_reset \n");
ap_tp_st_touch_simulate_finger_release_event(); ap_tp_st_touch_simulate_finger_release_event();
ap_tp_st_touch_scan_point_init(); ap_tp_st_touch_scan_point_init();
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH); hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH);
delayMs(2); delayMs(2);
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_LOW); hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_LOW);
delayMs(2); delayMs(2);
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH); hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH);
delayMs(2); delayMs(2);
app_tp_m_write(st_touch_tp_tuning_clearfifo, sizeof(st_touch_tp_tuning_clearfifo));//0xA4,0x00,0x01} app_tp_m_write(st_touch_tp_tuning_clearfifo, sizeof(st_touch_tp_tuning_clearfifo));//0xA4,0x00,0x01}
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(5); delayMs(5);
app_tp_m_write(st_touch_init_sensor_off, sizeof(st_touch_init_sensor_off));//0xA0,0x00,0x00 app_tp_m_write(st_touch_init_sensor_off, sizeof(st_touch_init_sensor_off));//0xA0,0x00,0x00
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(5); delayMs(5);
app_tp_m_write(st_touch_init_sensor_on, sizeof(st_touch_init_sensor_on));//0xA0,0x00,0x01 app_tp_m_write(st_touch_init_sensor_on, sizeof(st_touch_init_sensor_on));//0xA0,0x00,0x01
while(!hal_i2c_m_transfer_complate()); while(!hal_i2c_m_transfer_complate());
delayMs(5); delayMs(5);
} }
/************************************************************************** /**************************************************************************
@ -440,64 +441,64 @@ void ap_tp_st_touch_hardware_reset(void)
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
void ap_tp_st_touch_scan_point_record_event(uint8_t* screendata,uint8_t len) void ap_tp_st_touch_scan_point_record_event(uint8_t* screendata, uint8_t len)
{ {
uint8_t i = 0, j,flag = 0,eventdata=0,eventid=0; uint8_t i = 0, j, flag = 0, eventdata = 0, eventid = 0;
for(i=0;i<len;i++) for(i = 0; i < len; i++)
{ {
eventdata = screendata[i]; eventdata = screendata[i];
eventid = (screendata[i+1]>>4)+1; eventid = (screendata[i + 1] >> 4) + 1;
i+=7; i += 7;
if(eventdata == 0x13) // 按下事件 if(eventdata == 0x13) // 按下事件
{ {
for(j=0;j<ST_TP_SCAN_POINT_NUMBER_MAX;j++) for(j = 0; j < ST_TP_SCAN_POINT_NUMBER_MAX; j++)
{ {
if(tp_scan_data.tp_point_buffer[j] == eventid) if(tp_scan_data.tp_point_buffer[j] == eventid)
{ {
flag = 1; flag = 1;
break; break;
} }
} }
if(flag==0) // 轮询没有该ID需要保存 if(flag == 0) // 轮询没有该ID需要保存
{ {
for(j=0;j<ST_TP_SCAN_POINT_NUMBER_MAX;j++) //寻找空位 for(j = 0; j < ST_TP_SCAN_POINT_NUMBER_MAX; j++) //寻找空位
{ {
if(tp_scan_data.tp_point_buffer[j] == 0x00) if(tp_scan_data.tp_point_buffer[j] == 0x00)
{ {
tp_scan_data.tp_point_buffer[j] = eventid; tp_scan_data.tp_point_buffer[j] = eventid;
tp_scan_data.tp_read_point_counter++; tp_scan_data.tp_read_point_counter++;
break; break;
} }
} }
} }
} }
if(eventdata == 0x33 && (tp_scan_data.tp_read_point_counter>0)) // 释放事件 if(eventdata == 0x33 && (tp_scan_data.tp_read_point_counter > 0)) // 释放事件
{ {
for(j=0;j<ST_TP_SCAN_POINT_NUMBER_MAX;j++) for(j = 0; j < ST_TP_SCAN_POINT_NUMBER_MAX; j++)
{ {
if(tp_scan_data.tp_point_buffer[j] == eventid) // 有该事件需要释放 if(tp_scan_data.tp_point_buffer[j] == eventid) // 有该事件需要释放
{ {
tp_scan_data.tp_point_buffer[j] = 0; tp_scan_data.tp_point_buffer[j] = 0;
tp_scan_data.tp_read_point_counter--; tp_scan_data.tp_read_point_counter--;
break; break;
} }
} }
tp_scan_data.tp_point_up_error_flag = 1; tp_scan_data.tp_point_up_error_flag = 1;
tp_scan_data.tp_point_error_time_counter = 0; tp_scan_data.tp_point_error_time_counter = 0;
} }
if(eventdata == 0x23) // 移动MOVE事件 if(eventdata == 0x23) // 移动MOVE事件
{ {
tp_scan_data.tp_point_up_error_flag = 1; tp_scan_data.tp_point_up_error_flag = 1;
tp_scan_data.tp_point_error_time_counter = 0; tp_scan_data.tp_point_error_time_counter = 0;
} }
} }
} }
/************************************************************************** /**************************************************************************
@ -510,23 +511,23 @@ void ap_tp_st_touch_scan_point_record_event(uint8_t* screendata,uint8_t len)
void ap_tp_st_touch_scan_point_record_event_exec(void) void ap_tp_st_touch_scan_point_record_event_exec(void)
{ {
if(tp_scan_data.tp_point_up_error_flag == 1) if(tp_scan_data.tp_point_up_error_flag == 1)
{ {
if(tp_scan_data.tp_point_error_time_counter < (65536/10)) // 65536*3 = 900ms 65536/10 = 30ms if(tp_scan_data.tp_point_error_time_counter < (65536 / 10)) // 65536*3 = 900ms 65536/10 = 30ms
{ {
tp_scan_data.tp_point_error_time_counter ++; tp_scan_data.tp_point_error_time_counter ++;
} }
else // 没有收到move 或者release 时间超时 else // 没有收到move 或者release 时间超时
{ {
if(tp_scan_data.tp_read_point_counter>0) // 有残留点 if(tp_scan_data.tp_read_point_counter > 0) // 有残留点
{ {
printf("release finger %2d\n",tp_scan_data.tp_read_point_counter); // printf("release finger %2d\n",tp_scan_data.tp_read_point_counter);
tp_scan_data.tp_read_point_counter = 0; tp_scan_data.tp_read_point_counter = 0;
ap_tp_st_touch_simulate_finger_release_event(); ap_tp_st_touch_simulate_finger_release_event();
} }
ap_tp_st_touch_scan_point_init(); ap_tp_st_touch_scan_point_init();
} }
} }
} }
/************************************************************************** /**************************************************************************
@ -539,11 +540,11 @@ void ap_tp_st_touch_scan_point_record_event_exec(void)
void ap_tp_st_touch_error_handler_F3(uint8_t* screendata) void ap_tp_st_touch_error_handler_F3(uint8_t* screendata)
{ {
// 收到 TP 异常回复 0xF3 0x02 0x00 0x00 0x00 0x00 0x00 0x00 // 收到 TP 异常回复 0xF3 0x02 0x00 0x00 0x00 0x00 0x00 0x00
if(screendata[0] == 0xF3 && screendata[1] == 0x02 && screendata[2] == 0x00) if(screendata[0] == 0xF3 && screendata[1] == 0x02 && screendata[2] == 0x00)
{ {
ap_tp_st_touch_software_reset(); ap_tp_st_touch_software_reset();
} }
// if(screendata[0] == 0xF3 && screendata[1] == 0x91 && screendata[2] == 0x00) // if(screendata[0] == 0xF3 && screendata[1] == 0x91 && screendata[2] == 0x00)
// { // {
@ -561,11 +562,11 @@ void ap_tp_st_touch_error_handler_F3(uint8_t* screendata)
void ap_tp_st_touch_error_handler_FF(uint8_t* screendata) void ap_tp_st_touch_error_handler_FF(uint8_t* screendata)
{ {
// 收到 TP 异常回复 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF // 收到 TP 异常回复 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
if(screendata[1] == 0xFF && screendata[2] == 0xFF&& screendata[3] == 0xFF&&screendata[4] == 0xFF) if(screendata[1] == 0xFF && screendata[2] == 0xFF && screendata[3] == 0xFF && screendata[4] == 0xFF)
{ {
ap_tp_st_touch_software_reset(); ap_tp_st_touch_software_reset();
} }
} }

View File

@ -296,6 +296,7 @@ typedef enum
ERR_HANDLE_L1 = 1, ERR_HANDLE_L1 = 1,
ERR_HANDLE_L2 = 2, ERR_HANDLE_L2 = 2,
ERR_HANDLE_L3 = 3, ERR_HANDLE_L3 = 3,
ERR_HANDLE_L4 = 4,
ERR_HANDLE_MAX ERR_HANDLE_MAX
} hal_err_handle_level_e; } hal_err_handle_level_e;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -69,7 +69,7 @@ typedef struct hal_dsi_rx_ctrl_handle_t
hal_dsi_rx_ctrl_pps_entry pps_update_entry; /* PPS Update 时回调函数,用于分辨率切换更新PPS,为NULL时内部处理 */ hal_dsi_rx_ctrl_pps_entry pps_update_entry; /* PPS Update 时回调函数,用于分辨率切换更新PPS,为NULL时内部处理 */
bool used; /* handle使用标志位 */ bool used; /* handle使用标志位 */
uint8_t pq_marginal; /* picture quality,参数为hal_rx_pq_marginal_type_e */ uint8_t pq_marginal; /* picture quality,参数为hal_rx_pq_marginal_type_e */
bool direct_mode; /* video mode 直通模式,预留,仅debug使用 */ bool direct_mode; /* video mode 直通模式,支持60hz同帧率且porch相等或者相近时使用 */
hal_dsi_rx_ctrl_dbg_entry rx_debug_cb; /* rx debug 回调函数,目前为收到frame start之后回调预留其他debug功能 */ hal_dsi_rx_ctrl_dbg_entry rx_debug_cb; /* rx debug 回调函数,目前为收到frame start之后回调预留其他debug功能 */
hal_err_handle_level_e err_handler_level; /* RX接收错误的时候对模块做reset等级, 等级越高reset模块越多 */ hal_err_handle_level_e err_handler_level; /* RX接收错误的时候对模块做reset等级, 等级越高reset模块越多 */
bool draw_mode; /* 画点模式,仅debug使用 */ bool draw_mode; /* 画点模式,仅debug使用 */
@ -471,12 +471,13 @@ bool hal_dsi_rx_ctrl_set_tear_mode_ex(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle,
bool hal_dsi_rx_ctrl_toggle_resolution_ex(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle); bool hal_dsi_rx_ctrl_toggle_resolution_ex(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/* /*
* @brief 0XFF命令 * @brief ,.
hal_dsi_rx_ctrl_set_auto_hw_filter关闭hw filter用于获取所有软件CMD
* @param rx_ctrl_handle: dsi rx handle * @param rx_ctrl_handle: dsi rx handle
* @param * @param
* @retval none * @retval none
*/ */
void hal_dsi_rx_register_write_cmd_entry(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, hal_dsi_rx_ctrl_dcs_execute execute_func); void hal_dsi_rx_ctrl_register_write_cmd_entry(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, hal_dsi_rx_ctrl_dcs_execute execute_func);
#if !defined(ISP_568) && !defined(ISP_368) #if !defined(ISP_568) && !defined(ISP_368)

View File

@ -52,7 +52,9 @@ typedef struct
uint8_t blank_rows; /* 默认为0, 针对特殊屏使用大于0时生效表示向下补黑blank_rows行 */ uint8_t blank_rows; /* 默认为0, 针对特殊屏使用大于0时生效表示向下补黑blank_rows行 */
uint8_t blank_columns; /* 默认为0, 针对特殊屏使用大于0时生效表示向右补黑blank_columns列 */ uint8_t blank_columns; /* 默认为0, 针对特殊屏使用大于0时生效表示向右补黑blank_columns列 */
bool lp_exit_lpdt; /* 每一条LP CMD都退出LPDT */ bool lp_exit_lpdt; /* 每一条LP CMD都退出LPDT */
#if defined(ISP_568) || defined(ISP_368)
bool tx_cmd_mode_sync; /* TX command mode 输出同步 */ bool tx_cmd_mode_sync; /* TX command mode 输出同步 */
#endif
} hal_dsi_tx_ctrl_handle_t; } hal_dsi_tx_ctrl_handle_t;
/** /**
@ -139,9 +141,9 @@ void hal_dsi_tx_ctrl_read_cmd(uint8_t data_type, uint8_t vc, uint8_t cmd, uint8_
* @param vc: dsi_virtual_channel_e * @param vc: dsi_virtual_channel_e
* @param cmd_count: * @param cmd_count:
* @param ...: * @param ...:
* @retval * @retval true-command发送正常false-TX当前状态不能发送command
*/ */
void hal_dsi_tx_ctrl_write_cmd(uint8_t data_type, uint8_t vc, uint8_t cmd_count, ...); bool hal_dsi_tx_ctrl_write_cmd(uint8_t data_type, uint8_t vc, uint8_t cmd_count, ...);
/** /**
* @brief MIPI TX发送命令 * @brief MIPI TX发送命令
@ -149,9 +151,9 @@ void hal_dsi_tx_ctrl_write_cmd(uint8_t data_type, uint8_t vc, uint8_t cmd_count,
* @param vc: dsi_virtual_channel_e * @param vc: dsi_virtual_channel_e
* @param size: data个数 * @param size: data个数
* @param data: data数组 * @param data: data数组
* @retval * @retval true-command发送正常false-TX当前状态不能发送command
*/ */
void hal_dsi_tx_ctrl_write_array_cmd(uint8_t data_type, uint8_t vc, uint8_t size, const uint8_t *data); bool hal_dsi_tx_ctrl_write_array_cmd(uint8_t data_type, uint8_t vc, uint8_t size, const uint8_t *data);
/** /**
* @brief TX溢出时钟分频系统 * @brief TX溢出时钟分频系统

View File

@ -1 +1 @@
#define SDK_REVISION 4450 #define SDK_REVISION 4644