增加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>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>ISP_568T_S21P_20230517</OutputName>
<OutputName>ISP_568T_S21P_20230628</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
@ -313,7 +313,7 @@
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>1</Optim>
<Optim>2</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<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]
; 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
AREA ||i.board_Init||, CODE, READONLY, ALIGN=2
@ -42,7 +42,7 @@
AREA ||.rev16_text||, CODE
THUMB
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
#line 468

View File

@ -1,5 +1,5 @@
; 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
AREA ||i.main||, CODE, READONLY, ALIGN=1
@ -12,8 +12,6 @@
;;;11 board_Init();
;;;12
;;;13 while (1)
000004 e003 B |L1.14|
|L1.6|
;;;14 {
;;;15 #if _DEMO_DSI_TX_EN
;;;16 demo_dsi_tx_case();
@ -59,14 +57,11 @@
;;;56
;;;57 #if _DEMO_S21P_EN
;;;58 S21P_demo();
000006 f7fffffe BL S21P_demo
000004 f7fffffe BL S21P_demo
|L1.8|
;;;59 #endif
;;;60 while (1);
00000a bf00 NOP
|L1.12|
00000c e7fe B |L1.12|
|L1.14|
00000e e7fa B |L1.6|
000008 e7fe B |L1.8|
;;;61 }
;;;62 }
ENDP
@ -78,7 +73,7 @@
AREA ||.rev16_text||, CODE
THUMB
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
#line 468

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

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;
// 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)
{

View File

@ -21,30 +21,31 @@
#include "hal_spi_master.h"
#include "hal_spi_slave.h"
#include "tau_log.h"
#include "tau_delay.h"
#include "app_tp_st_touch.h"
#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;
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_on[3] = {0xA0,0x00,0x01}; //2 sensor on
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_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_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_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_SvCx[3] = {0xA4,0x05,0x02}; // SvCx
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_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_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_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_SvCx[3] = {0xA4, 0x05, 0x02}; // SvCx
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_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
@ -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)
{
uint8_t cali_send_buff[6] = {0xFA,0x20,0x01,0x00,0x00,0x00};
uint8_t cali_send_buff1[3] = {0xA4,0x06,0x01};
uint8_t cali_read_buff[40] = {0};
uint8_t i = 0;
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 4);
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(cali_send_buff1, 3);
while(!hal_i2c_m_transfer_complate());
delayMs(1);
uint8_t cali_send_buff[6] = {0xFA, 0x20, 0x01, 0x00, 0x00, 0x00};
uint8_t cali_send_buff1[3] = {0xA4, 0x06, 0x01};
uint8_t cali_read_buff[40] = {0};
uint8_t i = 0;
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 4);
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 4);
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 32);
while(!hal_i2c_m_transfer_complate());
app_tp_m_write(cali_send_buff1, 3);
while(!hal_i2c_m_transfer_complate());
delayMs(1);
if((cali_read_buff[20] == 0xFF) && (cali_read_buff[21] == 0xFF))
{
s_calibration_correct_flag = ST_TP_CALIBRATION_SUCCESS; // 校准成功
}
else
{
s_calibration_correct_flag = 0x00; // 校准失败
}
/*
for(i=0;i<32;i++)
{
printf("%02x ",cali_read_buff[i]);
}
*/
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 4);
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 32);
while(!hal_i2c_m_transfer_complate());
if((cali_read_buff[20] == 0xFF) && (cali_read_buff[21] == 0xFF))
{
s_calibration_correct_flag = ST_TP_CALIBRATION_SUCCESS; // 校准成功
}
else
{
s_calibration_correct_flag = 0x00; // 校准失败
}
/*
for(i=0;i<32;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)
{
// app_tp_m_write(st_touch_tp_tuning_reset, sizeof(st_touch_tp_tuning_reset)); // System Reset
// while(!hal_i2c_m_transfer_complate());
// delayMs(10);
app_tp_m_write(st_touch_tp_tuning_FpnlInit, sizeof(st_touch_tp_tuning_FpnlInit)); // FPnl Init
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_PnlInit, sizeof(st_touch_tp_tuning_PnlInit)); // Pnl Init
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_TuneM, sizeof(st_touch_tp_tuning_TuneM)); // TuneM
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_TuneS, sizeof(st_touch_tp_tuning_TuneS)); // TuneS
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvCfg, sizeof(st_touch_tp_tuning_SvCfg)); // SvCfg
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvCx, sizeof(st_touch_tp_tuning_SvCx)); // SvCx
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvPnl, sizeof(st_touch_tp_tuning_SvPnl)); // SvPnl
while(!hal_i2c_m_transfer_complate());
delayMs(1);
// app_tp_m_write(st_touch_tp_tuning_reset, sizeof(st_touch_tp_tuning_reset)); // System Reset
// while(!hal_i2c_m_transfer_complate());
// delayMs(10);
app_tp_m_write(st_touch_tp_tuning_FpnlInit, sizeof(st_touch_tp_tuning_FpnlInit)); // FPnl Init
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_PnlInit, sizeof(st_touch_tp_tuning_PnlInit)); // Pnl Init
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_TuneM, sizeof(st_touch_tp_tuning_TuneM)); // TuneM
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_TuneS, sizeof(st_touch_tp_tuning_TuneS)); // TuneS
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvCfg, sizeof(st_touch_tp_tuning_SvCfg)); // SvCfg
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvCx, sizeof(st_touch_tp_tuning_SvCx)); // SvCx
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvPnl, sizeof(st_touch_tp_tuning_SvPnl)); // SvPnl
while(!hal_i2c_m_transfer_complate());
delayMs(1);
}
const unsigned short wCRCTalbeAbs[] =
{
0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401,
0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400,
0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401,
0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400,
};
/**************************************************************************
@ -142,13 +143,13 @@ const unsigned short wCRCTalbeAbs[] =
* @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 i;
unsigned char chChar;
for (i = 0; i < wDataLen; i++)
for(i = 0; i < wDataLen; i++)
{
chChar = *pchMsg++;
wCRC = wCRCTalbeAbs[(chChar ^ wCRC) & 15] ^ (wCRC >> 4);
@ -166,95 +167,95 @@ unsigned short CRC16_2(unsigned char *pchMsg, unsigned short wDataLen)
* @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};
unsigned short crc;
uint8_t i, crch, crcl, command, param[30] = {0};
unsigned short crc;
// 计算CRC值
for(i=0;i<dcs_packet->param_length;i++)
{
param[i+1] = dcs_packet->packet_param[i];
printf("%02x ",dcs_packet->packet_param[i]);
}
param[0] = 0x04;
crc = CRC16_2(param,dcs_packet->param_length-1);
crch = (crc>>8);
crcl = crc;
// 计算CRC值
for(i = 0; i < dcs_packet->param_length; i++)
{
param[i + 1] = dcs_packet->packet_param[i];
// printf("%02x ",dcs_packet->packet_param[i]);
}
// CRC校验判断
param[0] = 0x04;
crc = CRC16_2(param, dcs_packet->param_length - 1);
crch = (crc >> 8);
crcl = crc;
// CRC校验判断
// 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;
s_calibration_correct_flag = false;
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;
}
}
/*
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) // 校准成功
{
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);
}
s_calibration_flag = true;
s_calibration_correct_flag = false;
}
*/
/*
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;
}
@ -267,26 +268,26 @@ bool ap_set_tp_calibration_04(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_packet_
* @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(s_calibration_correct_flag) // 校准成功
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_DSC_SHORT_RESPONSE_1B, //xxx
DSI_VC_0,
1,ST_TP_CALIBRATION_SUCCESS);
}
else // 校准失败
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_DSC_SHORT_RESPONSE_1B, //xxx
DSI_VC_0,
1,0x00);
}
if(s_calibration_correct_flag) // 校准成功
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_DSC_SHORT_RESPONSE_1B, //xxx
DSI_VC_0,
1, ST_TP_CALIBRATION_SUCCESS);
}
else // 校准失败
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_DSC_SHORT_RESPONSE_1B, //xxx
DSI_VC_0,
1, 0x00);
}
}
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)
{
uint8_t i = 0;
if(s_calibration_flag)
{
s_calibration_flag = false;
for(i=0;i<3;i++)
{
ap_tp_st_touch_calibration();
delayMs(4000);
ap_tp_st_touch_get_calibration_success_mark();
if(s_calibration_correct_flag == ST_TP_CALIBRATION_SUCCESS)
{
TAU_LOGD("calibration successful \n");
break;
}
else
{
TAU_LOGD("calibration failure \n");
}
}
}
uint8_t i = 0;
if(s_calibration_flag)
{
s_calibration_flag = false;
for(i = 0; i < 3; i++)
{
ap_tp_st_touch_calibration();
delayMs(4000);
ap_tp_st_touch_get_calibration_success_mark();
if(s_calibration_correct_flag == ST_TP_CALIBRATION_SUCCESS)
{
TAU_LOGD("calibration successful \n");
break;
}
else
{
TAU_LOGD("calibration failure \n");
}
}
}
}
@ -335,13 +336,13 @@ void app_tp_calibration_exec(void)
void ap_tp_st_touch_scan_point_init(void)
{
uint8_t i=0;
for(i=0;i<ST_TP_SCAN_POINT_NUMBER_MAX;i++)
tp_scan_data.tp_point_buffer[i] = 0;
tp_scan_data.tp_point_up_error_flag = 0;
tp_scan_data.tp_read_point_counter = 0;
tp_scan_data.tp_point_error_time_counter = 0;
uint8_t i = 0;
for(i = 0; i < ST_TP_SCAN_POINT_NUMBER_MAX; i++)
tp_scan_data.tp_point_buffer[i] = 0;
tp_scan_data.tp_point_up_error_flag = 0;
tp_scan_data.tp_read_point_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)
{
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++)
{
temp = i;
ap_tp_release_buf[1] = (temp<<4)|0x01;
app_tp_screen_analysis_int(0, ap_tp_release_buf,8);
for(i = 0; i < 5; i++)
{
temp = i;
ap_tp_release_buf[1] = (temp << 4) | 0x01;
delayMs(6);
}
app_tp_screen_analysis_int(0, ap_tp_release_buf, 8);
delayMs(6);
}
}
/**************************************************************************
@ -377,27 +378,27 @@ void ap_tp_st_touch_simulate_finger_release_event(void)
**************************************************************************/
void ap_tp_st_touch_software_reset(void)
{
TAU_LOGD("st_touch_software_reset \n");
ap_tp_st_touch_simulate_finger_release_event();
ap_tp_st_touch_scan_point_init();
app_tp_m_write(st_touch_tp_tuning_clkreset, sizeof(st_touch_tp_tuning_clkreset)); // clk reset
while(!hal_i2c_m_transfer_complate());
delayMs(5);
{
TAU_LOGD("st_touch_software_reset \n");
ap_tp_st_touch_simulate_finger_release_event();
ap_tp_st_touch_scan_point_init();
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());
delayMs(5);
app_tp_m_write(st_touch_tp_tuning_clkreset, sizeof(st_touch_tp_tuning_clkreset)); // clk reset
while(!hal_i2c_m_transfer_complate());
delayMs(5);
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());
delayMs(5);
app_tp_m_write(st_touch_tp_tuning_clearfifo, sizeof(st_touch_tp_tuning_clearfifo));//0xA4,0x00,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_init_sensor_on, sizeof(st_touch_init_sensor_on));//0xA0,0x00,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_tp_tuning_clearfifo, sizeof(st_touch_tp_tuning_clearfifo));//0xA4,0x00,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_init_sensor_on, sizeof(st_touch_init_sensor_on));//0xA0,0x00,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(5);
// app_tp_screen_reset();
}
@ -411,25 +412,25 @@ void ap_tp_st_touch_software_reset(void)
**************************************************************************/
void ap_tp_st_touch_hardware_reset(void)
{
TAU_LOGD("st_touch_hardware_reset \n");
ap_tp_st_touch_simulate_finger_release_event();
ap_tp_st_touch_scan_point_init();
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH);
TAU_LOGD("st_touch_hardware_reset \n");
ap_tp_st_touch_simulate_finger_release_event();
ap_tp_st_touch_scan_point_init();
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH);
delayMs(2);
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_LOW);
delayMs(2);
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}
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_init_sensor_off, sizeof(st_touch_init_sensor_off));//0xA0,0x00,0x00
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_init_sensor_on, sizeof(st_touch_init_sensor_on));//0xA0,0x00,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_tp_tuning_clearfifo, sizeof(st_touch_tp_tuning_clearfifo));//0xA4,0x00,0x01}
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_init_sensor_off, sizeof(st_touch_init_sensor_off));//0xA0,0x00,0x00
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_init_sensor_on, sizeof(st_touch_init_sensor_on));//0xA0,0x00,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(5);
}
/**************************************************************************
@ -440,93 +441,93 @@ void ap_tp_st_touch_hardware_reset(void)
* @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++)
{
eventdata = screendata[i];
eventid = (screendata[i+1]>>4)+1;
i+=7;
for(i = 0; i < len; i++)
{
eventdata = screendata[i];
eventid = (screendata[i + 1] >> 4) + 1;
i += 7;
if(eventdata == 0x13) // 按下事件
{
for(j=0;j<ST_TP_SCAN_POINT_NUMBER_MAX;j++)
{
if(tp_scan_data.tp_point_buffer[j] == eventid)
{
flag = 1;
break;
}
}
if(flag==0) // 轮询没有该ID需要保存
{
for(j=0;j<ST_TP_SCAN_POINT_NUMBER_MAX;j++) //寻找空位
{
if(tp_scan_data.tp_point_buffer[j] == 0x00)
{
tp_scan_data.tp_point_buffer[j] = eventid;
tp_scan_data.tp_read_point_counter++;
break;
}
}
}
}
if(eventdata == 0x13) // 按下事件
{
for(j = 0; j < ST_TP_SCAN_POINT_NUMBER_MAX; j++)
{
if(tp_scan_data.tp_point_buffer[j] == eventid)
{
flag = 1;
break;
}
}
if(eventdata == 0x33 && (tp_scan_data.tp_read_point_counter>0)) // 释放事件
{
for(j=0;j<ST_TP_SCAN_POINT_NUMBER_MAX;j++)
{
if(tp_scan_data.tp_point_buffer[j] == eventid) // 有该事件需要释放
{
tp_scan_data.tp_point_buffer[j] = 0;
tp_scan_data.tp_read_point_counter--;
break;
}
}
if(flag == 0) // 轮询没有该ID需要保存
{
for(j = 0; j < ST_TP_SCAN_POINT_NUMBER_MAX; j++) //寻找空位
{
if(tp_scan_data.tp_point_buffer[j] == 0x00)
{
tp_scan_data.tp_point_buffer[j] = eventid;
tp_scan_data.tp_read_point_counter++;
break;
}
}
tp_scan_data.tp_point_up_error_flag = 1;
tp_scan_data.tp_point_error_time_counter = 0;
}
if(eventdata == 0x23) // 移动MOVE事件
{
tp_scan_data.tp_point_up_error_flag = 1;
tp_scan_data.tp_point_error_time_counter = 0;
}
}
}
}
if(eventdata == 0x33 && (tp_scan_data.tp_read_point_counter > 0)) // 释放事件
{
for(j = 0; j < ST_TP_SCAN_POINT_NUMBER_MAX; j++)
{
if(tp_scan_data.tp_point_buffer[j] == eventid) // 有该事件需要释放
{
tp_scan_data.tp_point_buffer[j] = 0;
tp_scan_data.tp_read_point_counter--;
break;
}
}
tp_scan_data.tp_point_up_error_flag = 1;
tp_scan_data.tp_point_error_time_counter = 0;
}
if(eventdata == 0x23) // 移动MOVE事件
{
tp_scan_data.tp_point_up_error_flag = 1;
tp_scan_data.tp_point_error_time_counter = 0;
}
}
}
/**************************************************************************
* @name : ap_tp_st_touch_scan_point_record_event_exec
* @brief : st touch while(1)
* @param[in] :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
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_error_time_counter < (65536/10)) // 65536*3 = 900ms 65536/10 = 30ms
{
tp_scan_data.tp_point_error_time_counter ++;
}
else // 没有收到move 或者release 时间超时
{
if(tp_scan_data.tp_read_point_counter>0) // 有残留点
{
printf("release finger %2d\n",tp_scan_data.tp_read_point_counter);
tp_scan_data.tp_read_point_counter = 0;
ap_tp_st_touch_simulate_finger_release_event();
}
ap_tp_st_touch_scan_point_init();
}
}
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
{
tp_scan_data.tp_point_error_time_counter ++;
}
else // 没有收到move 或者release 时间超时
{
if(tp_scan_data.tp_read_point_counter > 0) // 有残留点
{
// printf("release finger %2d\n",tp_scan_data.tp_read_point_counter);
tp_scan_data.tp_read_point_counter = 0;
ap_tp_st_touch_simulate_finger_release_event();
}
ap_tp_st_touch_scan_point_init();
}
}
}
/**************************************************************************
@ -539,13 +540,13 @@ void ap_tp_st_touch_scan_point_record_event_exec(void)
void ap_tp_st_touch_error_handler_F3(uint8_t* screendata)
{
// 收到 TP 异常回复 0xF3 0x02 0x00 0x00 0x00 0x00 0x00 0x00
if(screendata[0] == 0xF3 && screendata[1] == 0x02 && screendata[2] == 0x00)
{
ap_tp_st_touch_software_reset();
}
// if(screendata[0] == 0xF3 && screendata[1] == 0x91 && screendata[2] == 0x00)
// 收到 TP 异常回复 0xF3 0x02 0x00 0x00 0x00 0x00 0x00 0x00
if(screendata[0] == 0xF3 && screendata[1] == 0x02 && screendata[2] == 0x00)
{
ap_tp_st_touch_software_reset();
}
// if(screendata[0] == 0xF3 && screendata[1] == 0x91 && screendata[2] == 0x00)
// {
// ap_tp_st_touch_software_reset();
// }
@ -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)
{
// 收到 TP 异常回复 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
if(screendata[1] == 0xFF && screendata[2] == 0xFF&& screendata[3] == 0xFF&&screendata[4] == 0xFF)
{
ap_tp_st_touch_software_reset();
}
// 收到 TP 异常回复 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
if(screendata[1] == 0xFF && screendata[2] == 0xFF && screendata[3] == 0xFF && screendata[4] == 0xFF)
{
ap_tp_st_touch_software_reset();
}
}

View File

@ -296,6 +296,7 @@ typedef enum
ERR_HANDLE_L1 = 1,
ERR_HANDLE_L2 = 2,
ERR_HANDLE_L3 = 3,
ERR_HANDLE_L4 = 4,
ERR_HANDLE_MAX
} 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时内部处理 */
bool used; /* handle使用标志位 */
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_err_handle_level_e err_handler_level; /* RX接收错误的时候对模块做reset等级, 等级越高reset模块越多 */
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);
/*
* @brief 0XFF命令
* @brief ,.
hal_dsi_rx_ctrl_set_auto_hw_filter关闭hw filter用于获取所有软件CMD
* @param rx_ctrl_handle: dsi rx handle
* @param
* @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)

View File

@ -52,7 +52,9 @@ typedef struct
uint8_t blank_rows; /* 默认为0, 针对特殊屏使用大于0时生效表示向下补黑blank_rows行 */
uint8_t blank_columns; /* 默认为0, 针对特殊屏使用大于0时生效表示向右补黑blank_columns列 */
bool lp_exit_lpdt; /* 每一条LP CMD都退出LPDT */
#if defined(ISP_568) || defined(ISP_368)
bool tx_cmd_mode_sync; /* TX command mode 输出同步 */
#endif
} 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 cmd_count:
* @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发送命令
@ -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 size: 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溢出时钟分频系统

View File

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