1、修改部分基板充电花屏;

2、修改开机无触;
3、修改切换帧率触摸显示界面慢半拍。
This commit is contained in:
“苏飞源” 2023-06-06 11:26:27 +08:00
parent bf48271912
commit 1e03fb134e
29 changed files with 1015 additions and 5686 deletions

View File

@ -50,7 +50,7 @@
<InvalidFlash>1</InvalidFlash> <InvalidFlash>1</InvalidFlash>
</TargetStatus> </TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory> <OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>WL568_S21_NT37701_20230522</OutputName> <OutputName>WL568_S21_NT37701_20230606</OutputName>
<CreateExecutable>1</CreateExecutable> <CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib> <CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile> <CreateHexFile>1</CreateHexFile>

File diff suppressed because it is too large Load Diff

View File

@ -145,13 +145,14 @@ void Gpio_swire_output(uint8_t flag, uint8_t num);
#ifdef USE_FOR_SUMSUNG_S21 #ifdef USE_FOR_SUMSUNG_S21
extern uint8_t Flag_blacklight_EN; extern uint8_t Flag_blacklight_EN;
extern uint8_t tp_sleep_in; //extern uint8_t tp_sleep_in;
extern uint8_t tp_sleep_count; //extern uint8_t tp_sleep_count;
uint8_t phone_start_flag=0; uint8_t phone_start_flag=0;
uint16_t phone_DisplayOFF_count=0; uint16_t phone_DisplayOFF_count=0;
uint8_t phone_DisplayOFF_flag=0; uint8_t phone_DisplayOFF_flag=0;
#endif #endif
uint16_t s_tp_delay_count = 0;
static uint32_t curFrame = 0; static uint32_t curFrame = 0;
/// 清晰度较好 /// 清晰度较好
@ -315,6 +316,7 @@ 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);
/* 打开VCC供电 */ /* 打开VCC供电 */
hal_gpio_init_output(IO_PAD_TD_SPIM_MISO, IO_LVL_LOW);
TAU_LOGD("disable reset!!!!!!!!!!!!!\n"); TAU_LOGD("disable reset!!!!!!!!!!!!!\n");
//delayMs(20); //delayMs(20);
hal_system_set_pvd(true); hal_system_set_pvd(true);
@ -325,6 +327,8 @@ static void ap_reset_cb(void *data)
static bool isStart = false; static bool isStart = false;
static bool s_power_up_flag = false;
static bool ap_dcs_read(uint8_t data_type, uint8_t dcs_cmd, uint8_t param) static bool ap_dcs_read(uint8_t data_type, uint8_t dcs_cmd, uint8_t param)
{ {
#ifdef USE_FOR_SUMSUNG_S21 #ifdef USE_FOR_SUMSUNG_S21
@ -518,6 +522,7 @@ static bool ap_dcs_read(uint8_t data_type, uint8_t dcs_cmd, uint8_t param)
{ {
TAU_LOGD("r[%x] [%d] err\r\n", dcs_cmd, return_size); TAU_LOGD("r[%x] [%d] err\r\n", dcs_cmd, return_size);
} }
s_power_up_flag = true;
} }
else if (dcs_cmd == 0xDB) else if (dcs_cmd == 0xDB)
{ {
@ -534,6 +539,7 @@ static bool ap_dcs_read(uint8_t data_type, uint8_t dcs_cmd, uint8_t param)
{ {
TAU_LOGD("r[%x] [%d] err\r\n", dcs_cmd, return_size); TAU_LOGD("r[%x] [%d] err\r\n", dcs_cmd, return_size);
} }
s_power_up_flag = true;
} }
else if (dcs_cmd == 0xDC) else if (dcs_cmd == 0xDC)
{ {
@ -551,6 +557,7 @@ static bool ap_dcs_read(uint8_t data_type, uint8_t dcs_cmd, uint8_t param)
TAU_LOGD("r[%x] [%d] err\r\n", dcs_cmd, return_size); TAU_LOGD("r[%x] [%d] err\r\n", dcs_cmd, return_size);
} }
isStart = true; isStart = true;
s_power_up_flag = true;
} }
else if (dcs_cmd == 0x0A) else if (dcs_cmd == 0x0A)
{ {
@ -1384,7 +1391,8 @@ static bool ap_dcs_read(uint8_t data_type, uint8_t dcs_cmd, uint8_t param)
{ {
static uint8_t frame_rate = 100; static uint8_t frame_rate = 100;
//TAU_LOGD("TE Detected! frame_rate = %d, param[1]=%d\r\n", dcs_packet->packet_param[0], dcs_packet->packet_param[1]); //TAU_LOGD("TE Detected! frame_rate = %d, param[1]=%d\r\n", dcs_packet->packet_param[0], dcs_packet->packet_param[1]);
if( S21_G991B_frame_update == true){ // if( S21_G991B_frame_update == true)
{
if (frame_rate != dcs_packet->packet_param[0]) if (frame_rate != dcs_packet->packet_param[0])
{ {
frame_rate = dcs_packet->packet_param[0]; frame_rate = dcs_packet->packet_param[0];
@ -1397,7 +1405,7 @@ static bool ap_dcs_read(uint8_t data_type, uint8_t dcs_cmd, uint8_t param)
hal_dsi_rx_ctrl_set_tear_mode_ex(g_rx_ctrl_handle, 2400, TE_SOFT_120HZ_MODE); //TE_SOFT_120HZ_MODE hal_dsi_rx_ctrl_set_tear_mode_ex(g_rx_ctrl_handle, 2400, TE_SOFT_120HZ_MODE); //TE_SOFT_120HZ_MODE
} }
//hal_dsi_rx_ctrl_set_tear_mode_ex(g_rx_ctrl_handle, 2200, TE_HW_MODE); //hal_dsi_rx_ctrl_set_tear_mode_ex(g_rx_ctrl_handle, 2200, TE_HW_MODE);
TAU_LOGD("Frame_rate:%02x\r\n",frame_rate); // TAU_LOGD("Frame_rate:%02x\r\n",frame_rate);
} }
} }
return true; return true;
@ -1436,6 +1444,7 @@ static bool pps_update_handle(uint8_t *pps, uint8_t size, uint32_t pic_width, ui
static bool ap_set_display_off(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_packet_t *dcs_packet) static bool ap_set_display_off(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_tx_ctrl_write_cmd(0x05, 0, 2, 0x28); hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x28);
TAU_LOGD("disp off \n"); TAU_LOGD("disp off \n");
return true; return true;
@ -1443,17 +1452,14 @@ static bool ap_set_display_off(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_packet
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(0x05, 0, 2, 0x10);
delayMs(50);
Gpio_swire_output(0, 0); Gpio_swire_output(0, 0);
delayMs(50); delayMs(50);
hal_dsi_tx_ctrl_write_cmd(0x05, 0, 2, 0x10);
delayMs(20);
hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_LOW); hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_LOW);
delayMs(5);
hal_dsi_tx_ctrl_panel_reset_pin(IO_LVL_LOW);//屏端Reaet
//hal_dsi_tx_ctrl_panel_reset_pin(IO_LVL_LOW);//ÆÁ¶ËReaet
TAU_LOGD("enter sleep mode\n"); TAU_LOGD("enter sleep mode\n");
#if ENABLE_TP_WAKE_UP #if ENABLE_TP_WAKE_UP
@ -2102,6 +2108,26 @@ static bool ap_set_tp_calibration_04(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_
#endif #endif
*/ */
static bool ap_set_hbm_53(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_packet_t *dcs_packet)
{
uint8_t cmd_data[2];
cmd_data[0] = dcs_packet->packet_param[0];
/*
if(dcs_packet->packet_param[0] == 0x22) // 进入AOD模式
{
g_tp_sleep_in = true;
}
else
{
g_tp_sleep_in = false;
}
*/
TAU_LOGD("53:[%2x]", cmd_data[0]);
return true;
}
/* 客制化DCS command 处理函数表格 */ /* 客制化DCS command 处理函数表格 */
static const hal_dcs_execute_entry_t g_cus_rx_dcs_execute_table[] = static const hal_dcs_execute_entry_t g_cus_rx_dcs_execute_table[] =
{ {
@ -2112,6 +2138,7 @@ static const hal_dcs_execute_entry_t g_cus_rx_dcs_execute_table[] =
// {0xB1, ap_set_backlight, false}, // {0xB1, ap_set_backlight, false},
{0x51, ap_set_backlight_51, false}, //leo {0x51, ap_set_backlight_51, false}, //leo
{0x60, ap_update_frame_rate, true}, {0x60, ap_update_frame_rate, true},
// {0x53, ap_set_hbm_53, 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},
#if ADD_TP_CALIBRATION #if ADD_TP_CALIBRATION
@ -2123,6 +2150,7 @@ static const hal_dcs_execute_entry_t g_cus_rx_dcs_execute_table[] =
static void tx_panel_reset(void) static void tx_panel_reset(void)
{ {
delayMs(50);
hal_dsi_tx_ctrl_panel_reset_pin(IO_LVL_HIGH); hal_dsi_tx_ctrl_panel_reset_pin(IO_LVL_HIGH);
delayMs(10); //10ms delayMs(10); //10ms
hal_dsi_tx_ctrl_panel_reset_pin(IO_LVL_LOW); hal_dsi_tx_ctrl_panel_reset_pin(IO_LVL_LOW);
@ -2482,7 +2510,8 @@ const uint8_t panel_init_code[] = {
0x39,0,19,0xB6,0x00,0x00,0x02,0x8D,0x02,0xA1,0x02,0xB6,0x02,0xC8,0x02,0xE7,0x03,0x06,0x03,0x52,0x03,0xA6, 0x39,0,19,0xB6,0x00,0x00,0x02,0x8D,0x02,0xA1,0x02,0xB6,0x02,0xC8,0x02,0xE7,0x03,0x06,0x03,0x52,0x03,0xA6,
0x39,0,19,0xB7,0x03,0xF1,0x04,0x33,0x04,0x6F,0x04,0xA9,0x05,0x0C,0x05,0x65,0x05,0xB2,0x05,0xFD,0x06,0x3D, 0x39,0,19,0xB7,0x03,0xF1,0x04,0x33,0x04,0x6F,0x04,0xA9,0x05,0x0C,0x05,0x65,0x05,0xB2,0x05,0xFD,0x06,0x3D,
0x39,0,15,0xB8,0x06,0x7C,0x06,0xEE,0x07,0x55,0x07,0x87,0x07,0x9D,0x07,0xB4,0x07,0xB4, 0x39,0,15,0xB8,0x06,0x7C,0x06,0xEE,0x07,0x55,0x07,0x87,0x07,0x9D,0x07,0xB4,0x07,0xB4,
0x39,0,2,0xBF,0x33,
/* 0x39,0,2,0xBF,0x33,
0x39,0,19,0xB0,0x00,0x00,0x02,0xAE,0x02,0xBD,0x02,0xCD,0x02,0xDD,0x02,0xFD,0x03,0x1C,0x03,0x5A,0x03,0x91, 0x39,0,19,0xB0,0x00,0x00,0x02,0xAE,0x02,0xBD,0x02,0xCD,0x02,0xDD,0x02,0xFD,0x03,0x1C,0x03,0x5A,0x03,0x91,
0x39,0,19,0xB1,0x03,0xC5,0x03,0xFA,0x04,0x23,0x04,0x53,0x04,0xA5,0x04,0xEF,0x05,0x32,0x05,0x73,0x05,0xAD, 0x39,0,19,0xB1,0x03,0xC5,0x03,0xFA,0x04,0x23,0x04,0x53,0x04,0xA5,0x04,0xEF,0x05,0x32,0x05,0x73,0x05,0xAD,
0x39,0,15,0xB2,0x05,0xE5,0x06,0x4B,0x06,0xA8,0x06,0xD6,0x06,0xEC,0x06,0xFD,0x06,0xFD, 0x39,0,15,0xB2,0x05,0xE5,0x06,0x4B,0x06,0xA8,0x06,0xD6,0x06,0xEC,0x06,0xFD,0x06,0xFD,
@ -2553,6 +2582,8 @@ const uint8_t panel_init_code[] = {
0x39,0,19,0xB6,0x00,0x00,0x01,0x74,0x04,0x5B,0x04,0x88,0x04,0x96,0x04,0xB1,0x04,0xCC,0x04,0xFC,0x05,0x32, 0x39,0,19,0xB6,0x00,0x00,0x01,0x74,0x04,0x5B,0x04,0x88,0x04,0x96,0x04,0xB1,0x04,0xCC,0x04,0xFC,0x05,0x32,
0x39,0,19,0xB7,0x05,0x6D,0x05,0xAA,0x05,0xE1,0x06,0x17,0x06,0x7B,0x06,0xD5,0x07,0x22,0x07,0x6B,0x07,0xAF, 0x39,0,19,0xB7,0x05,0x6D,0x05,0xAA,0x05,0xE1,0x06,0x17,0x06,0x7B,0x06,0xD5,0x07,0x22,0x07,0x6B,0x07,0xAF,
0x39,0,15,0xB8,0x07,0xE9,0x08,0x57,0x08,0xB1,0x08,0xDE,0x08,0xF4,0x09,0x09,0x09,0x0B, 0x39,0,15,0xB8,0x07,0xE9,0x08,0x57,0x08,0xB1,0x08,0xDE,0x08,0xF4,0x09,0x09,0x09,0x0B,
*/
0x39,0,2,0xCE,0x01, 0x39,0,2,0xCE,0x01,
0x39,0,2,0xCC,0x00, 0x39,0,2,0xCC,0x00,
0x39,0,6,0xF0,0x55,0xAA,0x52,0x08,0x02, 0x39,0,6,0xF0,0x55,0xAA,0x52,0x08,0x02,
@ -4760,18 +4791,18 @@ static void init_panel(void)
// delayMs(20); // delayMs(20);
} }
static void frame_start_cb(hal_rx_dbg_event_e event) static void frame_start_cb(hal_rx_dbg_event_e event)
{ {
curFrame++; curFrame++;
if((isStart)&&(curFrame==4)) if((isStart)&&(curFrame==3))
{ {
hal_dsi_rx_ctrl_stop(g_rx_ctrl_handle); hal_dsi_rx_ctrl_restart(g_rx_ctrl_handle);
hal_dsi_rx_ctrl_init(g_rx_ctrl_handle); //TAU_LOGD("RX RST\n");
hal_dsi_rx_ctrl_start(g_rx_ctrl_handle);
TAU_LOGD("RX RST\n");
} }
// TAU_LOGD("%d\n",curFrame);
} }
static void open_mipi_rx(void) static void open_mipi_rx(void)
{ {
/* 配置TE引脚 */ /* 配置TE引脚 */
@ -4798,11 +4829,11 @@ static void open_mipi_rx(void)
g_rx_ctrl_handle->cus_dcs_entry_table = g_cus_rx_dcs_execute_table; /* 注册 DCS处理列表 */ g_rx_ctrl_handle->cus_dcs_entry_table = g_cus_rx_dcs_execute_table; /* 注册 DCS处理列表 */
g_rx_ctrl_handle->rx_dcs_read_entry = ap_dcs_read; /* 注册dsc read 回调函数,可选,此函数为空时由cus_dcs_entry_table执行 */ g_rx_ctrl_handle->rx_dcs_read_entry = ap_dcs_read; /* 注册dsc read 回调函数,可选,此函数为空时由cus_dcs_entry_table执行 */
g_rx_ctrl_handle->pps_update_entry = pps_update_handle; g_rx_ctrl_handle->pps_update_entry = pps_update_handle;
g_rx_ctrl_handle->pq_marginal = PQ_TYPE_5; //g_rx_ctrl_handle->pq_marginal = PQ_TYPE_2;
g_rx_ctrl_handle->hight_performan_mode = HIGHT_PERFORMAN_L2;
g_rx_ctrl_handle->pu_optimize = true;
#if defined(ISP_568) || defined(ISP_368) #if defined(ISP_568) || defined(ISP_368)
g_rx_ctrl_handle->base_info.extra_info.rot_angle = VIDOE_ROT_ANGLE_0; g_rx_ctrl_handle->base_info.extra_info.ltpo = LTPO_MODE_2; /// true
g_rx_ctrl_handle->base_info.extra_info.mirror_en = false;
g_rx_ctrl_handle->base_info.extra_info.ltpo = true;
g_rx_ctrl_handle->rx_debug_cb = frame_start_cb; g_rx_ctrl_handle->rx_debug_cb = frame_start_cb;
#endif #endif
@ -4869,7 +4900,7 @@ static void init_mipi_tx(void)
g_tx_ctrl_handle->base_info.src_mode = INPUT_DATA_MODE; g_tx_ctrl_handle->base_info.src_mode = INPUT_DATA_MODE;
g_tx_ctrl_handle->tx_line_delay = 100; g_tx_ctrl_handle->tx_line_delay = 100;
g_tx_ctrl_handle->tx_frame_rate = OUTPUT_FRAME_RATE; g_tx_ctrl_handle->tx_frame_rate = OUTPUT_FRAME_RATE;
g_rx_ctrl_handle->base_info.extra_info.ltpo = true; // g_rx_ctrl_handle->base_info.extra_info.ltpo = true;
hal_dsi_tx_ctrl_init(g_tx_ctrl_handle); hal_dsi_tx_ctrl_init(g_tx_ctrl_handle);
/* AP 没有发送数据时默认的显示颜色, 量产为0 0 0(黑色), 配置其他颜色仅为debug使用 */ /* AP 没有发送数据时默认的显示颜色, 量产为0 0 0(黑色), 配置其他颜色仅为debug使用 */
@ -4960,6 +4991,8 @@ 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);
tp_sleep_count++; tp_sleep_count++;
g_tp_sleep_delay_count++;
s_tp_delay_count++;
if(phone_DisplayOFF_count>0) if(phone_DisplayOFF_count>0)
{ {
phone_DisplayOFF_count++; phone_DisplayOFF_count++;
@ -5018,13 +5051,25 @@ void tp_heartbeat_exec(void)
TAU_LOGD("hb"); TAU_LOGD("hb");
s_heartbeat = 0; s_heartbeat = 0;
ap_tp_st_touch_software_reset(); ap_tp_st_touch_software_reset();
// ap_tp_st_touch_hardware_reset();
} }
} }
} }
} }
void tp_power_up_restart(void)
{
if(s_power_up_flag == true && s_tp_delay_count >= (100*6)) // 开机6秒后重启
{
s_power_up_flag = false;
ap_tp_st_touch_hardware_reset();
// TAU_LOGD("tp_hardware_reset");
}
}
void ap_demo(void) void ap_demo(void)
{ {
hal_gpio_init_output(IO_PAD_TD_SPIM_MISO, IO_LVL_LOW);
hal_gpio_init_output(IO_PAD_TD_LEDPWM, IO_LVL_LOW); hal_gpio_init_output(IO_PAD_TD_LEDPWM, IO_LVL_LOW);
hal_gpio_init_output(IO_PAD_AP_SWIRE, IO_LVL_LOW); hal_gpio_init_output(IO_PAD_AP_SWIRE, IO_LVL_LOW);
hal_gpio_init_output(IO_PAD_ADCIN, IO_LVL_LOW); hal_gpio_init_output(IO_PAD_ADCIN, IO_LVL_LOW);
@ -5114,13 +5159,14 @@ void ap_demo(void)
#if ADD_TP_CALIBRATION #if ADD_TP_CALIBRATION
app_tp_calibration_exec(); app_tp_calibration_exec();
#endif #endif
tp_power_up_restart();
tp_heartbeat_exec(); tp_heartbeat_exec();
ap_tp_st_touch_scan_point_record_event_exec(); ap_tp_st_touch_scan_point_record_event_exec();
// ap_tp_scan_point_record_event_exec(); // ap_tp_scan_point_record_event_exec();
#ifndef DISABLE_TDDI_I2C_FUNCTION #ifndef DISABLE_TDDI_I2C_FUNCTION
/* 等待屏 TP 中断上报做TP 协议转换 */ /* 等待屏 TP 中断上报做TP 协议转换 */
if(s_power_up_flag == false)
app_tp_transfer_screen_int(); app_tp_transfer_screen_int();
#endif #endif
@ -5131,7 +5177,7 @@ void ap_demo(void)
#if ENABLE_TP_WAKE_UP #if ENABLE_TP_WAKE_UP
if (g_need_enter_sleep_mode) if (g_need_enter_sleep_mode)
{ {
hal_gpio_init_output(IO_PAD_TD_LEDPWM, IO_LVL_HIGH); hal_gpio_init_output(IO_PAD_TD_SPIM_MISO, IO_LVL_HIGH);
/* FIXME stop more model */ /* FIXME stop more model */
// g_swire_enable = false; // g_swire_enable = false;
hal_dsi_tx_ctrl_stop(g_tx_ctrl_handle); hal_dsi_tx_ctrl_stop(g_tx_ctrl_handle);

View File

@ -23,6 +23,51 @@
#include "tau_log.h" #include "tau_log.h"
#include "app_tp_st_touch.h" #include "app_tp_st_touch.h"
/////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////息屏单击、双击处理///////////////////////////////////////
#define Touch_Single_AOD 1 // 息屏后单点触摸唤醒 AOD 显示
#define Touch_Double_PowerUp 2 // 息屏后双击唤醒屏幕进入界面
#define Touch_Single_AOD_Time 20 // 息屏后单点持续时间 小于20*10 = 200ms
#define Touch_Double_PowerUp_Time 50 // 息屏后双击唤醒:两个点释放相差时间不超过 50*10 = 500ms
typedef struct
{
uint16_t X_in; // 坐标
uint16_t Y_in; // 坐标
uint16_t X1_in; // 坐标
uint16_t Y1_in; // 坐标
uint8_t Event; // 0无触 1按下 2移动 3松开
uint16_t Event_Time; // 事件保持时间
uint8_t Touch_ON; // 0无触 1按下 2移动 3松开
} Touch_Single_Point_str;
Touch_Single_Point_str Touch;
Touch_Single_Point_str Touch = //初始化值
{
.X_in = 0,
.Y_in = 0,
.X1_in = 0,
.Y1_in = 0,
.Event = 0,
.Event_Time = 0,
.Touch_ON = 0,
};
uint8_t g_tp_sleep_delay_count = 0;
uint8_t g_tp_wakeup_response = false;
uint8_t s_tp_wakeup = false;
uint8_t phone_reg_coord_back_X61[16] = {0x09, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; //坐标 数据反馈对应的数据buffer
/////////////////////////////////////////////////////////////////////////////////////////////
#define ST_TP_CALIBRATION_SUCCESS 0x5A // У׼³É¹¦±êÖ¾ #define ST_TP_CALIBRATION_SUCCESS 0x5A // У׼³É¹¦±êÖ¾
static volatile bool s_calibration_flag = false; static volatile bool s_calibration_flag = false;
@ -378,7 +423,7 @@ 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();
@ -412,8 +457,8 @@ 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);
@ -563,6 +608,164 @@ void ap_tp_st_touch_error_handler_FF(uint8_t* screendata)
} }
} }
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
/**************************************************************************
* @name : app_tp_screen_analysis_wake_up
* @brief : screen
* @param[in] :
* @return : 0123
* @retval :
**************************************************************************/
uint8_t app_tp_screen_analysis_wake_up(uint8_t *rxbuffer, uint8_t touch_number)
{
uint16_t x = 0,y = 0;
uint8_t touch_event = 0;
uint8_t result = 0; // 0表示触摸类事件1表示状态事件2表示手势事件3表示空事件
if(touch_number == 8) // 单点触摸
{
touch_event = rxbuffer[0] >> 4;//触摸事件
if(touch_event == 0x01) // 按下事件 单击事件
{
Touch.Event++;
if(Touch.Event == 1) // 第一点按压事件
g_tp_sleep_delay_count = 0;
}
if(touch_event == 0x03) // 释放事件 单击事件
{
Touch.X_in = (((uint16_t)rxbuffer[3] & 0x0F) << 8) | (rxbuffer[2]);
Touch.Y_in = ((uint16_t)rxbuffer[4] << 4) | ((rxbuffer[3] & 0xF0) >> 4);
if(Touch.Event == 1)
{
if(g_tp_sleep_delay_count < Touch_Single_AOD_Time) // 20*10 = 200ms单击事件
{
s_tp_wakeup = Touch_Single_AOD;
}
}
else
{
if(g_tp_sleep_delay_count < Touch_Double_PowerUp_Time) // 50*10 = 500ms 内双击事件
{
x = abs(Touch.X_in-Touch.X1_in);
y = abs(Touch.Y_in-Touch.Y1_in);
if(x<100 && y<100) // 双击 x y的范围小于100个像素点
{
s_tp_wakeup = Touch_Double_PowerUp;
Touch.Event = 0;
Touch.X_in = 0;
Touch.Y_in = 0;
}
}
}
// 保存x y数值
Touch.X1_in = Touch.X_in;
Touch.Y1_in = Touch.Y_in;
g_tp_sleep_delay_count = 0;
}
}
else
{
g_tp_sleep_delay_count = 0;
Touch.X_in = 0;
Touch.Y_in = 0;
Touch.Event = 0;
Touch.X1_in = Touch.X_in;
Touch.Y1_in = Touch.Y_in;
Touch.Touch_ON = 0;
}
// return result;
}
void app_tp_screen_analysis_wake_up_exec(void)
{
if(s_tp_wakeup == Touch_Double_PowerUp)
{
TAU_LOGD("TP Double\n");
s_tp_wakeup = false;
Touch.Event = 0;
/* phone_reg_coord_back_X61[0] = 0x46; //44 press C4 leave 84 move
phone_reg_coord_back_X61[1] = 0x01;
phone_reg_coord_back_X61[2] = 0x2D; //x 高八位
phone_reg_coord_back_X61[3] = 0x34; //y 高八位
phone_reg_coord_back_X61[4] = 0xD8; //bit0-bit3:y低四位;bit4-bit7:x低四位;
phone_reg_coord_back_X61[5] = 0; //minor
//touch type0:普通手指触摸1:盘旋2:保护套3:手套;4:尖笔;5:手掌;6:潮湿的;7:接近;8:轻摇
// phone_reg_coord_back_X61[((s1) * 8) + 6] = ((Touch.Touch_Single_Point[ss].Z & 0xFE) >> 2); //bit0-bit5:z只有6位;bit6-bit7:touch type的高两位
// phone_reg_coord_back_X61[((s1) * 8) + 7] = --Touch_num; //bit0-bit5:buffer里面剩余多少个事件;bit6-bit7touch type 低两位
phone_reg_coord_back_X61[6] = 0;
phone_reg_coord_back_X61[7] = 0;
phone_reg_coord_back_X61[8] = 0;
phone_reg_coord_back_X61[9] = 0;
phone_reg_coord_back_X61[10] = 0;
phone_reg_coord_back_X61[11] = 0;
phone_reg_coord_back_X61[12] = 0;
phone_reg_coord_back_X61[13] = 0;
phone_reg_coord_back_X61[14] = 0;
phone_reg_coord_back_X61[15] = 0;
hal_gpio_set_output_data(g_phone_output_int_pad, IO_LVL_LOW); //拉低TP中断脚,通知AP读取TP数据
Touch.Touch_ON = 1;
g_tp_wakeup_response = true;
*/
}
else if(s_tp_wakeup == Touch_Single_AOD && g_tp_sleep_delay_count > (Touch_Double_PowerUp_Time+10)) // 单击事件后无触摸报点
{
TAU_LOGD("TP Single\n");
s_tp_wakeup = false;
Touch.Event = 0;
phone_reg_coord_back_X61[0] = 0x52; //44 press C4 leave 84 move
phone_reg_coord_back_X61[1] = 0x00;
phone_reg_coord_back_X61[2] = 0x22; //x 高八位
phone_reg_coord_back_X61[3] = 0x45; //y 高八位
phone_reg_coord_back_X61[4] = 0xBB; //bit0-bit3:y低四位;bit4-bit7:x低四位;
phone_reg_coord_back_X61[5] = 0; //minor
//touch type0:普通手指触摸1:盘旋2:保护套3:手套;4:尖笔;5:手掌;6:潮湿的;7:接近;8:轻摇
// phone_reg_coord_back_X61[((s1) * 8) + 6] = ((Touch.Touch_Single_Point[ss].Z & 0xFE) >> 2); //bit0-bit5:z只有6位;bit6-bit7:touch type的高两位
// phone_reg_coord_back_X61[((s1) * 8) + 7] = --Touch_num; //bit0-bit5:buffer里面剩余多少个事件;bit6-bit7touch type 低两位
phone_reg_coord_back_X61[6] = 0;
phone_reg_coord_back_X61[7] = 0;
phone_reg_coord_back_X61[8] = 0;
phone_reg_coord_back_X61[9] = 0;
phone_reg_coord_back_X61[10] = 0;
phone_reg_coord_back_X61[11] = 0;
phone_reg_coord_back_X61[12] = 0;
phone_reg_coord_back_X61[13] = 0;
phone_reg_coord_back_X61[14] = 0;
phone_reg_coord_back_X61[15] = 0;
hal_gpio_set_output_data(g_phone_output_int_pad, IO_LVL_LOW); //拉低TP中断脚,通知AP读取TP数据
Touch.Touch_ON = 1;
g_tp_wakeup_response = true;
}
}
void app_tp_phone_analysis_data_for_wake_up(uint8_t *rxbuffer, size_t rxbuffer_size, const uint8_t **txbuffer, size_t *txbuffer_size)
{
*txbuffer_size = 0;
switch (rxbuffer[0])
{
case 0x60:
{
hal_gpio_set_output_data(g_phone_output_int_pad, IO_LVL_HIGH);
if (Touch.Touch_ON == 1)
{
Touch.Touch_ON = 0;
g_tp_wakeup_response = false;
*txbuffer = phone_reg_coord_back_X61;
*txbuffer_size = sizeof(phone_reg_coord_back_X61);
// TAU_LOGD("TD OK\n");
}
}
}
}

View File

@ -16,6 +16,12 @@
#include "tau_common.h" #include "tau_common.h"
#include "hal_dsi_rx_ctrl.h" #include "hal_dsi_rx_ctrl.h"
extern uint8_t tp_sleep_in;
extern uint8_t tp_sleep_count;
extern uint8_t g_tp_sleep_delay_count;
extern uint8_t g_tp_wakeup_response;
typedef enum typedef enum
{ {
CMD_TP_CABLIBRATION = 0x2A, CMD_TP_CABLIBRATION = 0x2A,
@ -166,5 +172,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);
void app_tp_phone_analysis_data_for_wake_up(uint8_t *rxbuffer, size_t rxbuffer_size, const uint8_t **txbuffer, size_t *txbuffer_size);
void app_tp_screen_analysis_wake_up_exec(void);
uint8_t app_tp_screen_analysis_wake_up(uint8_t *rxbuffer, uint8_t touch_number);
#endif #endif

View File

@ -859,7 +859,7 @@ void app_tp_transfer_screen_int(void)
return; return;
} }
app_tp_screen_analysis_wake_up_exec();
/**** 1. 判断 screen 是否发出中断信号 ****/ /**** 1. 判断 screen 是否发出中断信号 ****/
// s_screen_int_flag: 中断信号标志位 // s_screen_int_flag: 中断信号标志位
// app_tp_screen_int_lvl_low : SPI 长时间通信时偶尔会出现cs拉高导致通信异常卡死该标志位用于解决卡死的问题 // app_tp_screen_int_lvl_low : SPI 长时间通信时偶尔会出现cs拉高导致通信异常卡死该标志位用于解决卡死的问题
@ -890,6 +890,13 @@ void app_tp_transfer_screen_int(void)
ap_tp_st_touch_error_handler_F3(s_screen_read_buffer); ap_tp_st_touch_error_handler_F3(s_screen_read_buffer);
ap_tp_st_touch_error_handler_FF(s_screen_read_buffer); ap_tp_st_touch_error_handler_FF(s_screen_read_buffer);
ap_tp_st_touch_scan_point_record_event(s_screen_read_buffer,len+8); ap_tp_st_touch_scan_point_record_event(s_screen_read_buffer,len+8);
if(tp_sleep_in)
{
// 息屏触摸处理
app_tp_screen_analysis_wake_up(s_screen_read_buffer,len+8);
}
/* // TP 异常事件 /* // TP 异常事件
if(s_screen_read_buffer[0] == 0xF3) // 收到 TP 异常回复 0xF3 0x02 0x00 0x00 0x00 0x00 0x00 0x00 if(s_screen_read_buffer[0] == 0xF3) // 收到 TP 异常回复 0xF3 0x02 0x00 0x00 0x00 0x00 0x00 0x00
{ {
@ -932,8 +939,8 @@ void app_tp_transfer_screen_int(void)
{ {
// ap_tp_system_softReset(); // ap_tp_system_softReset();
// app_tp_screen_reset(); // app_tp_screen_reset();
delayMs(10); //delayMs(10);
TAU_LOGD("TP system reset 1\n"); //TAU_LOGD("TP system reset 1\n");
return; return;
} }
} }
@ -978,6 +985,11 @@ static void app_tp_transfer_phone(size_t recieve_num)
s_phone_read_buffer[3]=recieve_num; s_phone_read_buffer[3]=recieve_num;
app_tp_m_write(s_phone_read_buffer, 4); app_tp_m_write(s_phone_read_buffer, 4);
#endif #endif
if(g_tp_wakeup_response)
{
app_tp_phone_analysis_data_for_wake_up(s_phone_read_buffer, recieve_num, &phone_write_buffer, &phone_write_buffer_size);
}
else
app_tp_phone_analysis_data(s_phone_read_buffer, recieve_num, &phone_write_buffer, &phone_write_buffer_size); app_tp_phone_analysis_data(s_phone_read_buffer, recieve_num, &phone_write_buffer, &phone_write_buffer_size);
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (C) 2019-2022, ISP Systems (R),All Rights Reserved. * Copyright (C) 2019-2022, CVA Systems (R),All Rights Reserved.
* *
* File: board.c * File: board.c
* Description * Description

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (C) 2019-2022, 518/568 Systems (R),All Rights Reserved. * Copyright (C) 2019-2022, CVA Systems (R),All Rights Reserved.
* *
* File: board.h * File: board.h
* Description: baord * Description: baord

View File

@ -2,7 +2,7 @@
* *
* *
* File: tau_common.h * File: tau_common.h
* Description * Description
* Version V0.1 * Version V0.1
* Date 2020-09-07 * Date 2020-09-07
* Author lzy * Author lzy
@ -21,7 +21,7 @@
* 2.Global constant and macro definitions using #define * 2.Global constant and macro definitions using #define
*******************************************************************************/ *******************************************************************************/
/** /**
* \name * \name
* @{ * @{
*/ */
//#define ENABLE 1 //#define ENABLE 1
@ -53,15 +53,15 @@
#define NULL ((void *)0) #define NULL ((void *)0)
#endif #endif
#define TAU_LITTLE_ENDIAN 1234 /**< \brief 小端模式 */ #define TAU_LITTLE_ENDIAN 1234 /**< \brief 小端模式 */
#define TAU_BIG_ENDIAN 3412 /**< \brief 大端模式 */ #define TAU_BIG_ENDIAN 3412 /**< \brief 大端模式 */
/** @} */ /** @} */
/******************************************************************************/ /******************************************************************************/
/** /**
* \name * \name
* @{ * @{
*/ */
@ -83,11 +83,11 @@
#define MAX(x, y) (((x) > (y)) ? (x) : (y)) #define MAX(x, y) (((x) > (y)) ? (x) : (y))
/** /**
* \brief * \brief
* \attention * \attention
* *
* *
* \par * \par
* \code * \code
* struct my_struct { * struct my_struct {
* int m1; * int m1;
@ -103,13 +103,13 @@
/** @} */ /** @} */
/** /**
* \brief * \brief
* *
* \param ptr * \param ptr
* \param type * \param type
* \param member * \param member
* *
* \par * \par
* \code * \code
* struct my_struct = { * struct my_struct = {
* int m1; * int m1;
@ -124,7 +124,7 @@
((type *)((char *)(ptr)-TAU_OFFSET(type, member))) ((type *)((char *)(ptr)-TAU_OFFSET(type, member)))
/** /**
* \brief * \brief
* *
* \code * \code
* struct a = { * struct a = {
@ -139,7 +139,7 @@
#define TAU_MEMBER_SIZE(structure, member) (sizeof(((structure *)0)->member)) #define TAU_MEMBER_SIZE(structure, member) (sizeof(((structure *)0)->member))
/** /**
* \brief * \brief
* *
* \code * \code
* int a[] = {0, 1, 2, 3}; * int a[] = {0, 1, 2, 3};
@ -149,10 +149,10 @@
#define TAU_NELEMENTS(array) (sizeof(array) / sizeof((array)[0])) #define TAU_NELEMENTS(array) (sizeof(array) / sizeof((array)[0]))
/** /**
* \brief * \brief
* *
* \param x * \param x
* \param align * \param align
* *
* \code * \code
* int size = TAU_ROUND_UP(15, 4); // size = 16 * int size = TAU_ROUND_UP(15, 4); // size = 16
@ -161,10 +161,10 @@
#define TAU_ROUND_UP(x, align) (((int)(x)/(align))*(align) + (((int)(x)%(align)) ? (align) : 0)) #define TAU_ROUND_UP(x, align) (((int)(x)/(align))*(align) + (((int)(x)%(align)) ? (align) : 0))
/** /**
* \brief * \brief
* *
* \param x * \param x
* \param align * \param align
* *
* \code * \code
* int size = TAU_ROUND_DOWN(15, 4); // size = 12 * int size = TAU_ROUND_DOWN(15, 4); // size = 12
@ -172,33 +172,33 @@
*/ */
#define TAU_ROUND_DOWN(x, align) (((int)(x)/(align))*(align)) #define TAU_ROUND_DOWN(x, align) (((int)(x)/(align))*(align))
/** \brief 倍数向上舍入 */ /** \brief 倍数向上舍入 */
#define TAU_DIV_ROUND_UP(n, d) (((n) + (d)-1) / (d)) #define TAU_DIV_ROUND_UP(n, d) (((n) + (d)-1) / (d))
/** /**
* \brief * \brief
* *
* \param x * \param x
* \param align 2 * \param align 2
* *
* \code * \code
* if (TAU_ALIGNED(x, 4) { * if (TAU_ALIGNED(x, 4) {
* ; // x对齐 * ; // x对齐
* } else { * } else {
* ; // x不对齐 * ; // x不对齐
* } * }
* \endcode * \endcode
*/ */
#define TAU_ALIGNED(x, align) (((int)(x) & (align - 1)) == 0) #define TAU_ALIGNED(x, align) (((int)(x) & (align - 1)) == 0)
/** \brief 将1字节BCD数据转换为16进制数据 */ /** \brief 将1字节BCD数据转换为16进制数据 */
#define TAU_BCD_TO_HEX(val) (((val)&0x0f) + ((val) >> 4) * 10) #define TAU_BCD_TO_HEX(val) (((val)&0x0f) + ((val) >> 4) * 10)
/** \brief 将1字节16进制数据转换为BCD数据 */ /** \brief 将1字节16进制数据转换为BCD数据 */
#define TAU_HEX_TO_BCD(val) ((((val) / 10) << 4) + (val) % 10) #define TAU_HEX_TO_BCD(val) ((((val) / 10) << 4) + (val) % 10)
/** /**
* \brief * \brief
*/ */
#define TAU_CEIL(val) ceil(val) #define TAU_CEIL(val) ceil(val)
@ -210,7 +210,7 @@
/******************************************************************************* /*******************************************************************************
* 3.Global structures, unions and enumerations using typedef * 3.Global structures, unions and enumerations using typedef
*******************************************************************************/ *******************************************************************************/
/* \brief 通用回调函数指针定义 */ /* \brief 通用回调函数指针定义 */
typedef void (*fcb_type)(void *data); typedef void (*fcb_type)(void *data);
#endif /* __TAU_COMMON_H */ #endif /* __TAU_COMMON_H */

