889 lines
30 KiB
C
889 lines
30 KiB
C
|
/*******************************************************************************
|
|||
|
*
|
|||
|
*
|
|||
|
* File: app_tp_transfer.c
|
|||
|
* Description touch I2C/SPI <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>
|
|||
|
* Version V0.1
|
|||
|
* Date 2021-10-14
|
|||
|
* Author zhanghz
|
|||
|
*******************************************************************************/
|
|||
|
#include "test_cfg_global.h"
|
|||
|
#include "app_tp_transfer.h"
|
|||
|
#include "hal_i2c_master.h"
|
|||
|
#include "hal_i2c_slave.h"
|
|||
|
#include "hal_spi_master.h"
|
|||
|
#include "hal_spi_slave.h"
|
|||
|
#include "tau_log.h"
|
|||
|
#include "tau_delay.h"
|
|||
|
#include "ap_demo.h"
|
|||
|
#include "app_tp_st_touch.h"
|
|||
|
|
|||
|
#if 1//def AP_TP_TRANSFER
|
|||
|
uint8_t read_point; //<2F><>ǰҪ<C7B0><D2AA><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8BYTE<54><45><EFBFBD><EFBFBD>
|
|||
|
uint8_t s_screen_number[2];
|
|||
|
uint8_t s_screen_temp[2];
|
|||
|
uint8_t s_screen_read_bak[80];
|
|||
|
static uint8_t s_screen_read_buffer[BUFFER_SIZE_MAX];
|
|||
|
static uint8_t s_phone_read_buffer[BUFFER_SIZE_MAX];
|
|||
|
|
|||
|
uint8_t s_screen_read_MI10Pro[8];
|
|||
|
uint8_t s_screen_read_MI10Pro_1[100];
|
|||
|
|
|||
|
|
|||
|
|
|||
|
static bool s_spim_write = false; //<2F><>¼SPI<50><49><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>÷<EFBFBD><C3B7>ͣ<EFBFBD><CDA3>ǵĻ<C7B5><C4BB><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>RXFIFO
|
|||
|
static bool s_screen_int_flag = false; //<2F><>¼<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>Ļ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
static bool s_phone_reset_flag = false; //<2F><>¼<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>յ<EFBFBD><D5B5>ֻ<EFBFBD><D6BB>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ź<EFBFBD>
|
|||
|
static bool s_screen_int_transfer_status = false; //<2F><>¼<EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD>ʼͨ<CABC><CDA8>
|
|||
|
bool s_screen_init_complate = false; //<2F><>ĻTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD>־
|
|||
|
static uint8_t s_screen_const_transfer_count = 0xff; //<2F><>¼<EFBFBD><C2BC>ǰͨ<C7B0>ŵ<EFBFBD><C5B5><EFBFBD>һ<EFBFBD><D2BB>,<2C><>ʼֵ<CABC><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> screen_reg_start_data_size
|
|||
|
|
|||
|
|
|||
|
#ifdef USE_FOR_SUMSUNG_S20
|
|||
|
uint16_t u16TouchID;
|
|||
|
#endif
|
|||
|
static void app_tp_transfer_phone(size_t recieve_num);
|
|||
|
//static void app_tp_reset_callback(void *data);
|
|||
|
#if PHONE_SLAVE_TRANSFER_I2C //<2F><><EFBFBD><EFBFBD>warning
|
|||
|
static void app_tp_i2cs_callback(e_i2c_s_int_status int_status, size_t recieve_num);
|
|||
|
#endif
|
|||
|
#if PHONE_SLAVE_TRANSFER_SPI //<2F><><EFBFBD><EFBFBD>warning
|
|||
|
static void app_tp_spis_callback(hal_spis_event_e event, hal_spi_packet_info_t *packet_info);
|
|||
|
#endif
|
|||
|
|
|||
|
#ifdef USE_FOR_MI10_PRO
|
|||
|
uint8_t MI10_PRO_screen_init_data1[3] = {0xA0,0x00,0x01};
|
|||
|
uint8_t MI10_PRO_screen_init_data2[6] = {0xA2,0x03,0x00,0x00,0x00,0x03};
|
|||
|
uint8_t MI10_PRO_screen_init_data3[3] = {0xA2,0x02,0x00};
|
|||
|
uint8_t MI10_PRO_screen_init_data4[3] = {0xC0,0x07,0x01};
|
|||
|
|
|||
|
uint8_t MI10_PRO_screen_init_data5[3] = {0xA4,0x06,0x70};
|
|||
|
uint8_t MI10_PRO_screen_init_data6[3] = {0xA6,0x00,0x00};
|
|||
|
uint8_t MI10_PRO_screen_init_data7[5] = {0xFA,0x20,0x00,0x00,0x78};
|
|||
|
|
|||
|
uint8_t MI10_PRO_screen_init_data8[6] = {0xA2,0x03,0x20,0x00,0x00,0x00};
|
|||
|
uint8_t MI10_PRO_screen_init_data9[2] = {0xA0,0x01};
|
|||
|
uint8_t MI10_PRO_screen_init_data10[3] = {0xA0,0x00,0x00};
|
|||
|
uint8_t MI10_PRO_screen_init_data11[3] = {0xC0,0x07,0x00};
|
|||
|
uint8_t MI10_PRO_screen_init_data12[3] = {0xA4,0x00,0x00};
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
#if 0//def ADD_TP_TUNING
|
|||
|
uint8_t MI10_PRO_TP_Tuning_data1[3] = {0xA4,0x00,0x00}; // System Reset
|
|||
|
uint8_t MI10_PRO_TP_Tuning_data2[3] = {0xA4,0x00,0x03}; // FPnl Init
|
|||
|
uint8_t MI10_PRO_TP_Tuning_data3[3] = {0xA4,0x00,0x02}; // Pnl Init
|
|||
|
uint8_t MI10_PRO_TP_Tuning_data4[4] = {0xA4,0x03,0x13,0x00}; // TuneM
|
|||
|
uint8_t MI10_PRO_TP_Tuning_data5[4] = {0xA4,0x03,0x0C,0x00}; // TuneS
|
|||
|
uint8_t MI10_PRO_TP_Tuning_data6[3] = {0xA4,0x05,0x01}; // SvCfg
|
|||
|
uint8_t MI10_PRO_TP_Tuning_data7[3] = {0xA4,0x05,0x02}; // SvCx
|
|||
|
uint8_t MI10_PRO_TP_Tuning_data8[3] = {0xA4,0x05,0x04}; // SvPnl
|
|||
|
#endif
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_screen_int_callback
|
|||
|
* @brief : screen <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD> <EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
static void app_tp_screen_int_callback(void *data)
|
|||
|
{
|
|||
|
s_screen_int_flag = true;
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_screen_int_lvl_low
|
|||
|
* @brief : <EFBFBD><EFBFBD>ȡ screen <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD> IO <EFBFBD><EFBFBD>ƽ
|
|||
|
* @param[in] :
|
|||
|
* @return : true<EFBFBD><EFBFBD>IO Ϊ<EFBFBD>͵<EFBFBD>ƽ
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
static bool app_tp_screen_int_lvl_low(void)
|
|||
|
{
|
|||
|
#if SCREEN_MASTER_TRANSFER_I2C
|
|||
|
return false;
|
|||
|
#elif SCREEN_MASTER_TRANSFER_SPI
|
|||
|
return !hal_gpio_get_input_data(g_screen_input_int_pad); //Ӧ<><D3A6>SPI<50><49><EFBFBD><EFBFBD>ͨ<EFBFBD>Ź<EFBFBD><C5B9><EFBFBD><EFBFBD><EFBFBD>ż<EFBFBD><C5BC>ͻȻ<CDBB><C8BB><EFBFBD><EFBFBD>CS <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>쳣
|
|||
|
#else
|
|||
|
return false;
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_screen_int_init
|
|||
|
* @brief : screen <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD> IO <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
static void app_tp_screen_int_init(void)
|
|||
|
{
|
|||
|
hal_gpio_set_pull_state(g_screen_input_int_pad, ENABLE, DISABLE); // 1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
hal_gpio_ctrl_eint(g_screen_input_int_pad, DISABLE); // 2.<2E>ر<EFBFBD><D8B1>ж<EFBFBD>
|
|||
|
hal_gpio_init_eint(g_screen_input_int_pad, DETECT_FALLING_EDGE); // 3.<2E>жϳ<D0B6>ʼ<EFBFBD><CABC>,TPһ<50>㶼<EFBFBD><E3B6BC><EFBFBD>½<EFBFBD><C2BD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
hal_gpio_reg_eint_cb(g_screen_input_int_pad, app_tp_screen_int_callback); // 4.ע<><D7A2><EFBFBD>ص<EFBFBD>
|
|||
|
hal_gpio_ctrl_eint(g_screen_input_int_pad, ENABLE); // 5.ʹ<><CAB9><EFBFBD>ж<EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
#if 0
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_phone_reset_init
|
|||
|
* @brief : phone reset <EFBFBD>ж<EFBFBD> IO <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
static void app_tp_phone_reset_init(void)
|
|||
|
{
|
|||
|
/*0.<2E><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>*/
|
|||
|
hal_gpio_init_input(g_phone_input_rst_pad);
|
|||
|
/*1.<2E>ر<EFBFBD><D8B1>ж<EFBFBD>*/
|
|||
|
hal_gpio_ctrl_eint(g_phone_input_rst_pad, DISABLE);
|
|||
|
/*2.<2E>жϳ<D0B6>ʼ<EFBFBD><CABC>*/
|
|||
|
hal_gpio_init_eint(g_phone_input_rst_pad, DETECT_RISING_EDGE);
|
|||
|
/*3.ע<><D7A2><EFBFBD>ص<EFBFBD>*/
|
|||
|
hal_gpio_reg_eint_cb(g_phone_input_rst_pad, app_tp_reset_callback);
|
|||
|
/*4.ʹ<><CAB9><EFBFBD>ж<EFBFBD>*/
|
|||
|
hal_gpio_ctrl_eint(g_phone_input_rst_pad, ENABLE);
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_screen_init
|
|||
|
* @brief : screen IO <EFBFBD><EFBFBD><EFBFBD>䣬<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
void app_tp_screen_init(void)
|
|||
|
{
|
|||
|
hal_gpio_init_output(g_screen_input_rst_pad, IO_LVL_HIGH);
|
|||
|
delayUs(200);
|
|||
|
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_LOW);
|
|||
|
delayUs(200);
|
|||
|
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_init
|
|||
|
* @brief : <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
void app_tp_init(void)
|
|||
|
{
|
|||
|
#if 0//def DISABLE_TDDI_I2C_FUNCTION
|
|||
|
// hal_gpio_init_output(g_phone_output_int_pad, IO_LVL_HIGH); //<2F><><EFBFBD><EFBFBD>phone<6E><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>IO<49><4F>
|
|||
|
hal_gpio_init_output(g_screen_input_rst_pad, IO_LVL_HIGH); //<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>TP RESET
|
|||
|
|
|||
|
// hal_gpio_set_mode(IO_PAD_TD_SPIM_CLK,IO_MODE_I2C1_SCL);
|
|||
|
// hal_gpio_set_mode(IO_PAD_TD_SPIM_CSN,IO_MODE_I2C1_SDA);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return;
|
|||
|
#else
|
|||
|
hal_gpio_set_pull_state(IO_PAD_TD_SPIM_CLK, ENABLE, DISABLE);
|
|||
|
hal_gpio_set_pull_state(IO_PAD_TD_SPIM_CSN, ENABLE, DISABLE);
|
|||
|
#endif
|
|||
|
|
|||
|
app_tp_screen_init(); //<2F><>ʼ<EFBFBD><CABC><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>λ<EFBFBD><CEBB>IO<49><4F>
|
|||
|
// app_tp_screen_int_init(); //<2F><><EFBFBD><EFBFBD>screen<65>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#ifdef G_PHONE_INT_DEFAULT_LOW
|
|||
|
hal_gpio_init_output(g_phone_output_int_pad, IO_LVL_LOW); //<2F><><EFBFBD><EFBFBD>phone<6E><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>IO<49><4F>
|
|||
|
#else
|
|||
|
hal_gpio_init_output(g_phone_output_int_pad, IO_LVL_HIGH); //<2F><><EFBFBD><EFBFBD>phone<6E><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>IO<49><4F>
|
|||
|
// hal_gpio_init_input(g_phone_output_int_pad);
|
|||
|
hal_gpio_set_pull_state(g_screen_input_int_pad, ENABLE, DISABLE);
|
|||
|
hal_gpio_init_input(g_screen_input_int_pad);
|
|||
|
#endif
|
|||
|
hal_gpio_init_output(g_screen_input_rst_pad, IO_LVL_HIGH); //<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>TP RESET
|
|||
|
|
|||
|
#if SCREEN_MASTER_TRANSFER_I2C
|
|||
|
hal_i2c_m_dma_init(SCREEN_I2C_ADDRESS, SCREEN_I2C_ADDR_BITS, I2C_MASTER_SPEED);
|
|||
|
#elif SCREEN_MASTER_TRANSFER_SPI
|
|||
|
hal_spi_m_dma_init(SPI_MASTER_SPEED, SCREEN_SPI_CPHA, SCREEN_SPI_CPOL);
|
|||
|
#endif
|
|||
|
|
|||
|
#if PHONE_SLAVE_TRANSFER_I2C
|
|||
|
hal_i2c_s_init(CHIP_I2C_ADDRESS, CHIP_I2C_ADDR_BITS);
|
|||
|
hal_i2c_s_set_transfer(app_tp_i2cs_callback);
|
|||
|
hal_i2c_s_nonblocking_read(s_phone_read_buffer, BUFFER_SIZE_MAX); //<2F><><EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><C3BD><EFBFBD> buffer
|
|||
|
#elif PHONE_SLAVE_TRANSFER_SPI
|
|||
|
hal_spi_slave_init(PHONE_SPI_CPHA, PHONE_SPI_CPOL, true); // <20><>ʼ<EFBFBD><CABC>spi<70>Լ<EFBFBD>dma
|
|||
|
hal_spi_slave_register_callback(app_tp_spis_callback); // ע<><D7A2><EFBFBD>ص<EFBFBD>
|
|||
|
hal_spi_slave_auto_transfer_abort(); // ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>
|
|||
|
hal_spi_slave_flush_fifo(); // Flush FIFO
|
|||
|
|
|||
|
/* ÿ<><C3BF>packet<65>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>, circle mode Ϊfalse, <20><><EFBFBD>յ<EFBFBD>buffer max size<7A><65><EFBFBD>ݺ<EFBFBD>buffer<65><72><EFBFBD>ٸ<EFBFBD><D9B8><EFBFBD>, packet<65><74><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD>ûص<C3BB> */
|
|||
|
hal_spi_slave_set_auto_rx_buffer(s_phone_read_buffer, BUFFER_SIZE_MAX, false); // <20><><EFBFBD><EFBFBD>auto rx buffer
|
|||
|
hal_spi_slave_set_auto_tx_buffer(phone_reg_const_data[0].write_back, phone_reg_const_data[0].write_back_size, false); // <20><><EFBFBD><EFBFBD>TX BUFFER
|
|||
|
|
|||
|
hal_spi_slave_enable(); // <20><><EFBFBD><EFBFBD>spis
|
|||
|
hal_spi_slave_auto_transfer_start(); // <20><><EFBFBD><EFBFBD>rx<72>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#endif
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_m_transfer_complate
|
|||
|
* @brief : <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|||
|
* @param[in] :
|
|||
|
* @return :true: ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
bool app_tp_m_transfer_complate(void)
|
|||
|
{
|
|||
|
#if SCREEN_MASTER_TRANSFER_I2C
|
|||
|
return hal_i2c_m_transfer_complate();
|
|||
|
#elif SCREEN_MASTER_TRANSFER_SPI
|
|||
|
return hal_spi_m_get_transfer_complate();
|
|||
|
#else
|
|||
|
return true;
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_s_transfer_complate
|
|||
|
* @brief : <EFBFBD><EFBFBD>ȡ<EFBFBD>ӻ<EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|||
|
* @param[in] :
|
|||
|
* @return :true: ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
bool app_tp_s_transfer_complate(void)
|
|||
|
{
|
|||
|
#if SCREEN_MASTER_TRANSFER_I2C
|
|||
|
return hal_i2c_s_write_complate() && hal_i2c_s_read_complate();
|
|||
|
#elif SCREEN_MASTER_TRANSFER_SPI
|
|||
|
return !hal_spi_slave_busy();
|
|||
|
#else
|
|||
|
return true;
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_m_write
|
|||
|
* @brief : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ŷ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD>txbuffer<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param[in] :txbuffer: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> buffer ͷ<EFBFBD><EFBFBD>ַ
|
|||
|
* @param[in] :buffer_size: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> buffer <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
void app_tp_m_write(const uint8_t *txbuffer, size_t buffer_size)
|
|||
|
{
|
|||
|
#if SCREEN_MASTER_TRANSFER_I2C
|
|||
|
hal_i2c_m_dma_write(txbuffer, buffer_size);
|
|||
|
#elif SCREEN_MASTER_TRANSFER_SPI
|
|||
|
hal_spi_m_dma_write(txbuffer, buffer_size);
|
|||
|
s_spim_write = true;
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_m_read
|
|||
|
* @brief : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ŷ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD>txbuffer<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD>rxbuffer
|
|||
|
* @param[in] :cmd: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> buffer ͷ<EFBFBD><EFBFBD>ַ
|
|||
|
* @param[in] :cmd_size: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> buffer <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param[in] :data_buffer: <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> buffer ͷ<EFBFBD><EFBFBD>ַ
|
|||
|
* @param[in] :data_size: <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> buffer <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
void app_tp_m_read(const uint8_t *cmd, size_t cmd_size, uint8_t *data_buffer, size_t data_size)
|
|||
|
{
|
|||
|
#if SCREEN_MASTER_TRANSFER_I2C
|
|||
|
uint8_t i = 0;
|
|||
|
uint32_t address = 0;
|
|||
|
|
|||
|
for (i = 0; i < cmd_size; i++) //<2F>Ƚ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD> address
|
|||
|
{
|
|||
|
address |= (uint32_t)cmd[i] << i * 8;
|
|||
|
}
|
|||
|
hal_i2c_m_dma_read(address, cmd_size, data_buffer, data_size);
|
|||
|
#elif SCREEN_MASTER_TRANSFER_SPI
|
|||
|
hal_spi_m_dma_read(cmd, cmd_size, data_buffer, data_size);
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_s_write
|
|||
|
* @brief : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ŷ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD>txbuffer<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param[in] :txbuffer: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> buffer ͷ<EFBFBD><EFBFBD>ַ
|
|||
|
* @param[in] :buffer_size: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> buffer <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
void app_tp_s_write(const uint8_t *txbuffer, size_t buffer_size)
|
|||
|
{
|
|||
|
#if PHONE_SLAVE_TRANSFER_I2C
|
|||
|
hal_i2c_s_dma_write(txbuffer, buffer_size);
|
|||
|
#elif PHONE_SLAVE_TRANSFER_SPI
|
|||
|
//while (hal_spi_slave_busy());
|
|||
|
hal_spi_slave_auto_transfer_abort();
|
|||
|
hal_spi_slave_flush_fifo();
|
|||
|
hal_spi_slave_set_auto_tx_buffer(txbuffer, buffer_size, true);
|
|||
|
hal_spi_slave_auto_transfer_start();
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_s_read
|
|||
|
* @brief : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ŷ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>rxbuffer
|
|||
|
* @param[in] :rxBuffer: <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> buffer ͷ<EFBFBD><EFBFBD>ַ
|
|||
|
* @param[in] :data_size: <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> buffer <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
void app_tp_s_read(void *rxBuffer, size_t data_size)
|
|||
|
{
|
|||
|
#if PHONE_SLAVE_TRANSFER_I2C
|
|||
|
hal_i2c_s_nonblocking_read(rxBuffer, data_size);
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_spis_callback
|
|||
|
* @brief : SPI slave <EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
#if PHONE_SLAVE_TRANSFER_I2C //<2F><><EFBFBD><EFBFBD>warning
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD>int_status=0<><30>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>=2<><32>ΪSTOP<4F><50>=1δ<31><CEB4><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD>
|
|||
|
//recieve_numΪ<6D><CEAA><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
static void app_tp_i2cs_callback(e_i2c_s_int_status int_status, size_t recieve_num)
|
|||
|
{
|
|||
|
#if 0 // 1: test
|
|||
|
if (int_status >2)
|
|||
|
{
|
|||
|
s_phone_read_buffer[2]=int_status;
|
|||
|
s_phone_read_buffer[3]=recieve_num;
|
|||
|
app_tp_m_write(s_phone_read_buffer, 4);
|
|||
|
}
|
|||
|
#endif
|
|||
|
app_tp_transfer_phone(recieve_num);
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_spis_callback
|
|||
|
* @brief : SPI slave <EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
#if PHONE_SLAVE_TRANSFER_SPI //<2F><><EFBFBD><EFBFBD>warning
|
|||
|
static void app_tp_spis_callback(hal_spis_event_e event, hal_spi_packet_info_t *packet_info)
|
|||
|
{
|
|||
|
app_tp_transfer_phone(packet_info->packet_size);
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
#if 0
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_reset_callback
|
|||
|
* @brief : <EFBFBD>ֻ<EFBFBD> IO<EFBFBD><EFBFBD><EFBFBD>临λ<EFBFBD><EFBFBD><EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
static void app_tp_reset_callback(void *data)
|
|||
|
{
|
|||
|
TAU_LOGD("app_tp_reset_callback\n");
|
|||
|
s_phone_reset_flag = true;
|
|||
|
app_tp_s_write(phone_reg_const_data[0].write_back, phone_reg_const_data[0].write_back_size);
|
|||
|
#if PHONE_SLAVE_TRANSFER_SPI
|
|||
|
hal_gpio_set_output_data(IO_PAD_AP_INT, IO_LVL_LOW);
|
|||
|
#endif
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_transfer_screen_const
|
|||
|
* @brief : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>flow<EFBFBD><EFBFBD>дscreen<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> screen <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
*<EFBFBD><EFBFBD>TP<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>screen_reg_start_data[]<EFBFBD><EFBFBD>
|
|||
|
**************************************************************************/
|
|||
|
static void app_tp_transfer_screen_const(void)
|
|||
|
{
|
|||
|
// static bool screen_const_transfer_buffer_ready = true; //<2F><><EFBFBD><EFBFBD> buffer <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
|||
|
uint8_t ii;
|
|||
|
uint8_t len=0;
|
|||
|
/**** 1. <20>жϵ<D0B6>ǰ״̬ͨ<CCAC><CDA8><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>, ״̬ͨ<CCAC><CDA8><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҿ<EFBFBD><D2BF><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>****/
|
|||
|
|
|||
|
#if 1
|
|||
|
if(phone_start_flag)
|
|||
|
{
|
|||
|
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(2);
|
|||
|
while(!hal_gpio_get_input_data(g_screen_input_int_pad))
|
|||
|
{
|
|||
|
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(2);
|
|||
|
}
|
|||
|
app_tp_m_write(MI10_PRO_screen_init_data1, sizeof(MI10_PRO_screen_init_data1));//0xA0,0x00,0x01
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
app_tp_m_write(MI10_PRO_screen_init_data2, sizeof(MI10_PRO_screen_init_data2));//0xA2,0x03,0x00,0x00,0x00,0x03
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
app_tp_m_write(MI10_PRO_screen_init_data3, sizeof(MI10_PRO_screen_init_data3));//0xA2,0x02,0x00
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
app_tp_m_write(MI10_PRO_screen_init_data4, sizeof(MI10_PRO_screen_init_data4));//0xC0,0x07,0x01
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
|
|||
|
#ifdef ADD_TP_TUNING
|
|||
|
app_tp_m_write(MI10_PRO_TP_Tuning_data1, sizeof(MI10_PRO_TP_Tuning_data1));
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(10);
|
|||
|
app_tp_m_write(MI10_PRO_TP_Tuning_data2, sizeof(MI10_PRO_TP_Tuning_data2));
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
app_tp_m_write(MI10_PRO_TP_Tuning_data3, sizeof(MI10_PRO_TP_Tuning_data3));
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
app_tp_m_write(MI10_PRO_TP_Tuning_data4, sizeof(MI10_PRO_TP_Tuning_data4));
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
app_tp_m_write(MI10_PRO_TP_Tuning_data5, sizeof(MI10_PRO_TP_Tuning_data5));
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
app_tp_m_write(MI10_PRO_TP_Tuning_data6, sizeof(MI10_PRO_TP_Tuning_data6));
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
app_tp_m_write(MI10_PRO_TP_Tuning_data7, sizeof(MI10_PRO_TP_Tuning_data7));
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
app_tp_m_write(MI10_PRO_TP_Tuning_data8, sizeof(MI10_PRO_TP_Tuning_data8));
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
#endif
|
|||
|
|
|||
|
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
if(s_screen_read_buffer[7]>0)
|
|||
|
{
|
|||
|
len=s_screen_read_buffer[7]*8;
|
|||
|
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, len);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
}
|
|||
|
#endif
|
|||
|
if(hal_gpio_get_input_data(g_screen_input_int_pad))
|
|||
|
{
|
|||
|
s_screen_init_complate = true;
|
|||
|
app_tp_screen_int_init();
|
|||
|
phone_start_flag=0;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void ap_doubleclick(void)
|
|||
|
{
|
|||
|
|
|||
|
// app_tp_m_write(MI10_PRO_screen_init_data8, sizeof(MI10_PRO_screen_init_data8));//0xA2,0x03,0x20,0x00,0x00,0x00
|
|||
|
// while(!hal_i2c_m_transfer_complate());
|
|||
|
// delayMs(1);
|
|||
|
|
|||
|
// app_tp_m_write(MI10_PRO_screen_init_data9, sizeof(MI10_PRO_screen_init_data9));//0xA0,0x01,
|
|||
|
// while(!hal_i2c_m_transfer_complate());
|
|||
|
// delayMs(1);
|
|||
|
|
|||
|
app_tp_m_write(MI10_PRO_screen_init_data10, sizeof(MI10_PRO_screen_init_data10));//0xA0,0x00,0x00
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
}
|
|||
|
|
|||
|
void ap_doubleclick_1(void)
|
|||
|
{
|
|||
|
app_tp_m_write(MI10_PRO_screen_init_data11, sizeof(MI10_PRO_screen_init_data11));//0xC0,0x07,0x00
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
delayMs(1);
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_transfer_screen_start
|
|||
|
* @brief : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>flow<EFBFBD><EFBFBD>дscreen<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
void app_tp_transfer_screen_start(void)
|
|||
|
{
|
|||
|
// s_screen_init_complate = false;
|
|||
|
s_screen_const_transfer_count = 0;
|
|||
|
//app_tp_screen_init();
|
|||
|
#ifndef DISABLE_I2C_INIT_CODE
|
|||
|
// app_tp_transfer_screen_const();
|
|||
|
#endif
|
|||
|
// s_screen_int_flag = false;
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_transfer_screen_int
|
|||
|
* @brief : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>screen<EFBFBD>жϺ<EFBFBD><EFBFBD><EFBFBD>flow<EFBFBD><EFBFBD>дscreen<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
*<EFBFBD><EFBFBD>TP<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡģ<EFBFBD>鱨<EFBFBD>㣡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>screen_reg_int_data[]<EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>д<EFBFBD><EFBFBD>
|
|||
|
**************************************************************************/
|
|||
|
void app_tp_transfer_screen_int(void)
|
|||
|
{
|
|||
|
uint8_t len=0;
|
|||
|
uint8_t i=0;
|
|||
|
uint8_t count=0;
|
|||
|
bool screen_gpio_int = false;
|
|||
|
static uint8_t screen_int_transfer_count = 0; //<2F><>¼<EFBFBD><C2BC>ǰͨ<C7B0>ŵ<EFBFBD><C5B5><EFBFBD>һ<EFBFBD><D2BB>
|
|||
|
static bool screen_int_transfer_buffer_ready = true; //<2F><><EFBFBD><EFBFBD> buffer <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
|||
|
// static uint8_t test_flag = 0;
|
|||
|
|
|||
|
if (!s_screen_init_complate) //TP <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD>г<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
|
|||
|
app_tp_transfer_screen_const();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
#if 0 //test
|
|||
|
test_flag++;
|
|||
|
if (test_flag >1000000)
|
|||
|
{
|
|||
|
test_flag =0;
|
|||
|
//TAU_LOGD("Run ok!!\n");
|
|||
|
//app_tp_m_read(screen_reg_int_data[0].buffer, screen_reg_int_data[0].txbuffer_size, s_screen_number, screen_reg_int_data[0].rxbuffer_size);
|
|||
|
//while(!hal_i2c_m_transfer_complate());
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
/**** 1. <20>ж<EFBFBD> screen <20>Ƿ<C7B7><F1B7A2B3>ж<EFBFBD><D0B6>ź<EFBFBD> ****/
|
|||
|
// s_screen_int_flag: <20>ж<EFBFBD><D0B6>źű<C5BA>־λ
|
|||
|
// app_tp_screen_int_lvl_low : SPI <20><>ʱ<EFBFBD><CAB1>ͨ<EFBFBD><CDA8>ʱ<EFBFBD><CAB1>ż<EFBFBD><C5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>cs<63><73><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD>־λ<D6BE><CEBB><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
screen_gpio_int = s_screen_int_flag || app_tp_screen_int_lvl_low();
|
|||
|
if (((screen_gpio_int) || (s_screen_int_transfer_status)) && app_tp_m_transfer_complate()) //<2F>жϵ<D0B6>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC>ͨ<EFBFBD><CDA8>
|
|||
|
{
|
|||
|
s_screen_int_flag = false;
|
|||
|
if (s_spim_write) //SPI д<><D0B4><EFBFBD>ݺ<EFBFBD><DDBA><EFBFBD>Ҫ<EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>FIFO<46><4F><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD>һ<EFBFBD>ζ<EFBFBD>ȡ
|
|||
|
{
|
|||
|
hal_spi_m_clear_rxfifo();
|
|||
|
s_spim_write = false;
|
|||
|
}
|
|||
|
|
|||
|
/**** 2. <20><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>ȡ<EFBFBD>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD> ****/
|
|||
|
if (screen_int_transfer_buffer_ready)
|
|||
|
{
|
|||
|
#ifndef READ_MODULE_TP_ONE_BY_ONE
|
|||
|
screen_int_transfer_buffer_ready = false;
|
|||
|
s_screen_int_transfer_status = true;
|
|||
|
#ifdef USE_FOR_MI10_PRO
|
|||
|
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
if(s_screen_read_buffer[7]>0)
|
|||
|
{
|
|||
|
len=s_screen_read_buffer[7]*8;
|
|||
|
app_tp_m_read(screen_reg_int_data[0].buffer, 1, &s_screen_read_buffer[8], len);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
}
|
|||
|
delayUs(100);
|
|||
|
|
|||
|
#if 0
|
|||
|
if(!hal_gpio_get_input_data(g_screen_input_int_pad))
|
|||
|
{
|
|||
|
if((s_screen_read_MI10Pro[0]==0x43)&&(s_screen_read_MI10Pro[1]==0x0A)&&(s_screen_read_MI10Pro[2]==0x01))//<2F><><EFBFBD><EFBFBD>ε<EFBFBD><CEB5><EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD>飬<EFBFBD><E9A3AC><EFBFBD>43 0A 01<30><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>жϲ<D0B6><CFB2><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> System Reset <20><>0xA4 00 00
|
|||
|
{
|
|||
|
app_tp_m_write(MI10_PRO_screen_init_data12, sizeof(MI10_PRO_screen_init_data12));//0xA4,0x00,0x00
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
s_screen_init_complate=0;
|
|||
|
phone_start_flag=1;
|
|||
|
// delayMs(40);
|
|||
|
|
|||
|
for(i=0;i<10;i++)
|
|||
|
{
|
|||
|
s_screen_read_MI10Pro[i*8+0]=0x43;
|
|||
|
s_screen_read_MI10Pro[i*8+1]=((i+1)<<4)+1;
|
|||
|
s_screen_read_MI10Pro[i*8+2]=0;
|
|||
|
s_screen_read_MI10Pro[i*8+3]=0;
|
|||
|
s_screen_read_MI10Pro[i*8+4]=0;
|
|||
|
s_screen_read_MI10Pro[i*8+5]=0;
|
|||
|
s_screen_read_MI10Pro[i*8+6]=0;
|
|||
|
s_screen_read_MI10Pro[i*8+7]=9-i;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
if(!hal_gpio_get_input_data(g_screen_input_int_pad))
|
|||
|
{
|
|||
|
// if((s_screen_read_MI10Pro[0]==0x43)&&(s_screen_read_MI10Pro[1]==0x0A))//<2F><><EFBFBD><EFBFBD>ε<EFBFBD><CEB5><EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD>飬<EFBFBD><E9A3AC><EFBFBD>43 0A 01<30><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>жϲ<D0B6><CFB2><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> System Reset <20><>0xA4 00 00
|
|||
|
{
|
|||
|
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
if(s_screen_read_buffer[7]>0)
|
|||
|
{
|
|||
|
len=s_screen_read_buffer[7]*8;
|
|||
|
app_tp_m_read(screen_reg_int_data[0].buffer, 1, &s_screen_read_buffer[8], len);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
ap_tp_st_touch_scan_point_record_event(s_screen_read_buffer,len+8);
|
|||
|
ap_tp_st_touch_error_handler_F3(s_screen_read_buffer);
|
|||
|
ap_tp_st_touch_error_handler_FF(s_screen_read_buffer);
|
|||
|
|
|||
|
#else
|
|||
|
app_tp_m_read(screen_reg_int_data[0].buffer, screen_reg_int_data[0].txbuffer_size, s_screen_temp, screen_reg_int_data[0].rxbuffer_size);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
app_tp_m_read(screen_reg_int_data[1].buffer, screen_reg_int_data[1].txbuffer_size, s_screen_number, screen_reg_int_data[1].rxbuffer_size);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
//TAU_LOGD("s_screen_number[%4x], size[%4x]", ((s_screen_number[1]<<8)|s_screen_number[0]), ((s_screen_temp[1]<<8)|s_screen_temp[0]));
|
|||
|
|
|||
|
if(s_screen_number[1])
|
|||
|
{
|
|||
|
if (s_screen_number[1]>3)
|
|||
|
{
|
|||
|
read_point =1;
|
|||
|
s_screen_int_transfer_status = false;
|
|||
|
}
|
|||
|
else if (s_screen_number[1] &0x02)
|
|||
|
read_point =10;
|
|||
|
else
|
|||
|
read_point =9;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(s_screen_number[0] &0x80)
|
|||
|
read_point =8;
|
|||
|
else if(s_screen_number[0] &0x40)
|
|||
|
read_point =7;
|
|||
|
else if(s_screen_number[0] &0x20)
|
|||
|
read_point =6;
|
|||
|
else if(s_screen_number[0] &0x10)
|
|||
|
read_point =5;
|
|||
|
else if(s_screen_number[0] &0x08)
|
|||
|
read_point =4;
|
|||
|
else if(s_screen_number[0] &0x04)
|
|||
|
read_point =3;
|
|||
|
else if(s_screen_number[0] &0x02)
|
|||
|
read_point =2;
|
|||
|
else
|
|||
|
read_point =1;
|
|||
|
}
|
|||
|
read_point =8*read_point;
|
|||
|
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
|
|||
|
while(!hal_i2c_m_transfer_complate());
|
|||
|
#endif
|
|||
|
#else
|
|||
|
if (!screen_reg_int_data[screen_int_transfer_count].read_flag) //<2F><>ǰͨ<C7B0>Ų<EFBFBD><C5B2><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>أ<EFBFBD>ֱ<EFBFBD><D6B1>д
|
|||
|
{
|
|||
|
app_tp_m_write(screen_reg_int_data[screen_int_transfer_count].buffer, screen_reg_int_data[screen_int_transfer_count].txbuffer_size);
|
|||
|
}
|
|||
|
else //<2F><>ǰͨ<C7B0><CDA8><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>أ<EFBFBD><D8A3><EFBFBD>д<EFBFBD>ٶ<EFBFBD>
|
|||
|
{
|
|||
|
s_screen_int_transfer_status = true;
|
|||
|
if (screen_int_transfer_count==0)
|
|||
|
{
|
|||
|
app_tp_m_read(screen_reg_int_data[screen_int_transfer_count].buffer, screen_reg_int_data[screen_int_transfer_count].txbuffer_size, \
|
|||
|
s_screen_temp, screen_reg_int_data[screen_int_transfer_count].rxbuffer_size);
|
|||
|
screen_int_transfer_count =1;
|
|||
|
}
|
|||
|
else if (screen_int_transfer_count==1)
|
|||
|
{
|
|||
|
app_tp_m_read(screen_reg_int_data[screen_int_transfer_count].buffer, screen_reg_int_data[screen_int_transfer_count].txbuffer_size, \
|
|||
|
s_screen_number, screen_reg_int_data[screen_int_transfer_count].rxbuffer_size);
|
|||
|
screen_int_transfer_count =2;
|
|||
|
}
|
|||
|
else if (screen_int_transfer_count==2)
|
|||
|
{
|
|||
|
if(s_screen_number[1])
|
|||
|
{
|
|||
|
TAU_LOGD("s_screen_number[%4x], size[%4x]", ((s_screen_number[1]<<8)|s_screen_number[0]), ((s_screen_temp[1]<<8)|s_screen_temp[0]));
|
|||
|
if (s_screen_number[1] &0x02)
|
|||
|
read_point =10;
|
|||
|
else
|
|||
|
read_point =9;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(s_screen_number[0] &0x80)
|
|||
|
read_point =8;
|
|||
|
else if(s_screen_number[0] &0x40)
|
|||
|
read_point =7;
|
|||
|
else if(s_screen_number[0] &0x20)
|
|||
|
read_point =6;
|
|||
|
else if(s_screen_number[0] &0x10)
|
|||
|
read_point =5;
|
|||
|
else if(s_screen_number[0] &0x08)
|
|||
|
read_point =4;
|
|||
|
else if(s_screen_number[0] &0x04)
|
|||
|
read_point =3;
|
|||
|
else if(s_screen_number[0] &0x02)
|
|||
|
read_point =2;
|
|||
|
else
|
|||
|
read_point =1;
|
|||
|
}
|
|||
|
read_point =8*read_point;
|
|||
|
|
|||
|
app_tp_m_read(screen_reg_int_data[screen_int_transfer_count].buffer, screen_reg_int_data[screen_int_transfer_count].txbuffer_size, \
|
|||
|
s_screen_read_buffer, read_point);
|
|||
|
screen_int_transfer_count =0;
|
|||
|
screen_int_transfer_buffer_ready = false;
|
|||
|
}
|
|||
|
}
|
|||
|
#endif
|
|||
|
}
|
|||
|
/**** 3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ͨ<EFBFBD>ŵ<EFBFBD>buffer ****/
|
|||
|
else
|
|||
|
{
|
|||
|
#if 1
|
|||
|
#ifdef USE_FOR_SUMSUNG_S20
|
|||
|
u16TouchID=0x0000;
|
|||
|
#endif
|
|||
|
// if(s_screen_read_buffer[0] == 0xF3 && s_screen_read_buffer[1] == 0x02 && s_screen_read_buffer[2] == 0x00) // <20>յ<EFBFBD> TP <20>쳣<EFBFBD>ظ<EFBFBD> 0xF3 0x02 0x00 0x00 0x00 0x00 0x00 0x00
|
|||
|
// {
|
|||
|
// s_screen_read_buffer[0] =0;
|
|||
|
// ap_tp_system_softReset();
|
|||
|
// TAU_LOGD("TP system reset3\n");
|
|||
|
// return;
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// // printf("%2x,%2d,%2d\n",s_screen_read_buffer[0],screen_reg_int_data[2].rxbuffer_size,screen_int_transfer_count);
|
|||
|
// }
|
|||
|
//
|
|||
|
screen_int_transfer_buffer_ready = true;
|
|||
|
phone_touch_flag=0;
|
|||
|
screen_int_transfer_count = app_tp_screen_analysis_int(screen_int_transfer_count, s_screen_read_buffer,screen_reg_int_data[2].rxbuffer_size);
|
|||
|
screen_int_transfer_count = 0;
|
|||
|
s_screen_int_transfer_status = false;
|
|||
|
|
|||
|
#else
|
|||
|
screen_int_transfer_buffer_ready = true;
|
|||
|
screen_int_transfer_count = app_tp_screen_analysis_int(screen_int_transfer_count, s_screen_read_buffer, \
|
|||
|
screen_reg_int_data[screen_int_transfer_count].rxbuffer_size);
|
|||
|
|
|||
|
if (screen_int_transfer_count > screen_reg_int_data_size) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ͨ<EFBFBD>Ž<EFBFBD><C5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣͨ<D6B9><CDA8>
|
|||
|
{
|
|||
|
screen_int_transfer_count = 0;
|
|||
|
s_screen_int_transfer_status = false;
|
|||
|
return;
|
|||
|
}
|
|||
|
#endif
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_transfer_phone
|
|||
|
* @brief : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param[in] : recieve_num<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
static void app_tp_transfer_phone(size_t recieve_num)
|
|||
|
{
|
|||
|
const uint8_t *phone_write_buffer;
|
|||
|
size_t phone_write_buffer_size = 0;
|
|||
|
/* <20><><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>bufferָ<72><D6B8> */
|
|||
|
if (recieve_num > 0)
|
|||
|
{
|
|||
|
#if 0// 1: test
|
|||
|
s_phone_read_buffer[3]=recieve_num;
|
|||
|
app_tp_m_write(s_phone_read_buffer, 4);
|
|||
|
#endif
|
|||
|
app_tp_phone_analysis_data(s_phone_read_buffer, recieve_num, &phone_write_buffer, &phone_write_buffer_size);
|
|||
|
}
|
|||
|
|
|||
|
app_tp_s_read(s_phone_read_buffer, BUFFER_SIZE_MAX);
|
|||
|
if (phone_write_buffer_size) //<2F><><EFBFBD><EFBFBD>0<EFBFBD><30>ʾ<EFBFBD><CABE>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>buffer
|
|||
|
{
|
|||
|
app_tp_s_write(phone_write_buffer, phone_write_buffer_size);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_phone_reset_on
|
|||
|
* @brief : <EFBFBD><EFBFBD>ȡ<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>źŵ<EFBFBD>״̬
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
bool app_tp_phone_reset_on(void)
|
|||
|
{
|
|||
|
return s_phone_reset_flag;
|
|||
|
}
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* @name : app_tp_phone_clear_reset_on
|
|||
|
* @brief : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>źŵ<EFBFBD>״̬
|
|||
|
* @param[in] :
|
|||
|
* @return :
|
|||
|
* @retval :
|
|||
|
**************************************************************************/
|
|||
|
void app_tp_phone_clear_reset_on(void)
|
|||
|
{
|
|||
|
s_phone_reset_flag = false;
|
|||
|
}
|
|||
|
|
|||
|
#else
|
|||
|
|
|||
|
void app_tp_screen_init(void)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void app_tp_init(void)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void app_tp_transfer_screen_int(void)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void app_tp_transfer_screen_start(void)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
bool app_tp_phone_reset_on(void)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
void app_tp_phone_clear_reset_on(void)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void app_tp_s_write(const uint8_t *txbuffer, size_t buffer_size)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
bool app_tp_enter_sleep_on(void)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
#endif
|
|||
|
|