View File

@ -18,15 +18,15 @@
#include "stdint.h" #include "stdint.h"
/** /**
* @brief delay ms ,2% * @brief delay ms ,2%
* @param ms:delay时长 * @param ms:delay时长
* @retval none * @retval none
*/ */
void delayMs(uint32_t ms); void delayMs(uint32_t ms);
/** /**
* @brief delay us ,2% * @brief delay us ,2%
* @param us:delay时长 * @param us:delay时长
* @retval none * @retval none
*/ */
void delayUs(uint32_t us); void delayUs(uint32_t us);

View File

@ -26,13 +26,13 @@
/******************************************************************************* /*******************************************************************************
* 3.Global structures, unions and enumerations using typedef * 3.Global structures, unions and enumerations using typedef
*******************************************************************************/ *******************************************************************************/
/*! @brief 计算组状态码 */ /*! @brief 计算组状态码 */
#define MAKE_STATUS(group, code) ((((group)*100) + (code))) #define MAKE_STATUS(group, code) ((((group)*100) + (code)))
/******************************************************************************* /*******************************************************************************
* 3.Global structures, unions and enumerations using typedef * 3.Global structures, unions and enumerations using typedef
*******************************************************************************/ *******************************************************************************/
/*! @brief 分组状态值 */ /*! @brief 分组状态值 */
enum _status_groups enum _status_groups
{ {
STATUS_GROUP_GENERIC = 0, STATUS_GROUP_GENERIC = 0,
@ -42,7 +42,7 @@ enum _status_groups
kStatusGroup_Timer = 4, kStatusGroup_Timer = 4,
}; };
/*! @brief 常用状态码 */ /*! @brief 常用状态码 */
enum _generic_status enum _generic_status
{ {
STATUS_SUCCESS = MAKE_STATUS(STATUS_GROUP_GENERIC, 0), STATUS_SUCCESS = MAKE_STATUS(STATUS_GROUP_GENERIC, 0),
@ -55,17 +55,17 @@ enum _generic_status
}; };
/*! /*!
* @brief timer状态 * @brief timer状态
*/ */
typedef enum typedef enum
{ {
TIMER_STATUS_IDLE = MAKE_STATUS(kStatusGroup_Timer, 0), /*!< 空闲 */ TIMER_STATUS_IDLE = MAKE_STATUS(kStatusGroup_Timer, 0), /*!< 空闲 */
TIMER_STATUS_RUNNING = MAKE_STATUS(kStatusGroup_Timer, 1), /*!< 运行中 */ TIMER_STATUS_RUNNING = MAKE_STATUS(kStatusGroup_Timer, 1), /*!< 运行中 */
TIMER_STATUS_TIMEOUT = MAKE_STATUS(kStatusGroup_Timer, 2), /*!< 超时 */ TIMER_STATUS_TIMEOUT = MAKE_STATUS(kStatusGroup_Timer, 2), /*!< 超时 */
} timer_status_e; } timer_status_e;
/*! /*!
* @brief system触发事件(/) * @brief system触发事件(/)
*/ */
typedef enum typedef enum
{ {
@ -103,7 +103,7 @@ typedef enum
GPIO_INT_MAX GPIO_INT_MAX
} gpio_int_e; } gpio_int_e;
/*! @brief PWMI中断类型 */ /*! @brief PWMI中断类型 */
typedef enum _pwm_int_type typedef enum _pwm_int_type
{ {
PWM_INT_HIGH_OVERFLOW = 0, PWM_INT_HIGH_OVERFLOW = 0,
@ -120,12 +120,12 @@ typedef enum _pwm_int_type
*/ */
typedef enum typedef enum
{ {
I2C_SELECT_0 = 0, //常用slave I2C_SELECT_0 = 0, //常用slave
I2C_SELECT_1, //常用master I2C_SELECT_1, //常用master
} i2c_select_e; } i2c_select_e;
/*! /*!
* @brief * @brief
* @note * @note
*/ */
typedef enum _i2c_rate typedef enum _i2c_rate
@ -154,7 +154,7 @@ typedef enum
DISABLE = 0, DISABLE = 0,
ENABLE = !DISABLE ENABLE = !DISABLE
} function_state_e; } function_state_e;
/*!< @brief 用于返回状态和错误 */ /*!< @brief 用于返回状态和错误 */
typedef int32_t status_t; typedef int32_t status_t;

View File

@ -2,7 +2,7 @@
* *
* *
* File: tau_dsi_datatype.h * File: tau_dsi_datatype.h
* Description: mipi dsi * Description: mipi dsi
* Version: V0.1 * Version: V0.1
* Date: 2021-01-13 * Date: 2021-01-13
* Author: lzy * Author: lzy
@ -220,6 +220,8 @@ typedef enum
TX_VPG_V_COLOR = 0, TX_VPG_V_COLOR = 0,
TX_VPG_H_COLOR = 1, TX_VPG_H_COLOR = 1,
TX_VPG_V_BER = 2, TX_VPG_V_BER = 2,
TX_VPG_FLICKER = 3,
TX_VPG_CHESSBOARD = 4,
TX_VPG_MAX TX_VPG_MAX
} dsi_tx_vpg_style_e; } dsi_tx_vpg_style_e;
@ -229,10 +231,10 @@ typedef enum
*/ */
typedef enum typedef enum
{ {
VIDOE_ROT_ANGLE_0 = 0, /* 不旋转 */ VIDOE_ROT_ANGLE_0 = 0, /* 不旋转 */
VIDOE_ROT_ANGLE_90 = 1, /* 旋转90度 */ VIDOE_ROT_ANGLE_90 = 1, /* 旋转90度 */
VIDOE_ROT_ANGLE_180 = 2, /* 旋转180度 */ VIDOE_ROT_ANGLE_180 = 2, /* 旋转180度 */
VIDOE_ROT_ANGLE_270 = 3, /* 转转270度 */ VIDOE_ROT_ANGLE_270 = 3, /* 转转270度 */
VIDOE_ROT_ANGLE_MAX VIDOE_ROT_ANGLE_MAX
} video_rotate_angle_e; } video_rotate_angle_e;
@ -248,14 +250,25 @@ typedef enum
} dsi_rx_lane_swap_e; } dsi_rx_lane_swap_e;
/** /**
* @brief transform * @brief LTPO mode
*/
typedef enum
{
LTPO_MODE_NONE = 0,
LTPO_MODE_1 = 1,
LTPO_MODE_2 = 2,
LTPO_MODE_MAX
} ltpo_mode_e;
/**
* @brief transform
*/ */
typedef struct typedef struct
{ {
bool ltpo; /* ltpo 标志位 */ ltpo_mode_e ltpo; /* ltpo 模式 */
bool mirror_en; /* 对video 做水平镜像标志位 */ bool mirror_en; /* 对video 做水平镜像标志位 */
video_rotate_angle_e rot_angle; /* 对video 做旋转的角度 */ video_rotate_angle_e rot_angle; /* 对video 做旋转的角度 */
dsi_video_data_mode_e dst_mode; /* mipi tx 输出video 数据传输模式(video/cmd mode) */ dsi_video_data_mode_e dst_mode; /* mipi tx 输出video 数据传输模式(video/cmd mode) */
dsi_rx_lane_swap_e rx_lane_swap; /* rx lane swap */ dsi_rx_lane_swap_e rx_lane_swap; /* rx lane swap */
} dsi_base_extra_info_t; } dsi_base_extra_info_t;
#endif #endif
@ -263,7 +276,7 @@ typedef struct
/** /**
* @brief mipi P/N lane swap flag * @brief mipi P/N lane swap flag
* eg: pn_swap = RX_LANE_0_PN_SWAP | RX_LANE_CLK_PN_SWAP; * eg: pn_swap = RX_LANE_0_PN_SWAP | RX_LANE_CLK_PN_SWAP;
* lane0 CLK P跟N交换lane不变 * lane0 CLK P跟N交换lane不变
*/ */
typedef enum typedef enum
{ {
@ -283,28 +296,29 @@ 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;
/** /**
* @brief transform * @brief transform
*/ */
typedef struct typedef struct
{ {
uint32_t src_w; /* mipi rx 接收的 width */ uint32_t src_w; /* mipi rx 接收的 width */
uint32_t src_h; /* mipi rx 接收的 height */ uint32_t src_h; /* mipi rx 接收的 height */
uint32_t dst_w; /* mipi tx 发送的 width */ uint32_t dst_w; /* mipi tx 发送的 width */
uint32_t dst_h; /* mipi tx 发送的 height */ uint32_t dst_h; /* mipi tx 发送的 height */
dsi_video_frame_rate_e src_frate; /* mipi rx 接收的frame rate */ dsi_video_frame_rate_e src_frate; /* mipi rx 接收的frame rate */
dsi_video_data_mode_e src_mode; /* mipi rx 接收video 数据传输模式(video/cmd mode) */ dsi_video_data_mode_e src_mode; /* mipi rx 接收video 数据传输模式(video/cmd mode) */
uint16_t pn_swap; /* mipi rx P/N swap标志位 */ uint16_t pn_swap; /* mipi rx P/N swap标志位 */
#if defined(ISP_568) || defined(ISP_368) #if defined(ISP_568) || defined(ISP_368)
dsi_base_extra_info_t extra_info; /* ISP_568/ISP_368 新增功能配置 */ dsi_base_extra_info_t extra_info; /* ISP_568/ISP_368 新增功能配置 */
#endif #endif
} dsi_base_trans_info_t; } dsi_base_trans_info_t;
/** /**
* @brief ccm系数 * @brief ccm系数
*/ */
typedef struct typedef struct
{ {
@ -335,14 +349,27 @@ typedef struct
} vid_disp_timing_t; } vid_disp_timing_t;
/** /**
* @brief dpi极性配置 * @brief dpi极性配置
*/ */
typedef struct typedef struct
{ {
dpi_polarity_e vsync_active_level; //vsync极性 dpi_polarity_e vsync_active_level; //vsync极性
dpi_polarity_e hsync_active_level; //hsync极性 dpi_polarity_e hsync_active_level; //hsync极性
dpi_polarity_e dataen_active_level; //dataen极性 dpi_polarity_e dataen_active_level; //dataen极性
dpi_polarity_e shutdown_active_level; //shutdown极性 dpi_polarity_e shutdown_active_level; //shutdown极性
dpi_polarity_e colorm_active_level; //colorm极性 dpi_polarity_e colorm_active_level; //colorm极性
} dpi_polarity_t; } dpi_polarity_t;
/**
* @brief hight performan mode level
*/
typedef enum
{
HIGHT_PERFORMAN_NONE = 0,
HIGHT_PERFORMAN_L1 = 1,
HIGHT_PERFORMAN_L2 = 2,
HIGHT_PERFORMAN_MAX
} hight_performan_mode_e;
#endif //__MIPI_DSI_COMMON_H__ #endif //__MIPI_DSI_COMMON_H__

View File

@ -18,7 +18,9 @@
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include "ArmCM0.h" #include "ArmCM0.h"
#if LOG_MODE_RTT
#include "SEGGER_RTT.h"
#endif
/******************************************************************************* /*******************************************************************************
* 2.Global constant and macro definitions using #define * 2.Global constant and macro definitions using #define
*******************************************************************************/ *******************************************************************************/
@ -27,7 +29,7 @@
#undef LOG_TAG #undef LOG_TAG
#endif #endif
#define LOG_TAG "tau_log" #define LOG_TAG "tau_log"
#define LOG_CURREN_LEVEL kLOG_LEVEL_DBG /* 配置打印等级 TODO:每个模块可配置打印等级 */ #define LOG_CURREN_LEVEL kLOG_LEVEL_DBG /* 配置打印等级 TODO:每个模块可配置打印等级 */
/* /*
* Using the following three macros for conveniently logging. * Using the following three macros for conveniently logging.
@ -37,6 +39,29 @@
#define TAU_LOGI(format,...) #define TAU_LOGI(format,...)
#define TAU_LOGE(format,...) #define TAU_LOGE(format,...)
#else #else
#if LOG_MODE_RTT
#define TAU_LOGD(format,...) \
do { \
if (LOG_CURREN_LEVEL <= kLOG_LEVEL_DBG) { \
SEGGER_RTT_printf(0,"[%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
}; \
} while (0)
#define TAU_LOGI(format,...) \
do { \
if (LOG_CURREN_LEVEL <= kLOG_LEVEL_INF) { \
SEGGER_RTT_printf(0,"[%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
}; \
} while (0)
#define TAU_LOGE(format,...) \
do { \
if (LOG_CURREN_LEVEL <= kLOG_LEVEL_ERR) { \
SEGGER_RTT_printf(0,"error [%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
}; \
} while (0)
#else
#define TAU_LOGD(format,...) \ #define TAU_LOGD(format,...) \
do { \ do { \
if (LOG_CURREN_LEVEL <= kLOG_LEVEL_DBG) { \ if (LOG_CURREN_LEVEL <= kLOG_LEVEL_DBG) { \
@ -59,7 +84,7 @@
}; \ }; \
} while (0) } while (0)
#endif #endif
#endif
/******************************************************************************* /*******************************************************************************
* 3.Global structures, unions and enumerations using typedef * 3.Global structures, unions and enumerations using typedef
*******************************************************************************/ *******************************************************************************/
@ -68,7 +93,7 @@ typedef enum
kLOG_LEVEL_DBG = 0, kLOG_LEVEL_DBG = 0,
kLOG_LEVEL_INF, kLOG_LEVEL_INF,
kLOG_LEVEL_ERR, kLOG_LEVEL_ERR,
kLOG_LEVEL_NONE /* 不打印任何参数 */ kLOG_LEVEL_NONE /* 不打印任何参数 */
} log_level_t; } log_level_t;
/******************************************************************************* /*******************************************************************************

View File

@ -125,6 +125,8 @@ typedef enum IRQn
#define EXTERN_24M 0 #define EXTERN_24M 0
#define CPU_CLK_100M 0 #define CPU_CLK_100M 0
#define LOG_MODE_RTT 0 /* 0:UART MODE 1: rtt MODE */
#include "core_cm0.h" /* Processor and core peripherals */ #include "core_cm0.h" /* Processor and core peripherals */
#include "system_ARMCM0.h" /* System Header */ #include "system_ARMCM0.h" /* System Header */

View File

@ -69,10 +69,17 @@ 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使用 */
#if defined(ISP_568) || defined(ISP_368)
uint8_t rx_strength; /* 用于调节RX信号强度仅适用于开启内阻校准模式档位0~7默认3 */
hight_performan_mode_e hight_performan_mode; /* 高性能模式等级,参考hight_performan_mode_e */
bool pu_optimize; /* 用于优化PU显示效果默认为false;true:优化PU显示显示效果,高功耗;false:普通PU模式,低功耗 */
#endif
bool video_auto_sync; /* Video mode 自动同步开关 */
uint8_t rx_debug_status; /* rx debug status用于debug表示rx的状态 */
} hal_dsi_rx_ctrl_handle_t; } hal_dsi_rx_ctrl_handle_t;
/** /**
@ -456,6 +463,23 @@ bool hal_dsi_rx_ctrl_toggle_input_frame_rate(hal_dsi_rx_ctrl_handle_t *rx_ctrl_h
*/ */
bool hal_dsi_rx_ctrl_set_tear_mode_ex(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t line_num, te_mode_e te_mode); bool hal_dsi_rx_ctrl_set_tear_mode_ex(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t line_num, te_mode_e te_mode);
/**
* @brief
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_toggle_resolution_ex(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/*
* @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_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)
/* ISP_518/ISP_308 接口 */ /* ISP_518/ISP_308 接口 */
/** /**
@ -528,6 +552,18 @@ bool hal_dsi_rx_ctrl_set_tear_mode_ex(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle,
* @retval none * @retval none
*/ */
void hal_dsi_rx_ctrl_set_pixel_data(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, int x, int y, uint8_t red_data, uint8_t green_data, uint8_t blue_data); void hal_dsi_rx_ctrl_set_pixel_data(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, int x, int y, uint8_t red_data, uint8_t green_data, uint8_t blue_data);
/*
* @brief
* @param rx_ctrl_handle: dsi rx handle
* @param x1,y1:
* @param x2,y2:
* @param red_data: R分量
* @param green_data: G分量
* @param blue_data: B分量
* @retval none
*/
void hal_dsi_rx_ctrl_set_rect_pixel_data(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, int x1, int x2, int y1, int y2, uint8_t red_data, uint8_t green_data, uint8_t blue_data);
#endif #endif
#endif //__HAL_DSI_RX_CTRL_H__ #endif //__HAL_DSI_RX_CTRL_H__

View File

@ -27,6 +27,7 @@
/******************************************************************************* /*******************************************************************************
* 3.Global structures, unions and enumerations using typedef * 3.Global structures, unions and enumerations using typedef
*******************************************************************************/ *******************************************************************************/
/** /**
* @brief MIPI TX参数结构体 * @brief MIPI TX参数结构体
*/ */
@ -51,6 +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 输出同步 */
#endif
} hal_dsi_tx_ctrl_handle_t; } hal_dsi_tx_ctrl_handle_t;
/** /**
@ -137,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发送命令
@ -147,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溢出时钟分频系统
@ -270,6 +274,13 @@ void hal_dsi_tx_crop_pic(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle, hal_dsi_tx_cr
* @retval true/false * @retval true/false
*/ */
bool hal_dsi_tx_ctrl_set_cus_pq_filter(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle, uint32_t filter[32]); bool hal_dsi_tx_ctrl_set_cus_pq_filter(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle, uint32_t filter[32]);
/**
* @brief TX command mode ,TE信号后调用
* @param tx_ctrl_handle: dsi tx handle
* @retval true/false
*/
bool hal_dsi_tx_ctrl_cmd_mode_rcv_te(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle);
#endif #endif
#endif //__HAL_DSI_TX_CTRL_H__ #endif //__HAL_DSI_TX_CTRL_H__

View File

@ -2,10 +2,10 @@
* *
* *
* File: hal_gpio.h * File: hal_gpio.h
* Description gpio HAL层头文件 * Description gpio HAL层头文件
* Version V0.1 * Version V0.1
* Date 2021-03-17 * Date 2021-03-17
* Author wuc * Author wuc
*******************************************************************************/ *******************************************************************************/
#ifndef __HAL_GPIO_H__ #ifndef __HAL_GPIO_H__
#define __HAL_GPIO_H__ #define __HAL_GPIO_H__
@ -24,7 +24,7 @@
*/ */
typedef enum typedef enum
{ {
/*以GPIO命名PIN*/ /*以GPIO命名PIN*/
IO_PAD_GPIO0 = 0, IO_PAD_GPIO0 = 0,
IO_PAD_GPIO1, IO_PAD_GPIO1,
IO_PAD_GPIO2, IO_PAD_GPIO2,
@ -48,7 +48,7 @@ typedef enum
IO_PAD_GPIO20, IO_PAD_GPIO20,
IO_PAD_GPIO21, IO_PAD_GPIO21,
/*以实际PAD NAME命名PIN*/ /*以实际PAD NAME命名PIN*/
IO_PAD_AP_SPIS_MISO = IO_PAD_GPIO0, IO_PAD_AP_SPIS_MISO = IO_PAD_GPIO0,
IO_PAD_AP_SPIS_MOSI = IO_PAD_GPIO1, IO_PAD_AP_SPIS_MOSI = IO_PAD_GPIO1,
IO_PAD_AP_INT = IO_PAD_GPIO2, IO_PAD_AP_INT = IO_PAD_GPIO2,
@ -81,7 +81,7 @@ typedef enum
IO_PAD_MAX, IO_PAD_MAX,
/*以实际BALL编号命名PIN*/ /*以实际BALL编号命名PIN*/
IO_PIN_A1 = IO_PAD_TD_TPRSTN, IO_PIN_A1 = IO_PAD_TD_TPRSTN,
IO_PIN_A2 = IO_PAD_TD_FC_CSN, IO_PIN_A2 = IO_PAD_TD_FC_CSN,
IO_PIN_A3 = IO_PAD_TD_SPIM_MISO, IO_PIN_A3 = IO_PAD_TD_SPIM_MISO,
@ -109,7 +109,7 @@ typedef enum
} io_pad_e; } io_pad_e;
/** /**
* @brief PAD_AP_SPIS_CLK可选的mode * @brief PAD_AP_SPIS_CLK可选的mode
*/ */
typedef enum typedef enum
{ {
@ -119,7 +119,7 @@ typedef enum
} pad_ap_spis_clk_mode_e; } pad_ap_spis_clk_mode_e;
/** /**
* @brief PAD_AP_SPIS_CSN可选的mode * @brief PAD_AP_SPIS_CSN可选的mode
*/ */
typedef enum typedef enum
{ {
@ -129,7 +129,7 @@ typedef enum
} pad_ap_spis_csn_mode_e; } pad_ap_spis_csn_mode_e;
/** /**
* @brief PAD_AP_SPIS_MISO可选的mode * @brief PAD_AP_SPIS_MISO可选的mode
*/ */
typedef enum typedef enum
{ {
@ -141,7 +141,7 @@ typedef enum
} pad_ap_spis_miso_mode_e; } pad_ap_spis_miso_mode_e;
/** /**
* @brief PAD_AP_SPIS_MOSI可选的mode * @brief PAD_AP_SPIS_MOSI可选的mode
*/ */
typedef enum typedef enum
{ {
@ -153,7 +153,7 @@ typedef enum
} pad_ap_spis_mosi_mode_e; } pad_ap_spis_mosi_mode_e;
/** /**
* @brief PAD_AP_TPRSTN可选的mode * @brief PAD_AP_TPRSTN可选的mode
*/ */
typedef enum typedef enum
{ {
@ -162,7 +162,7 @@ typedef enum
} pad_ap_tprstn_mode_e; } pad_ap_tprstn_mode_e;
/** /**
* @brief PAD_AP_INT可选的mode * @brief PAD_AP_INT可选的mode
*/ */
typedef enum typedef enum
{ {
@ -170,7 +170,7 @@ typedef enum
} pad_ap_int_mode_e; } pad_ap_int_mode_e;
/** /**
* @brief PAD_AP_TE可选的mode * @brief PAD_AP_TE可选的mode
*/ */
typedef enum typedef enum
{ {
@ -179,7 +179,7 @@ typedef enum
} pad_ap_te_mode_e; } pad_ap_te_mode_e;
/** /**
* @brief PAD_AP_SWIRE可选的mode * @brief PAD_AP_SWIRE可选的mode
*/ */
typedef enum typedef enum
{ {
@ -189,7 +189,7 @@ typedef enum
} pad_ap_swire_mode_e; } pad_ap_swire_mode_e;
/** /**
* @brief PAD_TD_SPIM_CLK可选的mode * @brief PAD_TD_SPIM_CLK可选的mode
*/ */
typedef enum typedef enum
{ {
@ -198,7 +198,7 @@ typedef enum
} pad_td_spim_clk_mode_e; } pad_td_spim_clk_mode_e;
/** /**
* @brief PAD_TD_SPIM_CSN可选的mode * @brief PAD_TD_SPIM_CSN可选的mode
*/ */
typedef enum typedef enum
{ {
@ -207,7 +207,7 @@ typedef enum
} pad_td_spim_csn_mode_e; } pad_td_spim_csn_mode_e;
/** /**
* @brief PAD_TD_SPIM_MISO可选的mode * @brief PAD_TD_SPIM_MISO可选的mode
*/ */
typedef enum typedef enum
{ {
@ -219,7 +219,7 @@ typedef enum
} pad_td_spim_miso_mode_e; } pad_td_spim_miso_mode_e;
/** /**
* @brief PAD_TD_SPIM_MOSI可选的mode * @brief PAD_TD_SPIM_MOSI可选的mode
*/ */
typedef enum typedef enum
{ {
@ -228,7 +228,7 @@ typedef enum
} pad_td_spim_mosi_mode_e; } pad_td_spim_mosi_mode_e;
/** /**
* @brief PAD_TD_TPRSTN可选的mode * @brief PAD_TD_TPRSTN可选的mode
*/ */
typedef enum typedef enum
{ {
@ -236,7 +236,7 @@ typedef enum
} pad_td_tprstn_mode_e; } pad_td_tprstn_mode_e;
/** /**
* @brief PAD_TD_INT可选的mode * @brief PAD_TD_INT可选的mode
*/ */
typedef enum typedef enum
{ {
@ -245,7 +245,7 @@ typedef enum
} pad_td_int_mode_e; } pad_td_int_mode_e;
/** /**
* @brief PAD_TD_LEDPWM可选的mode * @brief PAD_TD_LEDPWM可选的mode
*/ */
typedef enum typedef enum
{ {
@ -257,7 +257,7 @@ typedef enum
} pad_td_ledpwm_mode_e; } pad_td_ledpwm_mode_e;
/** /**
* @brief PAD_TD_FC_CLK可选的mode * @brief PAD_TD_FC_CLK可选的mode
*/ */
typedef enum typedef enum
{ {
@ -266,7 +266,7 @@ typedef enum
} pad_td_fc_clk_mode_e; } pad_td_fc_clk_mode_e;
/** /**
* @brief PAD_TD_FC_CSN可选的mode * @brief PAD_TD_FC_CSN可选的mode
*/ */
typedef enum typedef enum
{ {
@ -275,7 +275,7 @@ typedef enum
} pad_td_fc_csn_mode_e; } pad_td_fc_csn_mode_e;
/** /**
* @brief PAD_TD_FC_MISO可选的mode * @brief PAD_TD_FC_MISO可选的mode
*/ */
typedef enum typedef enum
{ {
@ -284,7 +284,7 @@ typedef enum
} pad_td_fc_miso_mode_e; } pad_td_fc_miso_mode_e;
/** /**
* @brief PAD_TD_FC_MOSI可选的mode * @brief PAD_TD_FC_MOSI可选的mode
*/ */
typedef enum typedef enum
{ {
@ -293,7 +293,7 @@ typedef enum
} pad_td_fc_mosi_mode_e; } pad_td_fc_mosi_mode_e;
/** /**
* @brief PAD_UART_RX可选的mode * @brief PAD_UART_RX可选的mode
*/ */
typedef enum typedef enum
{ {
@ -302,7 +302,7 @@ typedef enum
} pad_uart_rx_mode_e; } pad_uart_rx_mode_e;
/** /**
* @brief PAD_UART_TX可选的mode * @brief PAD_UART_TX可选的mode
*/ */
typedef enum typedef enum
{ {
@ -311,7 +311,7 @@ typedef enum
} pad_uart_tx_mode_e; } pad_uart_tx_mode_e;
/** /**
* @brief PAD_PWMEN可选的mode * @brief PAD_PWMEN可选的mode
*/ */
typedef enum typedef enum
{ {
@ -319,7 +319,7 @@ typedef enum
} pad_pwmen_mode_e; } pad_pwmen_mode_e;
/** /**
* @brief PAD_ADCIN可选的mode * @brief PAD_ADCIN可选的mode
*/ */
typedef enum typedef enum
{ {
@ -327,7 +327,7 @@ typedef enum
} pad_adcin_mode_e; } pad_adcin_mode_e;
/** /**
* @brief PAD_SFC_CLK可选的mode * @brief PAD_SFC_CLK可选的mode
*/ */
typedef enum typedef enum
{ {
@ -336,7 +336,7 @@ typedef enum
} pad_sfc_clk_mode_e; } pad_sfc_clk_mode_e;
/** /**
* @brief PAD_SFC_CSN可选的mode * @brief PAD_SFC_CSN可选的mode
*/ */
typedef enum typedef enum
{ {
@ -345,7 +345,7 @@ typedef enum
} pad_sfc_csn_mode_e; } pad_sfc_csn_mode_e;
/** /**
* @brief PAD_SFC_IO0可选的mode * @brief PAD_SFC_IO0可选的mode
*/ */
typedef enum typedef enum
{ {
@ -354,7 +354,7 @@ typedef enum
} pad_sfc_io0_mode_e; } pad_sfc_io0_mode_e;
/** /**
* @brief PAD_SFC_IO1可选的mode * @brief PAD_SFC_IO1可选的mode
*/ */
typedef enum typedef enum
{ {
@ -363,7 +363,7 @@ typedef enum
} pad_sfc_io1_mode_e; } pad_sfc_io1_mode_e;
/** /**
* @brief PAD电压转换速率 * @brief PAD电压转换速率
*/ */
typedef enum typedef enum
{ {
@ -375,7 +375,7 @@ typedef enum
* IOE * IOE
*******************************************************************************/ *******************************************************************************/
/** /**
* @brief GPIO io方向 * @brief GPIO io方向
*/ */
typedef enum typedef enum
{ {
@ -404,133 +404,133 @@ typedef enum
* 5.Global function prototypes * 5.Global function prototypes
*******************************************************************************/ *******************************************************************************/
/** /**
* @brief PAD为GPIO modeinput * @brief PAD为GPIO modeinput
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param trig4sys_cfg_trigger_e * @param trig4sys_cfg_trigger_e
* @retval * @retval
*/ */
void hal_gpio_init_eint(io_pad_e pad, sys_cfg_trigger_e trig); void hal_gpio_init_eint(io_pad_e pad, sys_cfg_trigger_e trig);
/** /**
* @brief GPIO中断回调函数 * @brief GPIO中断回调函数
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param cb_func * @param cb_func
* @param data * @param data
* @retval * @retval
*/ */
void hal_gpio_reg_eint_cb(io_pad_e pad, fcb_type cb_func); void hal_gpio_reg_eint_cb(io_pad_e pad, fcb_type cb_func);
/** /**
* @brief GPIO中断 * @brief GPIO中断
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param state * @param state
* @retval * @retval
*/ */
void hal_gpio_ctrl_eint(io_pad_e pad, function_state_e state); void hal_gpio_ctrl_eint(io_pad_e pad, function_state_e state);
/** /**
* @brief GPIO中断类型 * @brief GPIO中断类型
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @retval * @retval
*/ */
gpio_int_e hal_gpio_get_int_type(io_pad_e pad); gpio_int_e hal_gpio_get_int_type(io_pad_e pad);
/** /**
* @brief PAD为GPIO modeoutput * @brief PAD为GPIO modeoutput
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param lvlgpio_level_e * @param lvlgpio_level_e
* @retval * @retval
*/ */
void hal_gpio_init_output(io_pad_e pad, gpio_level_e lvl); void hal_gpio_init_output(io_pad_e pad, gpio_level_e lvl);
/** /**
* @brief * @brief
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param lvlgpio_level_e * @param lvlgpio_level_e
* @retval * @retval
*/ */
void hal_gpio_set_output_data(io_pad_e pad, gpio_level_e lvl); void hal_gpio_set_output_data(io_pad_e pad, gpio_level_e lvl);
/** /**
* @brief IO输出电平 * @brief IO输出电平
* @param pad1GPIO序号gpio_pad_e * @param pad1GPIO序号gpio_pad_e
* @param pad1_lvlgpio_level_e * @param pad1_lvlgpio_level_e
* @param pad2GPIO序号gpio_pad_e * @param pad2GPIO序号gpio_pad_e
* @param pad2_lvlgpio_level_e * @param pad2_lvlgpio_level_e
* @retval * @retval
*/ */
void hal_gpio_set_output_data_ex(io_pad_e pad1, gpio_level_e pad1_lvl, io_pad_e pad2, gpio_level_e pad2_lvl); void hal_gpio_set_output_data_ex(io_pad_e pad1, gpio_level_e pad1_lvl, io_pad_e pad2, gpio_level_e pad2_lvl);
/** /**
* @brief PAD为GPIO modeinput * @brief PAD为GPIO modeinput
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @retval * @retval
*/ */
void hal_gpio_init_input(io_pad_e pad); void hal_gpio_init_input(io_pad_e pad);
/** /**
* @brief * @brief
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @retval * @retval
*/ */
gpio_level_e hal_gpio_get_input_data(io_pad_e pad); gpio_level_e hal_gpio_get_input_data(io_pad_e pad);
/** /**
* @brief io mode * @brief io mode
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param modePAD对应的mode枚举类型 * @param modePAD对应的mode枚举类型
* @retval * @retval
*/ */
void hal_gpio_set_mode(io_pad_e pad, uint8_t mode); void hal_gpio_set_mode(io_pad_e pad, uint8_t mode);
/** /**
* @brief PAD的默认上拉 * @brief PAD的默认上拉
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param up_enable * @param up_enable
* @param down_enable * @param down_enable
* @retval * @retval
*/ */
void hal_gpio_get_pull_state(io_pad_e pad, function_state_e *up_enable, function_state_e *down_enable); void hal_gpio_get_pull_state(io_pad_e pad, function_state_e *up_enable, function_state_e *down_enable);
/** /**
* @brief PAD的默认上拉 * @brief PAD的默认上拉
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param up_enable * @param up_enable
* @param down_enable * @param down_enable
* @retval * @retval
*/ */
void hal_gpio_set_pull_state(io_pad_e pad, function_state_e up_enable, function_state_e down_enable); void hal_gpio_set_pull_state(io_pad_e pad, function_state_e up_enable, function_state_e down_enable);
/** /**
* @brief PAD是否为施密特触发 * @brief PAD是否为施密特触发
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param st_enable10 * @param st_enable10
* @retval * @retval
*/ */
void hal_gpio_set_schmitt_trigger(io_pad_e pad, function_state_e st_enable); void hal_gpio_set_schmitt_trigger(io_pad_e pad, function_state_e st_enable);
/** /**
* @brief PAD的驱动能力 * @brief PAD的驱动能力
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param strength0~3 * @param strength0~3
* @retval * @retval
*/ */
void hal_gpio_set_driving_strength(io_pad_e pad, uint8_t strength); void hal_gpio_set_driving_strength(io_pad_e pad, uint8_t strength);
/** /**
* @brief PAD的电压转换速率 * @brief PAD的电压转换速率
* @param padGPIO序号gpio_pad_e * @param padGPIO序号gpio_pad_e
* @param rate0~3 * @param rate0~3
* @retval * @retval
*/ */
void hal_gpio_set_slew_rate(io_pad_e pad, pad_slew_rate_e rate); void hal_gpio_set_slew_rate(io_pad_e pad, pad_slew_rate_e rate);
/** /**
* @brief AP_RSTN引脚中断 * @brief AP_RSTN引脚中断
* @param enable: * @param enable:
* @param cb_func * @param cb_func
* @param trig * @param trig
* @retval * @retval
*/ */
void hal_gpio_set_ap_reset_int(bool enable, fcb_type cb_func, sys_cfg_trigger_e trig); void hal_gpio_set_ap_reset_int(bool enable, fcb_type cb_func, sys_cfg_trigger_e trig);

View File

@ -17,10 +17,10 @@
/************************************************************************** /**************************************************************************
* @name : hal_i2c_m_dma_init * @name : hal_i2c_m_dma_init
* @brief : i2c master dma * @brief : i2c master dma
* @param[in] : slave_addr * @param[in] : slave_addr
* @param[in] : addr_bits * @param[in] : addr_bits
* @param[in] : i2c_speed_hz: * @param[in] : i2c_speed_hz:
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
@ -28,46 +28,53 @@ void hal_i2c_m_dma_init(uint8_t slave_addr, uint8_t addr_bits, uint32_t i2c_spee
/************************************************************************** /**************************************************************************
* @name : hal_i2c_m_dma_write * @name : hal_i2c_m_dma_write
* @brief : i2c master dma * @brief : i2c master dma
* @param[in] : txBufferbuffer * @param[in] : txBufferbuffer
* @param[in] : data_size * @param[in] : data_size
* @return : STATUS_SUCCESS DMA * @return : STATUS_SUCCESS DMA
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
status_t hal_i2c_m_dma_write(const uint8_t *txBuffer, size_t data_size); status_t hal_i2c_m_dma_write(const uint8_t *txBuffer, size_t data_size);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_m_dma_read * @name : hal_i2c_m_dma_read
* @brief : i2c master dma * @brief : i2c master dma
* @param[in] : reg_address * @param[in] : reg_address
* @param[in] : reg_size * @param[in] : reg_size
* @param[in] : rxBufferbuffer * @param[in] : rxBufferbuffer
* @param[in] : data_size * @param[in] : data_size
* @return : STATUS_SUCCESSDMA接收通道 * @return : STATUS_SUCCESSDMA接收通道
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
status_t hal_i2c_m_dma_read(uint32_t reg_address, size_t reg_size, uint8_t *rxBuffer, size_t data_size); status_t hal_i2c_m_dma_read(uint32_t reg_address, size_t reg_size, uint8_t *rxBuffer, size_t data_size);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_m_transfer_complate * @name : hal_i2c_m_transfer_complate
* @brief : i2c master * @brief : i2c master
* @param[in] : * @param[in] :
* @return : true * @return : true
* @return : false * @return : false
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
bool hal_i2c_m_transfer_complate(void); bool hal_i2c_m_transfer_complate(void);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_m_set_high_impedance * @name : hal_i2c_m_set_high_impedance
* @brief : I2C IO口设置为高阻态 * @brief : I2C IO口设置为高阻态
* @param[in] : * @param[in] :
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
void hal_i2c_m_set_high_impedance(void); void hal_i2c_m_set_high_impedance(void);
/**************************************************************************
* @name : hal_i2c_m_deinit
* @brief : i2c主机 IP去初始化使
* @param[in] :
* @return :
* @retval :
***************************************************************************/
void hal_i2c_m_deinit(void);
#endif /* __HAL_I2C_MASTER_H__*/ #endif /* __HAL_I2C_MASTER_H__*/

View File

@ -17,18 +17,27 @@
typedef enum typedef enum
{ {
I2C_S_INT_READ = 0, //发生 读请求 中断 I2C_S_INT_READ = 0, //发生 读请求 中断
I2C_S_INT_RX, //发生 接收 中断 I2C_S_INT_RX, //发生 接收 中断
I2C_S_INT_STOP //发生 stop 中断 I2C_S_INT_STOP //发生 stop 中断
} e_i2c_s_int_status; } e_i2c_s_int_status;
#if defined(ISP_568) || defined(ISP_368)
typedef enum
{
I2C_S_0 = 0,
I2C_S_1,
I2C_S_MAX
} i2c_s_index_e;
#endif
typedef void (*hal_i2c_s_callback_t)(e_i2c_s_int_status int_status, size_t receive_num); typedef void (*hal_i2c_s_callback_t)(e_i2c_s_int_status int_status, size_t receive_num);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_init * @name : hal_i2c_s_init
* @brief : i2c slave * @brief : i2c slave
* @param[in] : slave_addr * @param[in] : slave_addr
* @param[in] : addr_bits * @param[in] : addr_bits
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
@ -36,48 +45,48 @@ void hal_i2c_s_init(uint8_t slave_addr, uint8_t addr_bits);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_dma_write * @name : hal_i2c_s_dma_write
* @brief : i2c slave dma * @brief : i2c slave dma
* @param[in] : txBufferbuffer * @param[in] : txBufferbuffer
* @param[in] : data_size * @param[in] : data_size
* @return : STATUS_SUCCESS DMA * @return : STATUS_SUCCESS DMA
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
status_t hal_i2c_s_dma_write(const uint8_t *txBuffer, size_t data_size); status_t hal_i2c_s_dma_write(const uint8_t *txBuffer, size_t data_size);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_nonblocking_read * @name : hal_i2c_s_nonblocking_read
* @brief : i2c slave * @brief : i2c slave
* @param[in] : rxBufferbuffer * @param[in] : rxBufferbuffer
* @param[in] : data_size * @param[in] : data_size
* @return : STATUS_SUCCESS * @return : STATUS_SUCCESS
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
status_t hal_i2c_s_nonblocking_read(uint8_t *rxBuffer, size_t data_size); status_t hal_i2c_s_nonblocking_read(uint8_t *rxBuffer, size_t data_size);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_transfer_complate * @name : hal_i2c_s_transfer_complate
* @brief : i2c slave * @brief : i2c slave
* @param[in] : * @param[in] :
* @return : true * @return : true
* @return : false * @return : false
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
bool hal_i2c_s_write_complate(void); bool hal_i2c_s_write_complate(void);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_read_complate * @name : hal_i2c_s_read_complate
* @brief : i2c slave * @brief : i2c slave
* @param[in] : * @param[in] :
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
uint8_t hal_i2c_s_read_complate(void); uint8_t hal_i2c_s_read_complate(void);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_read_complate_clear * @name : hal_i2c_s_read_complate_clear
* @brief : i2c slave * @brief : i2c slave
* @param[in] : * @param[in] :
* @return : * @return :
* @retval : * @retval :
@ -86,17 +95,17 @@ void hal_i2c_s_read_complate_clear(void);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_set_dma_tx_cycle * @name : hal_i2c_s_set_dma_tx_cycle
* @brief : I2C cycle * @brief : I2C cycle
* @param[in] : * @param[in] :
* @return : ENABLEcycle模式DISABLEcycle模式 * @return : ENABLEcycle模式DISABLEcycle模式
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
void hal_i2c_s_set_dma_tx_cycle(bool enable); void hal_i2c_s_set_dma_tx_cycle(bool enable);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_set_transfer * @name : hal_i2c_s_set_transfer
* @brief : i2c * @brief : i2c
* @param[in] :hal_tp_transfer_phone_tmp * @param[in] :hal_tp_transfer_phone_tmp
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
@ -105,9 +114,9 @@ void hal_i2c_s_set_transfer(hal_i2c_s_callback_t hal_i2c_s_callback_tmp);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_read_data * @name : hal_i2c_s_read_data
* @brief :read data * @brief :read data
* @param[in] : rx_data: * @param[in] : rx_data:
* @return : 1: * @return : 1:
* @return : 0: fifo * @return : 0: fifo
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
status_t hal_i2c_s_read_data(uint8_t *rx_data); status_t hal_i2c_s_read_data(uint8_t *rx_data);
@ -115,26 +124,26 @@ status_t hal_i2c_s_read_data(uint8_t *rx_data);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_write_data * @name : hal_i2c_s_write_data
* @brief :write data * @brief :write data
* @param[in] : tx_data: * @param[in] : tx_data:
* @return : 1: * @return : 1:
* @return : 0: fifo * @return : 0: fifo
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
status_t hal_i2c_s_write_data(const uint8_t tx_data); status_t hal_i2c_s_write_data(const uint8_t tx_data);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_rxfifo_notempty * @name : hal_i2c_s_rxfifo_notempty
* @brief : rxfifo * @brief : rxfifo
* @param[in] : * @param[in] :
* @return : true: rxfifo * @return : true: rxfifo
* @return : false: rxfifo * @return : false: rxfifo
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
bool hal_i2c_s_rxfifo_notempty(void); bool hal_i2c_s_rxfifo_notempty(void);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_set_high_impedance * @name : hal_i2c_s_set_high_impedance
* @brief : I2C IO口设置为高阻态 * @brief : I2C IO口设置为高阻态
* @param[in] : * @param[in] :
* @return : * @return :
* @retval : * @retval :
@ -142,11 +151,29 @@ bool hal_i2c_s_rxfifo_notempty(void);
void hal_i2c_s_set_high_impedance(void); void hal_i2c_s_set_high_impedance(void);
/************************************************************************** /**************************************************************************
* @name : hal_i2c_s_get_tx_byte_num * @name : hal_i2c_s_get_tx_byte_num
* @brief : I2C从机发送成功字节数 * @brief : I2C从机发送成功字节数
* @param[in] : * @param[in] :
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
int hal_i2c_s_get_tx_byte_num(void); int hal_i2c_s_get_tx_byte_num(void);
/**************************************************************************
* @name : hal_i2c_s_deinit
* @brief : i2c IP去初始化使
* @param[in] :slave_num
* @return :
* @retval :
***************************************************************************/
void hal_i2c_s_deinit(void);
#if defined(ISP_568) || defined(ISP_368)
/**************************************************************************
* @name : hal_i2c_s_sel
* @brief : i2c slave
* @param[in] : slaver
* @return :
* @retval :
**************************************************************************/
void hal_i2c_s_sel(i2c_s_index_e slaver);
#endif
#endif /* __HAL_I2C_SLAVE_H__*/ #endif /* __HAL_I2C_SLAVE_H__*/

View File

@ -2,10 +2,10 @@
* *
* *
* File: hal_pwm.h * File: hal_pwm.h
* Description pwm HAL层头文件 * Description pwm HAL层头文件
* Version V0.1 * Version V0.1
* Date 2021-03-17 * Date 2021-03-17
* Author wuc * Author wuc
*******************************************************************************/ *******************************************************************************/
#ifndef __HAL_PWM_H__ #ifndef __HAL_PWM_H__
#define __HAL_PWM_H__ #define __HAL_PWM_H__
@ -24,7 +24,7 @@
/******************************************************************************* /*******************************************************************************
* 3.Global structures, unions and enumerations using typedef * 3.Global structures, unions and enumerations using typedef
*******************************************************************************/ *******************************************************************************/
/*! @brief PWM触发功能的定义 */ /*! @brief PWM触发功能的定义 */
typedef enum _pwm_out_ctrl_e typedef enum _pwm_out_ctrl_e
{ {
PWMO_CTRL_KEEP = 0, PWMO_CTRL_KEEP = 0,
@ -42,167 +42,177 @@ typedef enum _pwm_out_ctrl_e
* 5.Global function prototypes * 5.Global function prototypes
*******************************************************************************/ *******************************************************************************/
/** /**
* @brief PWMO初始化 * @brief PWMO初始化
* @param * @param
* @retval * @retval
*/ */
void hal_pwm_out_init(void); void hal_pwm_out_init(void);
/** /**
* @brief PWMO反初始化 * @brief PWMO反初始化
* @param * @param
* @retval * @retval
*/ */
void hal_pwm_out_deinit(void); void hal_pwm_out_deinit(void);
/** /**
* @brief PWMO输出脉冲暂停 * @brief PWMO输出脉冲暂停
* @param state * @param state
* @retval * @retval
*/ */
void hal_pwm_out_pause(function_state_e state); void hal_pwm_out_pause(function_state_e state);
/** /**
* @brief PWMO脉冲并开始输出 * @brief PWMO脉冲并开始输出
* @param ctl0thr0时的操作pwm_out_ctrl_e * @param ctl0thr0时的操作pwm_out_ctrl_e
* @param ctl1thr1时的操作pwm_out_ctrl_e * @param ctl1thr1时的操作pwm_out_ctrl_e
* @param thr00us * @param thr00us
* @param thr11us * @param thr11us
* @param periodus * @param periodus
* @retval * @retval
*/ */
void hal_pwm_out_config_all(pwm_out_ctrl_e ctl0, pwm_out_ctrl_e ctl1, uint32_t thr0, uint32_t thr1, uint32_t period); void hal_pwm_out_config_all(pwm_out_ctrl_e ctl0, pwm_out_ctrl_e ctl1, uint32_t thr0, uint32_t thr1, uint32_t period);
/** /**
* @brief PWMO脉冲所有参数 * @brief PWMO脉冲所有参数
* @param ctl0thr0时的操作pwm_out_ctrl_e * @param ctl0thr0时的操作pwm_out_ctrl_e
* @param ctl1thr1时的操作pwm_out_ctrl_e * @param ctl1thr1时的操作pwm_out_ctrl_e
* @param thr00us * @param thr00us
* @param thr11us * @param thr11us
* @param periodus * @param periodus
* @retval * @retval
*/ */
void hal_pwm_out_sync_all(pwm_out_ctrl_e ctl0, pwm_out_ctrl_e ctl1, uint32_t thr0, uint32_t thr1, uint32_t period); void hal_pwm_out_sync_all(pwm_out_ctrl_e ctl0, pwm_out_ctrl_e ctl1, uint32_t thr0, uint32_t thr1, uint32_t period);
/** /**
* @brief PWMO脉冲的周期 * @brief pwm输出以控制背光
* @param periodus * @param polarity: false:true:
* @retval * @param duty_ratio: (0-total_ratio)
* @param total_ratio:
* @param frequency: HZ
* @retval
*/
void hal_pwm_out_config_duty_ratio(bool polarity, uint16_t duty_ratio, uint16_t total_ratio, uint32_t frequency);
/**
* @brief PWMO脉冲的周期
* @param periodus
* @retval
*/ */
void hal_pwm_out_sync_period(uint32_t period); void hal_pwm_out_sync_period(uint32_t period);
/** /**
* @brief PWMO脉冲的控制 * @brief PWMO脉冲的控制
* @param ctl0thr0时的操作pwm_out_ctrl_e * @param ctl0thr0时的操作pwm_out_ctrl_e
* @param ctl1thr1时的操作pwm_out_ctrl_e * @param ctl1thr1时的操作pwm_out_ctrl_e
* @retval * @retval
*/ */
void hal_pwm_out_sync_ctl(pwm_out_ctrl_e ctl0, pwm_out_ctrl_e ctl1); void hal_pwm_out_sync_ctl(pwm_out_ctrl_e ctl0, pwm_out_ctrl_e ctl1);
/** /**
* @brief PWMO脉冲的阈值 * @brief PWMO脉冲的阈值
* @param thr00us * @param thr00us
* @param thr11us * @param thr11us
* @retval * @retval
*/ */
void hal_pwm_out_sync_thr(uint32_t thr0, uint32_t thr1); void hal_pwm_out_sync_thr(uint32_t thr0, uint32_t thr1);
/** /**
* @brief PWMO脉冲 * @brief PWMO脉冲
* @param pause_state * @param pause_state
* @retval * @retval
*/ */
void hal_pwm_out_sync_pause(function_state_e pause_state); void hal_pwm_out_sync_pause(function_state_e pause_state);
/** /**
* @brief PWMI初始化 * @brief PWMI初始化
* @param * @param
* @retval * @retval
*/ */
void hal_pwm_in_init(void); void hal_pwm_in_init(void);
/** /**
* @brief PWMI反初始化 * @brief PWMI反初始化
* @param * @param
* @retval * @retval
*/ */
void hal_pwm_in_deinit(void); void hal_pwm_in_deinit(void);
/** /**
* @brief PWMI中断回调函数PWMI中断类型指针pwm_int_type_e * @brief PWMI中断回调函数PWMI中断类型指针pwm_int_type_e
* @param cb_func * @param cb_func
* @retval * @retval
*/ */
void hal_pwm_in_register_callback(fcb_type cb_func); void hal_pwm_in_register_callback(fcb_type cb_func);
/** /**
* @brief PWMI所有中断的开关 * @brief PWMI所有中断的开关
* @param high_overflow_enhigh overflow中断使能开关 * @param high_overflow_enhigh overflow中断使能开关
* @param low_overflow_enlow overflow中断使能开关 * @param low_overflow_enlow overflow中断使能开关
* @param total_overflow_entotal overflow中断使能开关 * @param total_overflow_entotal overflow中断使能开关
* @param high_done_enhigh done中断使能开关 * @param high_done_enhigh done中断使能开关
* @param low_done_enlow done中断使能开关 * @param low_done_enlow done中断使能开关
* @param total_done_entotal done中断使能开关 * @param total_done_entotal done中断使能开关
* @retval * @retval
*/ */
void hal_pwm_in_config_int(function_state_e high_overflow_en, function_state_e low_overflow_en, function_state_e total_overflow_en, void hal_pwm_in_config_int(function_state_e high_overflow_en, function_state_e low_overflow_en, function_state_e total_overflow_en,
function_state_e high_done_en, function_state_e low_done_en, function_state_e total_done_en); function_state_e high_done_en, function_state_e low_done_en, function_state_e total_done_en);
/** /**
* @brief PWMI单个中断的开关 * @brief PWMI单个中断的开关
* @param pwm_intpwm_int_type_e * @param pwm_intpwm_int_type_e
* @param enable * @param enable
* @retval * @retval
*/ */
void hal_pwm_in_set_int(pwm_int_type_e pwm_int, function_state_e enable); void hal_pwm_in_set_int(pwm_int_type_e pwm_int, function_state_e enable);
/** /**
* @brief PWMI所有中断 * @brief PWMI所有中断
* @param * @param
* @retval * @retval
*/ */
void hal_pwm_in_clear_int(void); void hal_pwm_in_clear_int(void);
/** /**
* @brief PWMI中断 * @brief PWMI中断
* @param state * @param state
* @retval * @retval
*/ */
void hal_pwm_in_ctrl_int(function_state_e state); void hal_pwm_in_ctrl_int(function_state_e state);
/** /**
* @brief PWMI脉冲周期时长 * @brief PWMI脉冲周期时长
* @param * @param
* @retval us * @retval us
*/ */
uint32_t hal_pwm_in_get_total_period(void); uint32_t hal_pwm_in_get_total_period(void);
/** /**
* @brief PWMI脉冲高电平时长 * @brief PWMI脉冲高电平时长
* @param * @param
* @retval us * @retval us
*/ */
uint32_t hal_pwm_in_get_high_period(void); uint32_t hal_pwm_in_get_high_period(void);
/** /**
* @brief PWMI脉冲低电平时长 * @brief PWMI脉冲低电平时长
* @param * @param
* @retval us * @retval us
*/ */
uint32_t hal_pwm_in_get_low_period(void); uint32_t hal_pwm_in_get_low_period(void);
/** /**
* @brief PWMI上升沿累积个数 * @brief PWMI上升沿累积个数
* @param * @param
* @retval 使沿32 * @retval 使沿32
*/ */
uint32_t hal_pwm_in_get_current_count(void); uint32_t hal_pwm_in_get_current_count(void);
#if defined(ISP_568) || defined(ISP_368) #if defined(ISP_568) || defined(ISP_368)
/** /**
* @brief PWMO输出的IO口 * @brief PWMO输出的IO口
* @param pad: PWMO输出的IO口,IO_PAD_AP_SWIRE,IO_PAD_TD_SPIM_MISOIO_PAD_TD_LEDPWM输出 * @param pad: PWMO输出的IO口,IO_PAD_AP_SWIRE,IO_PAD_TD_SPIM_MISOIO_PAD_TD_LEDPWM输出
* @retval * @retval
*/ */
void hal_pwm_out_sel_io(io_pad_e pad); void hal_pwm_out_sel_io(io_pad_e pad);
#endif #endif

View File

@ -17,10 +17,10 @@
/************************************************************************** /**************************************************************************
* @name : hal_spi_m_dma_init * @name : hal_spi_m_dma_init
* @brief : SPIM DMA * @brief : SPIM DMA
* @param[in] :speed * @param[in] :speed
* @param[in] :cpha: 沿沿 * @param[in] :cpha: 沿沿
* @param[in] :cpol: 线 * @param[in] :cpol: 线
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
@ -28,40 +28,40 @@ void hal_spi_m_dma_init(uint32_t speed, uint8_t cpha, uint8_t cpol);
/************************************************************************** /**************************************************************************
* @name : hal_spi_m_dma_write * @name : hal_spi_m_dma_write
* @brief : SPIM * @brief : SPIM
* @param[in] :data_buffer: buffer * @param[in] :data_buffer: buffer
* @param[in] :data_size: buffer * @param[in] :data_size: buffer
* @return :STATUS_SUCCESS: * @return :STATUS_SUCCESS:
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
status_t hal_spi_m_dma_write(const uint8_t *data_buffer, size_t data_size); status_t hal_spi_m_dma_write(const uint8_t *data_buffer, size_t data_size);
/************************************************************************** /**************************************************************************
* @name : hal_spi_m_dma_read * @name : hal_spi_m_dma_read
* @brief : SPIM * @brief : SPIM
* @param[in] :cmd: buffer * @param[in] :cmd: buffer
* @param[in] :cmd_size: buffer * @param[in] :cmd_size: buffer
* @param[in] :data_buffer: buffer * @param[in] :data_buffer: buffer
* @param[in] :data_size: buffer * @param[in] :data_size: buffer
* @return :STATUS_SUCCESS: * @return :STATUS_SUCCESS:
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
status_t hal_spi_m_dma_read(const uint8_t *cmd, size_t cmd_size, uint8_t *data_buffer, size_t data_size); status_t hal_spi_m_dma_read(const uint8_t *cmd, size_t cmd_size, uint8_t *data_buffer, size_t data_size);
/************************************************************************** /**************************************************************************
* @name : hal_spi_m_get_transfer_complate * @name : hal_spi_m_get_transfer_complate
* @brief : SPIM * @brief : SPIM
* @param[in] : * @param[in] :
* @return :true * @return :true
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
bool hal_spi_m_get_transfer_complate(void); bool hal_spi_m_get_transfer_complate(void);
/************************************************************************** /**************************************************************************
* @name : hal_spi_m_clear_rxfifo * @name : hal_spi_m_clear_rxfifo
* @brief : rxfifo * @brief : rxfifo
* @param[in] : * @param[in] :
* @return : * @return :
* @retval : * @retval :
@ -70,13 +70,20 @@ void hal_spi_m_clear_rxfifo(void);
/************************************************************************** /**************************************************************************
* @name : hal_spi_m_set_high_impedance * @name : hal_spi_m_set_high_impedance
* @brief : SPI IO口设置为高阻态 * @brief : SPI IO口设置为高阻态
* @param[in] : * @param[in] :
* @return : * @return :
* @retval : * @retval :
**************************************************************************/ **************************************************************************/
void hal_spi_m_set_high_impedance(void); void hal_spi_m_set_high_impedance(void);
/**************************************************************************
* @name : hal_spi_m_deinit
* @brief : SPI (SPIM)
* @param[in] :
* @return :true
* @retval :
**************************************************************************/
bool hal_spi_m_deinit(void);
#endif #endif

View File

@ -24,25 +24,25 @@
* 3.Global structures, unions and enumerations using typedef * 3.Global structures, unions and enumerations using typedef
*******************************************************************************/ *******************************************************************************/
/* /*
event eg:rx_buffer_size=8, host发送16个byte数据, event eg:rx_buffer_size=8, host发送16个byte数据,
8byte数据时产生SPI_EVENT_RCV_FULL事件,, 8byte数据时产生SPI_EVENT_RCV_FULL事件,,
host拉高CS,SPI_EVENT_RCV_CS_HIGH事件 host拉高CS,SPI_EVENT_RCV_CS_HIGH事件
*/ */
typedef enum typedef enum
{ {
SPI_EVENT_RCV_DATA = 0, /* 手动模式下SPIS 接受每接收一个数据即产生事件 */ SPI_EVENT_RCV_DATA = 0, /* 手动模式下SPIS 接受每接收一个数据即产生事件 */
SPI_EVENT_RCV_FULL, /* 自动模式下 SPIS 接收数据等于buffer size后产生事件 */ SPI_EVENT_RCV_FULL, /* 自动模式下 SPIS 接收数据等于buffer size后产生事件 */
SPI_EVENT_RCV_CS_HIGH, /* 自动模式下 SPIS 收到CS 拉高的信号 */ SPI_EVENT_RCV_CS_HIGH, /* 自动模式下 SPIS 收到CS 拉高的信号 */
} hal_spis_event_e; } hal_spis_event_e;
typedef struct hal_spi_packet_info_t typedef struct hal_spi_packet_info_t
{ {
uint8_t *rx_buffer; /* 接收buffer */ uint8_t *rx_buffer; /* 接收buffer */
uint32_t rx_buffer_size; /* 接收buffer size */ uint32_t rx_buffer_size; /* 接收buffer size */
bool rx_circle; /* 接收circle mode */ bool rx_circle; /* 接收circle mode */
const uint8_t *tx_buffer; /* 发送buffer */ const uint8_t *tx_buffer; /* 发送buffer */
uint32_t tx_buffer_size; /* 发送buffer size */ uint32_t tx_buffer_size; /* 发送buffer size */
bool tx_circle; /* 发送circle mode */ bool tx_circle; /* 发送circle mode */
uint32_t packet_size; /* packet size */ uint32_t packet_size; /* packet size */
} hal_spi_packet_info_t; } hal_spi_packet_info_t;
@ -56,24 +56,24 @@ typedef void (*hal_spi_slave_cb)(hal_spis_event_e event, hal_spi_packet_info_t *
* 5.Global function prototypes * 5.Global function prototypes
*******************************************************************************/ *******************************************************************************/
/** /**
* @brief spi slave * @brief spi slave
* @param cpha: * @param cpha:
* @param cpol: * @param cpol:
* @param dma: DMA enable * @param dma: DMA enable
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_init(uint8_t cpha, uint8_t cpol, bool dma); bool hal_spi_slave_init(uint8_t cpha, uint8_t cpol, bool dma);
/** /**
* @brief spi slave * @brief spi slave
* @param none * @param none
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_deinit(void); bool hal_spi_slave_deinit(void);
/** /**
* @brief spi slave * @brief spi slave
* @param cbcall back * @param cbcall back
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_register_callback(hal_spi_slave_cb cb); bool hal_spi_slave_register_callback(hal_spi_slave_cb cb);
@ -93,49 +93,49 @@ bool hal_spi_slave_enable(void);
bool hal_spi_slave_disable(void); bool hal_spi_slave_disable(void);
/** /**
* @brief spi slave buffer, callback, buffer为NULL时为自动接收模式 * @brief spi slave buffer, callback, buffer为NULL时为自动接收模式
* @param bufferbuffer * @param bufferbuffer
* @param size buffer size * @param size buffer size
* @param circlecircle modepacket size buffer size offset 0() * @param circlecircle modepacket size buffer size offset 0()
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_set_auto_rx_buffer(uint8_t *buffer, uint32_t size, bool circle); bool hal_spi_slave_set_auto_rx_buffer(uint8_t *buffer, uint32_t size, bool circle);
/** /**
* @brief spi slave buffer * @brief spi slave buffer
* @param bufferbuffer, buffer为NULL为切换为自动模式 * @param bufferbuffer, buffer为NULL为切换为自动模式
* @param size buffer size * @param size buffer size
* @param circlecircle modebuffer的数据 * @param circlecircle modebuffer的数据
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_set_auto_tx_buffer(const uint8_t *buffer, uint32_t size, bool circle); bool hal_spi_slave_set_auto_tx_buffer(const uint8_t *buffer, uint32_t size, bool circle);
/** /**
* @brief spi slave * @brief spi slave
* @param none * @param none
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_auto_transfer_start(void); bool hal_spi_slave_auto_transfer_start(void);
/** /**
* @brief spi slave (circle mode packet结束可使用) * @brief spi slave (circle mode packet结束可使用)
* @param none * @param none
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_auto_transfer_abort(void); bool hal_spi_slave_auto_transfer_abort(void);
/** /**
* @brief spi slave flush fifo(circle mode packet结束后可使用) * @brief spi slave flush fifo(circle mode packet结束后可使用)
* @param none * @param none
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_flush_fifo(void); bool hal_spi_slave_flush_fifo(void);
/** /**
* @brief reset spis tx,spis后重新配置输出数据 * @brief reset spis tx,spis后重新配置输出数据
* @param bufferbuffer * @param bufferbuffer
* @param size buffer size * @param size buffer size
* @param circlecircle modebuffer的数据 * @param circlecircle modebuffer的数据
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_reset_tx(const uint8_t *buffer, uint32_t size, bool circle); bool hal_spi_slave_reset_tx(const uint8_t *buffer, uint32_t size, bool circle);
@ -148,21 +148,21 @@ bool hal_spi_slave_reset_tx(const uint8_t *buffer, uint32_t size, bool circle);
bool hal_spi_slave_busy(void); bool hal_spi_slave_busy(void);
/** /**
* @brief rx fifo * @brief rx fifo
* @param none * @param none
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_get_rxfifo_notempty(void); bool hal_spi_slave_get_rxfifo_notempty(void);
/** /**
* @brief rx fifo * @brief rx fifo
* @param none * @param none
* @retval true/false * @retval true/false
*/ */
bool hal_spi_slave_read_data(uint32_t *data); bool hal_spi_slave_read_data(uint32_t *data);
/** /**
* @brief tx fifo * @brief tx fifo
* @param none * @param none
* @retval true/false * @retval true/false
*/ */
@ -170,7 +170,7 @@ bool hal_spi_slave_write_data(const uint8_t data);
/************************************************************************** /**************************************************************************
* @name : hal_spi_s_set_high_impedance * @name : hal_spi_s_set_high_impedance
* @brief : SPI IO口设置为高阻态 * @brief : SPI IO口设置为高阻态
* @param[in] : * @param[in] :
* @return : * @return :
* @retval : * @retval :

View File

@ -2,10 +2,10 @@
* *
* *
* File: hal_swire.h * File: hal_swire.h
* Description swire HAL层头文件 * Description swire HAL层头文件
* Version V0.1 * Version V0.1
* Date 2021-03-17 * Date 2021-03-17
* Author wuc * Author wuc
*******************************************************************************/ *******************************************************************************/
#ifndef __HAL_SWIRE_H__ #ifndef __HAL_SWIRE_H__
#define __HAL_SWIRE_H__ #define __HAL_SWIRE_H__
@ -32,43 +32,43 @@
* 5.Global function prototypes * 5.Global function prototypes
*******************************************************************************/ *******************************************************************************/
/** /**
* @brief SWIRE初始化 * @brief SWIRE初始化
* @param * @param
* @retval * @retval
*/ */
void hal_swire_init(void); void hal_swire_init(void);
/** /**
* @brief SWIRE反初始化 * @brief SWIRE反初始化
* @param * @param
* @retval * @retval
*/ */
void hal_swire_deinit(void); void hal_swire_deinit(void);
/** /**
* @brief SWIRE脉冲并开始输出 * @brief SWIRE脉冲并开始输出
* @param start_timeus * @param start_timeus
* @param stop_timeus300us * @param stop_timeus300us
* @param high_timeus * @param high_timeus
* @param low_timeus * @param low_timeus
* @param pulse沿 * @param pulse沿
* @retval * @retval
*/ */
void hal_swire_start(uint32_t start_time, uint32_t stop_time, void hal_swire_start(uint32_t start_time, uint32_t stop_time,
uint32_t high_time, uint32_t low_time, uint32_t high_time, uint32_t low_time,
uint32_t pulse); uint32_t pulse);
/** /**
* @brief * @brief
* @param state * @param state
* @retval * @retval
*/ */
void hal_swire_open(function_state_e state); void hal_swire_open(function_state_e state);
/** /**
* @brief * @brief
* @param cb_func * @param cb_func
* @retval * @retval
*/ */
void hal_swire_register_callback(fcb_type cb_func); void hal_swire_register_callback(fcb_type cb_func);

View File

@ -13,11 +13,81 @@
* 1.Included files * 1.Included files
*******************************************************************************/ *******************************************************************************/
#include "tau_common.h" #include "tau_common.h"
#include "hal_flash.h"
/******************************************************************************* /*******************************************************************************
* 2.Global constant and macro definitions using #define * 2.Global constant and macro definitions using #define
*******************************************************************************/ *******************************************************************************/
/*******************************************************************************
* API兼容宏定义
*******************************************************************************/
/**
* @brief 0xABflash退出deep sleep power mode
* API为hal_flash_release_power_down
* @param none
* @retval null
*/
#define hal_system_flash_release_power_down()\
{\
hal_flash_init();\
hal_flash_release_power_down();\
hal_flash_deinit();\
}
/**
* @brief 0xB9flash进入deep sleep power mode
* API为hal_system_flash_power_down
* @param
* @retval null
*/
#define hal_system_flash_power_down()\
{\
hal_flash_init();\
hal_flash_power_down();\
hal_flash_deinit();\
}
/**
* @brief flash读取数据,1024
* API为hal_flash_normal_read
* @param *usr_cfg_t_addr(),
usr_cfg_t_size(1024)
flash_page 0~63
* @retval bool
*/
#define hal_system_flash_read(usr_cfg_t_addr, usr_cfg_t_size, flash_page)\
({\
bool ret;\
hal_flash_init();\
ret = hal_flash_normal_read(usr_cfg_t_addr, usr_cfg_t_size, 13, flash_page, 0);\
hal_flash_deinit();\
ret;\
})
/**
* @brief flash(),1024
* API为hal_flash_normal_write
* @param *usr_cfg_t_addr(),
usr_cfg_t_size(1024)
01~63
flash_page 0~63
* @retval bool size是否超出
*/
#define hal_system_flash_write(usr_cfg_t_addr, usr_cfg_t_size, flash_page)\
({\
bool ret;\
if(flash_page == 0)\
{\
hal_flash_erase(13);\
}\
hal_flash_init();\
ret = hal_flash_normal_write(usr_cfg_t_addr, usr_cfg_t_size, 13, flash_page, 0);\
hal_flash_deinit();\
ret;\
})
/******************************************************************************* /*******************************************************************************
* 3.Global structures, unions and enumerations using typedef * 3.Global structures, unions and enumerations using typedef
*******************************************************************************/ *******************************************************************************/
@ -122,24 +192,6 @@ void hal_system_set_pvd(bool enable);
*/ */
void hal_system_set_vcc(bool enable); void hal_system_set_vcc(bool enable);
/**
* @brief flash读取数据,1024
* @param *usr_cfg_t_addr(),
usr_cfg_t_size(1024)
flash_page 0~63
* @retval bool
*/
bool hal_system_flash_read(uint8_t *usr_cfg_t_addr, uint16_t usr_cfg_t_size, uint8_t flash_page);
/**
* @brief flash(),1024
* @param *usr_cfg_t_addr(),
usr_cfg_t_size(1024)
01~63
flash_page 0~63
* @retval bool size是否超出
*/
bool hal_system_flash_write(uint8_t *usr_cfg_t_addr, uint16_t usr_cfg_t_size, uint8_t flash_page);
#if defined(ISP_568) || defined(ISP_368) #if defined(ISP_568) || defined(ISP_368)
/** /**
@ -150,4 +202,18 @@ bool hal_system_flash_write(uint8_t *usr_cfg_t_addr, uint16_t usr_cfg_t_size, u
void hal_system_set_phy_calibration(bool en); void hal_system_set_phy_calibration(bool en);
#endif #endif
/**
* @brief debug state
* @param none
* @retval debug state
*/
uint32_t hal_system_get_debug_state(void);
/**
* @brief clear debug state(debug only)
* @param none
* @retval none
*/
void hal_system_clear_debug_state(void);
#endif //__HAL_SYSTEM_H__ #endif //__HAL_SYSTEM_H__

View File

@ -56,6 +56,17 @@ void hal_timer_deinit(timer_num_e index);
*/ */
void hal_timer_start(timer_num_e index, uint32_t ms, fcb_type cb_func, void *data); void hal_timer_start(timer_num_e index, uint32_t ms, fcb_type cb_func, void *data);
/**
* @brief
* @param index(0~3)timer_num_e
* @param ususus级别的
* @param cb_funcNULL
* @param dataNULL
* @retval
*/
void hal_timer_start_ex(timer_num_e index, uint32_t us, fcb_type cb_func, void *data);
/** /**
* @brief * @brief
* @param index(0~3)timer_num_e * @param index(0~3)timer_num_e

View File

@ -79,51 +79,51 @@ typedef enum
* 5.Global function prototypes * 5.Global function prototypes
*******************************************************************************/ *******************************************************************************/
/** /**
* @brief uart * @brief uart
* @param hal_uart_handle_t * @param hal_uart_handle_t
* @retval hal_uart_status * @retval hal_uart_status
*/ */
hal_uart_status hal_uart_init(hal_uart_handle_t *huart); hal_uart_status hal_uart_init(hal_uart_handle_t *huart);
/** /**
* @brief uart口 * @brief uart口
* @param hal_uart_handle_t * @param hal_uart_handle_t
* @retval hal_uart_status * @retval hal_uart_status
*/ */
hal_uart_status hal_uart_deinit(hal_uart_handle_t *huart); hal_uart_status hal_uart_deinit(hal_uart_handle_t *huart);
/** /**
* @brief * @brief
* @param hal_uart_handle_t * @param hal_uart_handle_t
* @param pdata: * @param pdata:
* @param size: * @param size:
* @retval hal_uart_status * @retval hal_uart_status
*/ */
hal_uart_status hal_uart_transmit_blocking(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size); hal_uart_status hal_uart_transmit_blocking(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size);
/** /**
* @brief * @brief
* @param hal_uart_handle_t * @param hal_uart_handle_t
* @param pdata: * @param pdata:
* @param size: * @param size:
* @retval hal_uart_status * @retval hal_uart_status
*/ */
hal_uart_status hal_uart_receive_blocking(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size); hal_uart_status hal_uart_receive_blocking(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size);
/** /**
* @brief 使DMA发送数据TX和RX共用一个DMA TX/RX传输完后才能进行RX/TX的传输 * @brief 使DMA发送数据TX和RX共用一个DMA TX/RX传输完后才能进行RX/TX的传输
* @param hal_uart_handle_t * @param hal_uart_handle_t
* @param pdata: * @param pdata:
* @param size: * @param size:
* @retval hal_uart_status * @retval hal_uart_status
*/ */
hal_uart_status hal_uart_transmit_dma(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size); hal_uart_status hal_uart_transmit_dma(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size);
/** /**
* @brief 使DMA发送数据TX和RX共用一个DMA TX/RX传输完后才能进行RX/TX的传输 * @brief 使DMA发送数据TX和RX共用一个DMA TX/RX传输完后才能进行RX/TX的传输
* @param hal_uart_handle_t * @param hal_uart_handle_t
* @param pdata: * @param pdata:
* @param size: * @param size:
* @retval hal_uart_status * @retval hal_uart_status
*/ */
hal_uart_status hal_uart_receive_dma(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size); hal_uart_status hal_uart_receive_dma(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size);

Binary file not shown.

View File

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