1433 lines
34 KiB
C
1433 lines
34 KiB
C
|
#if 0
|
|||
|
|
|||
|
#include "lvgl.h"
|
|||
|
#include "img_def.h"
|
|||
|
#include "lv_common_function.h"
|
|||
|
|
|||
|
//=================================================================================
|
|||
|
// dsp dummy function
|
|||
|
enum ipc_user_msg_type_t
|
|||
|
{
|
|||
|
IPC_MSG_M3_INPUT = 12,
|
|||
|
};
|
|||
|
typedef void (*ipc_tx_callback)(uint8_t chn);
|
|||
|
bool audio_algorithm_enable = false;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void ipc_msg_with_payload_send(enum ipc_user_msg_type_t msg,
|
|||
|
void *header,
|
|||
|
uint16_t header_length,
|
|||
|
uint8_t *payload,
|
|||
|
uint16_t payload_length,
|
|||
|
ipc_tx_callback callback)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void dsp_post_operate_to_m3(uint8_t op_cmd,uint8_t *buffer,uint16_t len)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
uint8_t *pvPortMalloc(uint32_t size)
|
|||
|
{
|
|||
|
return NULL;
|
|||
|
}
|
|||
|
void vPortFree(void *buff)
|
|||
|
{
|
|||
|
}
|
|||
|
void co_delay_100us(uint8_t delay)
|
|||
|
{
|
|||
|
}
|
|||
|
//==================================================================================
|
|||
|
#define DSP_FW_VERSION 122
|
|||
|
|
|||
|
extern ui_entry cont_backup;
|
|||
|
static uint8_t left_backup;
|
|||
|
|
|||
|
//cm3 input
|
|||
|
ipc_daily_data_t sync_cm3_data;
|
|||
|
sleep_history_stru sleep_history_data = {0};
|
|||
|
uint8_t sportheartrate_historydata[72] = {0};
|
|||
|
uint8_t heartrate_historydata[48] = {0};
|
|||
|
//----------------------------------------------
|
|||
|
ancs_msg_t msglist;
|
|||
|
call_record_list_t record_list;
|
|||
|
uint8_t call_context[200];
|
|||
|
uint8_t call_list[200];
|
|||
|
uint8_t book_list[10][200];
|
|||
|
|
|||
|
|
|||
|
//==================================================================================
|
|||
|
uint32_t CalcWeekday(stTime_type time)
|
|||
|
{
|
|||
|
|
|||
|
char century_code, year_code, month_code, day_code;
|
|||
|
int week = 0;
|
|||
|
century_code = year_code = month_code = day_code = 0;
|
|||
|
if (time.ucMonth == 1 || time.ucMonth == 2)
|
|||
|
{
|
|||
|
century_code = (time.ucYear - 1) / 100;
|
|||
|
year_code = (time.ucYear - 1) % 100;
|
|||
|
month_code = time.ucMonth + 12;
|
|||
|
day_code = time.ucDate;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
century_code = time.ucYear / 100;
|
|||
|
year_code = time.ucYear % 100;
|
|||
|
month_code = time.ucMonth;
|
|||
|
day_code = time.ucDate;
|
|||
|
}
|
|||
|
/* <20><><EFBFBD>ݲ<EFBFBD><DDB2>չ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
week = year_code + year_code / 4 + century_code / 4 - 2 * century_code + 26 * (month_code + 1) / 10 + day_code - 1;
|
|||
|
week = week > 0 ? (week % 7) : ((week % 7) + 7);
|
|||
|
return week;
|
|||
|
}
|
|||
|
//==================================================================================
|
|||
|
|
|||
|
__attribute__((section("resource_section"))) const pri_ui_entry style_func_arry[] =
|
|||
|
{
|
|||
|
|
|||
|
};
|
|||
|
__attribute__((section("resource_section"))) const uint8_t style_func_id[] =
|
|||
|
{
|
|||
|
|
|||
|
};
|
|||
|
//================================================================
|
|||
|
|
|||
|
|
|||
|
//================================================================
|
|||
|
bool fr_app_UI_return_flag(void)
|
|||
|
{
|
|||
|
}
|
|||
|
//------------------------------------
|
|||
|
//void lv_ui_node_add(lv_obj_t *node_parent,lv_obj_t * obj_scroll,ui_func cur,ui_func next,bool scroll_dir)
|
|||
|
//{
|
|||
|
// //NULL
|
|||
|
//}
|
|||
|
//===================================================================
|
|||
|
//===================================================================
|
|||
|
// do op & data interface here!
|
|||
|
// data
|
|||
|
// time
|
|||
|
uint16_t dsp_get_system_time_year(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.time.ucYear;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_time_month(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.time.ucMonth;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_time_date(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.time.ucDate;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_time_week(void)
|
|||
|
{
|
|||
|
|
|||
|
return CalcWeekday(sync_cm3_data.time);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_time_hour(void)
|
|||
|
{
|
|||
|
uint8_t cur_Hour;
|
|||
|
if (sync_cm3_data.ui_info.time_format)
|
|||
|
{
|
|||
|
if (sync_cm3_data.time.ucHour < 12)
|
|||
|
{
|
|||
|
if (sync_cm3_data.time.ucHour == 0)
|
|||
|
{
|
|||
|
cur_Hour = 12;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
cur_Hour = sync_cm3_data.time.ucHour % 12;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (sync_cm3_data.time.ucHour == 12)
|
|||
|
cur_Hour = 12;
|
|||
|
else
|
|||
|
cur_Hour = sync_cm3_data.time.ucHour - 12;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
cur_Hour = sync_cm3_data.time.ucHour;
|
|||
|
}
|
|||
|
return cur_Hour;
|
|||
|
}
|
|||
|
uint8_t dsp_get_system_time_minute(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.time.ucMinute;
|
|||
|
}
|
|||
|
uint8_t dsp_get_system_time_second(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.time.ucSecond;
|
|||
|
}
|
|||
|
|
|||
|
// cm3 fw version
|
|||
|
uint8_t dsp_get_system_cm3_ver(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.m3_version_new;
|
|||
|
}
|
|||
|
|
|||
|
// dsp fw version
|
|||
|
uint8_t dsp_get_system_dsp_ver(void)
|
|||
|
{
|
|||
|
return DSP_FW_VERSION;
|
|||
|
}
|
|||
|
|
|||
|
// MAC address
|
|||
|
uint8_t *dsp_get_system_mac_address(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ble_address;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_set_system_Wirst_Awake(uint8_t state)
|
|||
|
{
|
|||
|
uint8_t data = state;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_WIRST, &data, 1);
|
|||
|
}
|
|||
|
uint8_t dsp_get_system_Wirst_Awake(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.motion;
|
|||
|
}
|
|||
|
|
|||
|
// no disturb
|
|||
|
void dsp_set_system_no_disturb(uint8_t state)
|
|||
|
{
|
|||
|
uint8_t data = state;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_DISTURB_CONTROL, &data, 1);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_no_disturb(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.disturb_state;
|
|||
|
}
|
|||
|
|
|||
|
// panel power on time
|
|||
|
void dsp_set_system_panel_on_time(uint8_t value)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_panel_on_time(void)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
// language
|
|||
|
void dsp_set_system_language(uint8_t id)
|
|||
|
{
|
|||
|
sync_cm3_data.ui_info.ui_language = id;
|
|||
|
dsp_ipc_cmd = M3_DRIVER_DAILY_DATA;
|
|||
|
ipc_msg_with_payload_send(IPC_MSG_M3_INPUT, &dsp_ipc_cmd, 1, (uint8_t *)&sync_cm3_data, sizeof(ipc_daily_data_t), NULL);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_language(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ui_info.ui_language;
|
|||
|
}
|
|||
|
|
|||
|
// backlight
|
|||
|
void dsp_set_system_backlight(uint8_t id)
|
|||
|
{
|
|||
|
|
|||
|
uint8_t data = id;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_BRIGHT, &data, 1);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_backlight(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ui_info.ui_backlight_brightness;
|
|||
|
}
|
|||
|
|
|||
|
// backlight ON
|
|||
|
static uint8_t display_on = 0;
|
|||
|
void dsp_set_system_backlight_on(uint8_t id)
|
|||
|
{
|
|||
|
display_on = id;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_backlight_on(void)
|
|||
|
{
|
|||
|
return display_on;
|
|||
|
}
|
|||
|
|
|||
|
// clock_id
|
|||
|
void dsp_set_system_watch_face(uint8_t id)
|
|||
|
{
|
|||
|
sync_cm3_data.ui_info.ui_clock_id = id;
|
|||
|
dsp_ipc_cmd = M3_DRIVER_DAILY_DATA;
|
|||
|
ipc_msg_with_payload_send(IPC_MSG_M3_INPUT, &dsp_ipc_cmd, 1, (uint8_t *)&sync_cm3_data, sizeof(ipc_daily_data_t), NULL);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_watch_face(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ui_info.ui_clock_id;
|
|||
|
}
|
|||
|
|
|||
|
// menu sytle
|
|||
|
void dsp_set_system_menu_style(uint8_t id)
|
|||
|
{
|
|||
|
sync_cm3_data.ui_info.ui_menu_style_id = id;
|
|||
|
dsp_ipc_cmd = M3_DRIVER_DAILY_DATA;
|
|||
|
ipc_msg_with_payload_send(IPC_MSG_M3_INPUT, &dsp_ipc_cmd, 1, (uint8_t *)&sync_cm3_data, sizeof(ipc_daily_data_t), NULL);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_menu_style(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ui_info.ui_menu_style_id;
|
|||
|
}
|
|||
|
|
|||
|
// music
|
|||
|
void dsp_set_system_volume_media(uint8_t value)
|
|||
|
{
|
|||
|
uint8_t data = value;
|
|||
|
sync_cm3_data.bt_volume_media = value;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SET_BT_VALUME, &data, 1);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_volume_media(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.bt_volume_media;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_set_system_volume_hfp(uint8_t value)
|
|||
|
{
|
|||
|
uint8_t data = value;
|
|||
|
sync_cm3_data.bt_volume_hfp = value;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SET_BT_VALUME, &data, 1);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_volume_hfp(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.bt_volume_hfp;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_set_system_volume_tone(uint8_t value)
|
|||
|
{
|
|||
|
uint8_t data = value;
|
|||
|
sync_cm3_data.bt_volume_tone = value;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SET_BT_VALUME, &data, 1);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_volume_tone(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.bt_volume_tone;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t *dsp_get_system_music_context(void)
|
|||
|
{
|
|||
|
return NULL;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_music_state(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ui_info.ui_music_state;
|
|||
|
}
|
|||
|
|
|||
|
// ble state
|
|||
|
uint8_t dsp_get_system_ble_state(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ble_state;
|
|||
|
}
|
|||
|
// bt state
|
|||
|
uint8_t dsp_get_system_bt_state(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.bt_state;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_bt_on_off(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.bt_on_off;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_ble_on_off(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ble_on_off;
|
|||
|
}
|
|||
|
|
|||
|
// baterry
|
|||
|
uint8_t dsp_get_system_battery_state(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.battery.state;
|
|||
|
}
|
|||
|
uint8_t dsp_get_system_battery_value(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.battery.battery_value % 6;
|
|||
|
}
|
|||
|
|
|||
|
uint32_t dsp_get_system_step(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.step;
|
|||
|
}
|
|||
|
|
|||
|
uint32_t dsp_get_system_calorie(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.calorie;
|
|||
|
}
|
|||
|
|
|||
|
uint32_t dsp_get_system_distance(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.distance;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_hrm(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.bpm;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_hrm_warning_h(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.bpm_warning_h;
|
|||
|
}
|
|||
|
uint8_t dsp_get_system_hrm_warning_l(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.bpm_warning_l;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_o2_sbp(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sbp;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_o2_dbp(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.dbp;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_o2_spo2(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.spo2;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_blood_h(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.blood_h;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_blood_l(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.blood_l;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t *dsp_get_system_hrm_distory(void)
|
|||
|
{
|
|||
|
return NULL;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t *dsp_get_system_sleep_distory(void)
|
|||
|
{
|
|||
|
return NULL;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_system_sleep_total_time(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sleep_total_time;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_system_sleep_d_time(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.deep_sleep_time;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_system_sleep_l_time(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.light_sleep_time;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_day1_weather_type(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.day1.type > 9)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
else
|
|||
|
return sync_cm3_data.day1.type;
|
|||
|
}
|
|||
|
int16_t centigrade2fahrenhite(int16_t centigrade_data)
|
|||
|
{
|
|||
|
return (centigrade_data * 18 + 320) / 10;
|
|||
|
}
|
|||
|
|
|||
|
int16_t dsp_get_system_day1_weather_temp(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.ui_info.temperature_format)
|
|||
|
return centigrade2fahrenhite(sync_cm3_data.day1.cur_tempture);
|
|||
|
else
|
|||
|
return sync_cm3_data.day1.cur_tempture;
|
|||
|
}
|
|||
|
int16_t dsp_get_system_day1_weather_temp_m(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.ui_info.temperature_format)
|
|||
|
return centigrade2fahrenhite(sync_cm3_data.day1.h_tempture);
|
|||
|
else
|
|||
|
return sync_cm3_data.day1.h_tempture;
|
|||
|
}
|
|||
|
|
|||
|
int16_t dsp_get_system_day1_weather_temp_n(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.ui_info.temperature_format)
|
|||
|
return centigrade2fahrenhite(sync_cm3_data.day1.l_tempture);
|
|||
|
else
|
|||
|
return sync_cm3_data.day1.l_tempture;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_day2_weather_type(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.day2.type > 9)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
else
|
|||
|
return sync_cm3_data.day2.type;
|
|||
|
}
|
|||
|
|
|||
|
int16_t dsp_get_system_day2_weather_temp(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.ui_info.temperature_format)
|
|||
|
return centigrade2fahrenhite(sync_cm3_data.day2.cur_tempture);
|
|||
|
else
|
|||
|
return sync_cm3_data.day2.cur_tempture;
|
|||
|
}
|
|||
|
int16_t dsp_get_system_day2_weather_temp_m(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.ui_info.temperature_format)
|
|||
|
return centigrade2fahrenhite(sync_cm3_data.day2.h_tempture);
|
|||
|
else
|
|||
|
return sync_cm3_data.day2.h_tempture;
|
|||
|
}
|
|||
|
|
|||
|
int16_t dsp_get_system_day2_weather_temp_n(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.ui_info.temperature_format)
|
|||
|
return centigrade2fahrenhite(sync_cm3_data.day2.l_tempture);
|
|||
|
else
|
|||
|
return sync_cm3_data.day2.l_tempture;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_day3_weather_type(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.day3.type > 9)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
else
|
|||
|
return sync_cm3_data.day3.type;
|
|||
|
}
|
|||
|
|
|||
|
int16_t dsp_get_system_day3_weather_temp(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.ui_info.temperature_format)
|
|||
|
return centigrade2fahrenhite(sync_cm3_data.day3.cur_tempture);
|
|||
|
else
|
|||
|
return sync_cm3_data.day3.cur_tempture;
|
|||
|
}
|
|||
|
int16_t dsp_get_system_day3_weather_temp_m(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.ui_info.temperature_format)
|
|||
|
return centigrade2fahrenhite(sync_cm3_data.day3.h_tempture);
|
|||
|
else
|
|||
|
return sync_cm3_data.day3.h_tempture;
|
|||
|
}
|
|||
|
|
|||
|
int16_t dsp_get_system_day3_weather_temp_n(void)
|
|||
|
{
|
|||
|
if (sync_cm3_data.ui_info.temperature_format)
|
|||
|
return centigrade2fahrenhite(sync_cm3_data.day3.l_tempture);
|
|||
|
else
|
|||
|
return sync_cm3_data.day3.l_tempture;
|
|||
|
}
|
|||
|
|
|||
|
// msg
|
|||
|
uint8_t dsp_get_system_msg_total(void)
|
|||
|
{
|
|||
|
return msglist.msg_tatol;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_get_system_msg_time(uint8_t msg_id, uint8_t *buffer)
|
|||
|
{
|
|||
|
uint8_t time[32];
|
|||
|
|
|||
|
memset(buffer, 0, 32);
|
|||
|
memset(time, 0, 32);
|
|||
|
if (msg_id >= msglist.msg_tatol)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
uint8_t *p_data = &msglist.fifo[msg_id];
|
|||
|
memcpy(buffer, p_data + 2, 15);
|
|||
|
if (buffer[0] != 0)
|
|||
|
{
|
|||
|
time[0] = buffer[0];
|
|||
|
time[1] = buffer[1];
|
|||
|
time[2] = buffer[2];
|
|||
|
time[3] = buffer[3];
|
|||
|
time[4] = '/';
|
|||
|
time[5] = buffer[4];
|
|||
|
time[6] = buffer[5];
|
|||
|
time[7] = '/';
|
|||
|
time[8] = buffer[6];
|
|||
|
time[9] = buffer[7];
|
|||
|
|
|||
|
time[10] = ' ';
|
|||
|
time[11] = buffer[9];
|
|||
|
time[12] = buffer[10];
|
|||
|
time[13] = ':';
|
|||
|
time[14] = buffer[11];
|
|||
|
time[15] = buffer[12];
|
|||
|
memcpy(buffer, time, 16);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_msg_type(uint8_t msg_id)
|
|||
|
{
|
|||
|
uint8_t *p_data = &msglist.fifo[msg_id];
|
|||
|
return p_data[0];
|
|||
|
}
|
|||
|
|
|||
|
void dsp_get_system_msg_title(uint8_t msg_id, uint8_t *buffer)
|
|||
|
{
|
|||
|
// memset(buffer, 0, 128);
|
|||
|
// printf("msg_id:%d,msg_tatol:%d\r\n",msg_id,msglist.msg_tatol);
|
|||
|
if (msg_id >= msglist.msg_tatol)
|
|||
|
{
|
|||
|
printf("get msg title error!!\r\n");
|
|||
|
return;
|
|||
|
}
|
|||
|
uint8_t *p_data = &msglist.fifo[msg_id];
|
|||
|
uint8_t title_len = p_data[17];
|
|||
|
memset(buffer, 0, 128);
|
|||
|
memcpy(buffer, p_data + 18, title_len);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_get_system_msg_context(uint8_t msg_id, uint8_t *buffer)
|
|||
|
{
|
|||
|
memset(buffer, 0, 256 * 2);
|
|||
|
if (msg_id >= msglist.msg_tatol)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
uint8_t *p_data = &msglist.fifo[msg_id];
|
|||
|
uint8_t title_len = p_data[17];
|
|||
|
uint8_t context_len = p_data[17 + title_len + 1];
|
|||
|
memcpy(buffer, p_data + 19 + title_len, context_len);
|
|||
|
}
|
|||
|
|
|||
|
// sport
|
|||
|
|
|||
|
uint32_t dsp_get_system_sport_time(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.sport_time;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_sport_type(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.sport_type;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_system_sport_speed(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.speed;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_system_sport_step(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.step;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_system_sport_carlorie(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.carloie;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_system_sport_distcace(void)
|
|||
|
{
|
|||
|
if (dsp_get_system_distance_format())
|
|||
|
return sync_cm3_data.sport.distance * 621 / 1000;
|
|||
|
else
|
|||
|
return sync_cm3_data.sport.distance;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_sport_state(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.state;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_sport_hrm(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.hrm;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_sport_hrm_max(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.max_hrm;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_sport_hrm_min(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.min_hrm;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_sport_oxygen(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.oxygen;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_panel_show_time(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.light_auto_close_time;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_set_system_panel_show_time(uint8_t time)
|
|||
|
{
|
|||
|
uint8_t data = time;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_LIGHT_TIME, &data, 1);
|
|||
|
}
|
|||
|
|
|||
|
uint32_t dsp_get_system_sport_total_time(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.sport_total_time;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_system_sport_total_carlorie(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.total_carloie;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_sport_avg_hrm(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.sport.avg_hrm;
|
|||
|
}
|
|||
|
|
|||
|
//
|
|||
|
//=====================================================================
|
|||
|
// op
|
|||
|
// layer_page
|
|||
|
void dsp_store_ui_scene(uint8_t mode, uint8_t layer, uint8_t page, uint16_t page_cur_x, uint16_t page_cur_y)
|
|||
|
{
|
|||
|
sync_cm3_data.ui_info.ui_mode = mode;
|
|||
|
if (layer == 4)
|
|||
|
{
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_id = page;
|
|||
|
lv_log_on(" mode %d , layer 4, page %d,\n", sync_cm3_data.ui_info.ui_mode, sync_cm3_data.ui_info.layer4.ui_page_id);
|
|||
|
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_id |= UI_LAYER_ACTIVE_TAG;
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_cur_x = page_cur_x;
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_cur_y = page_cur_y;
|
|||
|
}
|
|||
|
else if (layer == 3)
|
|||
|
{
|
|||
|
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_id = 0;
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_cur_x = 0;
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_cur_y = 0;
|
|||
|
|
|||
|
sync_cm3_data.ui_info.layer3.ui_page_id = page;
|
|||
|
lv_log_on(" mode %d , layer 3, page %d,\n", sync_cm3_data.ui_info.ui_mode, sync_cm3_data.ui_info.layer3.ui_page_id);
|
|||
|
sync_cm3_data.ui_info.layer3.ui_page_id |= UI_LAYER_ACTIVE_TAG;
|
|||
|
sync_cm3_data.ui_info.layer3.ui_page_cur_x = page_cur_x;
|
|||
|
sync_cm3_data.ui_info.layer3.ui_page_cur_y = page_cur_y;
|
|||
|
}
|
|||
|
else if (layer == 2)
|
|||
|
{
|
|||
|
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_id = 0;
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_cur_x = 0;
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_cur_y = 0;
|
|||
|
|
|||
|
sync_cm3_data.ui_info.layer3.ui_page_id = 0;
|
|||
|
sync_cm3_data.ui_info.layer3.ui_page_cur_x = 0;
|
|||
|
sync_cm3_data.ui_info.layer3.ui_page_cur_y = 0;
|
|||
|
|
|||
|
sync_cm3_data.ui_info.layer2.ui_page_id = page;
|
|||
|
lv_log_on(" mode %d , layer 2, page %d,\n", sync_cm3_data.ui_info.ui_mode, sync_cm3_data.ui_info.layer2.ui_page_id);
|
|||
|
sync_cm3_data.ui_info.layer2.ui_page_id |= UI_LAYER_ACTIVE_TAG;
|
|||
|
sync_cm3_data.ui_info.layer2.ui_page_cur_x = page_cur_x;
|
|||
|
sync_cm3_data.ui_info.layer2.ui_page_cur_y = page_cur_y;
|
|||
|
}
|
|||
|
else if (layer == 1)
|
|||
|
{
|
|||
|
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_id = 0;
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_cur_x = 0;
|
|||
|
sync_cm3_data.ui_info.layer4.ui_page_cur_y = 0;
|
|||
|
|
|||
|
sync_cm3_data.ui_info.layer3.ui_page_id = 0;
|
|||
|
sync_cm3_data.ui_info.layer3.ui_page_cur_x = 0;
|
|||
|
sync_cm3_data.ui_info.layer3.ui_page_cur_y = 0;
|
|||
|
|
|||
|
sync_cm3_data.ui_info.layer2.ui_page_id = 0;
|
|||
|
sync_cm3_data.ui_info.layer2.ui_page_cur_x = 0;
|
|||
|
sync_cm3_data.ui_info.layer2.ui_page_cur_y = 0;
|
|||
|
|
|||
|
sync_cm3_data.ui_info.layer1.ui_page_id = page;
|
|||
|
lv_log_on(" mode %d , layer 1, page %d,\n", sync_cm3_data.ui_info.ui_mode, sync_cm3_data.ui_info.layer1.ui_page_id);
|
|||
|
sync_cm3_data.ui_info.layer1.ui_page_id |= UI_LAYER_ACTIVE_TAG;
|
|||
|
sync_cm3_data.ui_info.layer1.ui_page_cur_x = page_cur_x;
|
|||
|
sync_cm3_data.ui_info.layer1.ui_page_cur_y = page_cur_y;
|
|||
|
}
|
|||
|
|
|||
|
dsp_ipc_cmd = M3_DRIVER_DAILY_DATA;
|
|||
|
ipc_msg_with_payload_send(IPC_MSG_M3_INPUT, &dsp_ipc_cmd, 1, (uint8_t *)&sync_cm3_data, sizeof(ipc_daily_data_t), NULL);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_set_ui_scene_default_style(uint8_t type)
|
|||
|
{
|
|||
|
sync_cm3_data.ui_info.ui_default_style = type;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_ui_scene_default_style(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ui_info.ui_default_style;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_panel_state(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.panel_state;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_ui_scene_mode(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ui_info.ui_mode;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_ui_scene_prev_mode(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ui_info.ui_prev_mode;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_ui_scene_layer(void)
|
|||
|
{
|
|||
|
uint16_t layer = 0;
|
|||
|
if (sync_cm3_data.ui_info.layer4.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
layer = 4;
|
|||
|
}
|
|||
|
else if (sync_cm3_data.ui_info.layer3.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
layer = 3;
|
|||
|
}
|
|||
|
else if (sync_cm3_data.ui_info.layer2.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
layer = 2;
|
|||
|
}
|
|||
|
else // if(sync_cm3_data.ui_info.layer1.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
layer = 1;
|
|||
|
}
|
|||
|
|
|||
|
return layer;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_ui_scene_page_by_layer(uint8_t layer)
|
|||
|
{
|
|||
|
uint8_t ret = 0;
|
|||
|
if (layer == 4)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer4.ui_page_id & (~UI_LAYER_ACTIVE_TAG);
|
|||
|
}
|
|||
|
else if (layer == 3)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer3.ui_page_id & (~UI_LAYER_ACTIVE_TAG);
|
|||
|
}
|
|||
|
else if (layer == 2)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer2.ui_page_id & (~UI_LAYER_ACTIVE_TAG);
|
|||
|
}
|
|||
|
else if (layer == 1)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer1.ui_page_id & (~UI_LAYER_ACTIVE_TAG);
|
|||
|
}
|
|||
|
|
|||
|
return ret;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_ui_scene_cur_x(void)
|
|||
|
{
|
|||
|
|
|||
|
uint16_t ret;
|
|||
|
if (sync_cm3_data.ui_info.layer4.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer4.ui_page_cur_x;
|
|||
|
}
|
|||
|
else if (sync_cm3_data.ui_info.layer3.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer3.ui_page_cur_x;
|
|||
|
}
|
|||
|
else if (sync_cm3_data.ui_info.layer2.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer2.ui_page_cur_x;
|
|||
|
}
|
|||
|
else // if(sync_cm3_data.ui_info.layer1.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer1.ui_page_cur_x;
|
|||
|
}
|
|||
|
|
|||
|
return ret;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_ui_scene_cur_y(void)
|
|||
|
{
|
|||
|
uint16_t ret;
|
|||
|
if (sync_cm3_data.ui_info.layer4.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer4.ui_page_cur_y;
|
|||
|
}
|
|||
|
else if (sync_cm3_data.ui_info.layer3.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer3.ui_page_cur_y;
|
|||
|
}
|
|||
|
else if (sync_cm3_data.ui_info.layer2.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer2.ui_page_cur_y;
|
|||
|
}
|
|||
|
else // if(sync_cm3_data.ui_info.layer1.ui_page_id & UI_LAYER_ACTIVE_TAG)
|
|||
|
{
|
|||
|
ret = sync_cm3_data.ui_info.layer1.ui_page_cur_y;
|
|||
|
}
|
|||
|
|
|||
|
return ret;
|
|||
|
}
|
|||
|
|
|||
|
// end ui function
|
|||
|
|
|||
|
void dsp_turn_on_ble(void)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
void dsp_turn_off_ble(void)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
void dsp_turn_on_bt(void)
|
|||
|
{
|
|||
|
|
|||
|
uint8_t data = 1;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_BT_SWATCH, &data, 1);
|
|||
|
dsp_op_system_timer_delay(100);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_turn_off_bt(void)
|
|||
|
{
|
|||
|
|
|||
|
uint8_t data = 0;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_BT_SWATCH, &data, 1);
|
|||
|
dsp_op_system_timer_delay(100);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_system_shut_down(void)
|
|||
|
{
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SYSTEM_SHUTDOWN, NULL, 0);
|
|||
|
}
|
|||
|
void dsp_op_system_reset(void)
|
|||
|
{
|
|||
|
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SYSTEM_RESET, NULL, 0);
|
|||
|
}
|
|||
|
void dsp_op_system_reboot(void)
|
|||
|
{
|
|||
|
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SYSTEM_REBOOT, NULL, 0);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_system_music_play(void)
|
|||
|
{
|
|||
|
uint8_t data = 1;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_MUSIC_CONTROL, &data, 1);
|
|||
|
}
|
|||
|
void dsp_op_system_music_stop(void)
|
|||
|
{
|
|||
|
|
|||
|
uint8_t data = 0;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_MUSIC_CONTROL, &data, 1);
|
|||
|
}
|
|||
|
void dsp_op_system_music_prev(void)
|
|||
|
{
|
|||
|
|
|||
|
uint8_t data = 2;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_MUSIC_CONTROL, &data, 1);
|
|||
|
}
|
|||
|
void dsp_op_system_music_next(void)
|
|||
|
{
|
|||
|
|
|||
|
uint8_t data = 3;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_MUSIC_CONTROL, &data, 1);
|
|||
|
}
|
|||
|
|
|||
|
extern bool coming_call_ok;
|
|||
|
extern bool call_flag;
|
|||
|
void dsp_op_system_call_out(uint8_t *number, uint8_t len)
|
|||
|
{
|
|||
|
coming_call_ok = true;
|
|||
|
call_flag = true;
|
|||
|
memset(call_context, 0, 200);
|
|||
|
memcpy(call_context, number, len);
|
|||
|
|
|||
|
// sync_cm3_data.ui_info.ui_prev_mode = sync_cm3_data.ui_info.ui_mode;
|
|||
|
// dsp_ipc_cmd = M3_DRIVER_DAILY_DATA;
|
|||
|
// ipc_msg_with_payload_send(IPC_MSG_M3_INPUT, &dsp_ipc_cmd,1,(uint8_t *)&sync_cm3_data,sizeof(ipc_daily_data_t),NULL);
|
|||
|
|
|||
|
uint8_t *buffer = pvPortMalloc(len + 3);
|
|||
|
if (buffer != NULL)
|
|||
|
{
|
|||
|
buffer[0] = 'D';
|
|||
|
buffer[1] = 'A';
|
|||
|
memcpy(buffer + 2, number, len + 1);
|
|||
|
|
|||
|
// dsp_ipc_cmd = M3_DRIVER_CALLING;
|
|||
|
// ipc_msg_with_payload_send(IPC_MSG_M3_INPUT, &dsp_ipc_cmd,1,buffer,len+3,NULL);
|
|||
|
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_CALL_CONTROL, buffer, len + 3);
|
|||
|
|
|||
|
vPortFree(buffer);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_get_current_call(call_info_t *call)
|
|||
|
{
|
|||
|
if (call_context[0] > 0)
|
|||
|
{
|
|||
|
call->number_len = call_context[0];
|
|||
|
memset(call->call_namber, 0, 32);
|
|||
|
memcpy(call->call_namber, call_context + 1, call->number_len);
|
|||
|
call->name_len = call_context[call->number_len] + 1;
|
|||
|
memset(call->call_name, 0, 128);
|
|||
|
memcpy(call->call_name, call_context + call->number_len + 1, call->name_len);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_get_call_from_story(call_info_t *call, uint16_t id)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_op_dial_from_book(uint16_t id)
|
|||
|
{
|
|||
|
uint8_t buffer[2];
|
|||
|
buffer[0] = id >> 8;
|
|||
|
buffer[1] = id;
|
|||
|
// dsp_post_operate_to_m3(DSP_EVT_READ_PHONE_BOOK_LIST,buffer,2);
|
|||
|
// co_delay_100us(500);
|
|||
|
if (call_list[0] > 0)
|
|||
|
{
|
|||
|
memcpy(call_context, &book_list[id][0], 200);
|
|||
|
|
|||
|
if (call_context[0] < 3)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
bool namber_is_ok = true;
|
|||
|
for (uint8_t i = 1; i <= call_context[0]; i++)
|
|||
|
{
|
|||
|
if ((call_context[i] >= '0') && (call_context[i] <= '9'))
|
|||
|
{
|
|||
|
}
|
|||
|
else if (call_context[i] == '+') // area number
|
|||
|
{
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
namber_is_ok = false;
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (namber_is_ok)
|
|||
|
{
|
|||
|
coming_call_ok = true;
|
|||
|
call_flag = true;
|
|||
|
|
|||
|
uint8_t *buffer = pvPortMalloc(call_context[0] + 3);
|
|||
|
if (buffer != NULL)
|
|||
|
{
|
|||
|
buffer[0] = 'D';
|
|||
|
buffer[1] = 'A';
|
|||
|
memcpy(buffer + 2, call_context, call_context[0] + 1);
|
|||
|
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_CALL_CONTROL, buffer, call_context[0] + 3);
|
|||
|
|
|||
|
vPortFree(buffer);
|
|||
|
}
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
bool get_phone_book_flag = false;
|
|||
|
bool phone_book_is_bank_flag = true;
|
|||
|
void dsp_op_get_call_from_book(call_info_t *call, uint16_t id)
|
|||
|
{
|
|||
|
uint8_t buffer[2];
|
|||
|
buffer[0] = id >> 8;
|
|||
|
buffer[1] = id;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_READ_PHONE_BOOK_LIST, buffer, 2);
|
|||
|
get_phone_book_flag = true;
|
|||
|
uint16_t counter = 0;
|
|||
|
while (get_phone_book_flag)
|
|||
|
{
|
|||
|
co_delay_100us(1);
|
|||
|
counter++;
|
|||
|
if (counter > 1000)
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
if (call_list[0] > 0)
|
|||
|
{
|
|||
|
call->number_len = call_list[0];
|
|||
|
memset(call->call_namber, 0, 32);
|
|||
|
memcpy(call->call_namber, call_list + 1, call->number_len);
|
|||
|
call->name_len = call_list[call->number_len] + 1;
|
|||
|
memset(call->call_name, 0, 128);
|
|||
|
memcpy(call->call_name, call_list + call->number_len + 1, call->name_len);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_sync_phone_book(void)
|
|||
|
{
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_LOAD_PHONE_BOOK, NULL, 0);
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_op_get_phone_book_id_offset(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.phone_book_id_offset;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_op_set_phone_book_id_offset(uint16_t id_offset)
|
|||
|
{
|
|||
|
uint8_t buffer[2];
|
|||
|
buffer[0] = id_offset >> 8;
|
|||
|
buffer[1] = id_offset;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SET_PHONE_BOOK_ID_OFFSET, buffer, 2);
|
|||
|
// dsp_op_system_timer_delay(2000);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_enable_mic(void)
|
|||
|
{
|
|||
|
sync_cm3_data.audio_mic_on = 1;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_MIC_OPEN, NULL, 0);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_disable_mic(void)
|
|||
|
{
|
|||
|
|
|||
|
sync_cm3_data.audio_mic_on = 0;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_MIC_MUTE, NULL, 0);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_mic_state(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.audio_mic_on;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_set_system_alarm(_clockTime *alarm, uint8_t alarm_id)
|
|||
|
{
|
|||
|
uint8_t buffer[5];
|
|||
|
buffer[0] = alarm_id;
|
|||
|
buffer[1] = alarm->flag;
|
|||
|
buffer[2] = alarm->hour;
|
|||
|
buffer[3] = alarm->minute;
|
|||
|
buffer[4] = alarm->weekday;
|
|||
|
|
|||
|
sync_cm3_data.alarm[alarm_id].flag = alarm->flag;
|
|||
|
sync_cm3_data.alarm[alarm_id].hour = alarm->hour;
|
|||
|
sync_cm3_data.alarm[alarm_id].minute = alarm->minute;
|
|||
|
sync_cm3_data.alarm[alarm_id].weekday = alarm->weekday;
|
|||
|
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_ALARM, buffer, 5);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_get_system_alarm(_clockTime *alarm, uint8_t alarm_id)
|
|||
|
{
|
|||
|
alarm->flag = sync_cm3_data.alarm[alarm_id].flag;
|
|||
|
alarm->hour = sync_cm3_data.alarm[alarm_id].hour;
|
|||
|
alarm->minute = sync_cm3_data.alarm[alarm_id].minute;
|
|||
|
alarm->weekday = sync_cm3_data.alarm[alarm_id].weekday;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_system_call_ok(void)
|
|||
|
{
|
|||
|
coming_call_ok = true;
|
|||
|
uint8_t buffer[2];
|
|||
|
buffer[0] = 'C';
|
|||
|
buffer[1] = 'A';
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_CALL_CONTROL, buffer, 2);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_system_call_reject(void)
|
|||
|
{
|
|||
|
call_flag = false;
|
|||
|
coming_call_ok = false;
|
|||
|
uint8_t buffer[2];
|
|||
|
buffer[0] = 'C';
|
|||
|
buffer[1] = 'B';
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_CALL_CONTROL, buffer, 2);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_read_cm3_record_list(void)
|
|||
|
{
|
|||
|
dsp_ipc_cmd = M3_DRIVER_CAllLIST_INFO;
|
|||
|
ipc_msg_with_payload_send(IPC_MSG_M3_INPUT, &dsp_ipc_cmd, 1, (uint8_t *)&sync_cm3_data, sizeof(ipc_daily_data_t), NULL);
|
|||
|
|
|||
|
get_phone_book_flag = true;
|
|||
|
uint16_t counter = 0;
|
|||
|
while (get_phone_book_flag)
|
|||
|
{
|
|||
|
co_delay_100us(1);
|
|||
|
counter++;
|
|||
|
if (counter > 1000)
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_get_call_from_record_list(call_info_t *call, uint8_t *call_context)
|
|||
|
{
|
|||
|
memcpy(call_list, call_context, CALL_NUMBER_MAX_LEN - 1);
|
|||
|
call->number_len = call_list[0];
|
|||
|
memset(call->call_namber, 0, 32);
|
|||
|
memcpy(call->call_namber, call_list + 1, call->number_len);
|
|||
|
call->name_len = call_list[call->number_len] + 1;
|
|||
|
memset(call->call_name, 0, 128);
|
|||
|
memcpy(call->call_name, call_list + call->number_len + 1, call->name_len);
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_record_total(void)
|
|||
|
{
|
|||
|
return record_list.call_record_total;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_sports_start(uint8_t mode)
|
|||
|
{
|
|||
|
uint8_t buffer[2];
|
|||
|
buffer[0] = 1; // start
|
|||
|
buffer[1] = mode;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SPORTS, buffer, 2);
|
|||
|
sync_cm3_data.sport.sport_type = mode;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_sports_stop(uint8_t mode)
|
|||
|
{
|
|||
|
uint8_t buffer[2];
|
|||
|
buffer[0] = 0; // stop
|
|||
|
buffer[1] = mode;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SPORTS, buffer, 2);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_sports_pause(uint8_t mode)
|
|||
|
{
|
|||
|
uint8_t buffer[2];
|
|||
|
buffer[0] = 2; // pause
|
|||
|
buffer[1] = mode;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SPORTS, buffer, 2);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_read_cm3_msg(void)
|
|||
|
{
|
|||
|
dsp_ipc_cmd = M3_DRIVER_MESSAGE_INFO;
|
|||
|
ipc_msg_with_payload_send(IPC_MSG_M3_INPUT, &dsp_ipc_cmd, 1, (uint8_t *)&sync_cm3_data, sizeof(ipc_daily_data_t), NULL);
|
|||
|
}
|
|||
|
void dsp_op_system_timer_delay(uint16_t n)
|
|||
|
{
|
|||
|
co_delay_100us(n);
|
|||
|
}
|
|||
|
void dsp_op_system_hrm_start(void)
|
|||
|
{
|
|||
|
uint8_t cmd = 1;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_HEART, &cmd, 1);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_op_system_hrm_stop(void)
|
|||
|
{
|
|||
|
uint8_t buffer[2];
|
|||
|
buffer[0] = 0;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_HEART, buffer, 1);
|
|||
|
// buffer[0] = 0; //0 heart //1 blood //2 oxygen
|
|||
|
// buffer[1] = dsp_get_system_hrm();
|
|||
|
// dsp_post_operate_to_m3(DSP_EVT_SYNC_HERAT_BLOOD_OXYGEN,buffer,2);
|
|||
|
}
|
|||
|
//----------------------
|
|||
|
// new add
|
|||
|
void dsp_clear_system_light_time(void)
|
|||
|
{
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_CLEAR_LIGHT_TIME, NULL, 1);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_take_picture(void)
|
|||
|
{
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_CAMERA, NULL, 1);
|
|||
|
}
|
|||
|
void dsp_search_phone(void)
|
|||
|
{
|
|||
|
uint8_t data = 0x01;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_FIND, &data, 1);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_set_system_version(void)
|
|||
|
{
|
|||
|
uint8_t data[2];
|
|||
|
data[0] = (uint8_t)DSP_FW_VERSION << 8;
|
|||
|
data[1] = (uint8_t)DSP_FW_VERSION;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_DSP_VERSION, &data, 2);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_set_system_sleep_history_cmd(void)
|
|||
|
{
|
|||
|
uint8_t data = 0x02;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_GET_HISTORY_DATA, &data, 1);
|
|||
|
}
|
|||
|
|
|||
|
sleep_history_stru *dsp_get_system_sleep_history(void)
|
|||
|
{
|
|||
|
return &sleep_history_data;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t *dsp_get_system_sport_heartrate_history(void)
|
|||
|
{
|
|||
|
return sportheartrate_historydata;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_set_system_heartrate_history_cmd(void)
|
|||
|
{
|
|||
|
uint8_t data = 0x01;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_GET_HISTORY_DATA, &data, 1);
|
|||
|
}
|
|||
|
uint8_t *dsp_get_system_heartrate_history(void)
|
|||
|
{
|
|||
|
return heartrate_historydata;
|
|||
|
}
|
|||
|
|
|||
|
uint16_t dsp_get_system_step_target(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.steptarget;
|
|||
|
}
|
|||
|
uint8_t dsp_get_system_camera_state(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.camera_state;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_set_system_low_power_state(uint8_t state)
|
|||
|
{
|
|||
|
sync_cm3_data.low_power_state = state;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_LOW_POWER_MODE, &sync_cm3_data.low_power_state, 1);
|
|||
|
}
|
|||
|
uint8_t dsp_get_system_low_power_state(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.low_power_state;
|
|||
|
}
|
|||
|
|
|||
|
void dsp_set_system_new_language(uint8_t id)
|
|||
|
{
|
|||
|
sync_cm3_data.ui_info.ui_language = id;
|
|||
|
uint8_t data = id;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_SYSTEM_LANGUAGE, &data, 1);
|
|||
|
}
|
|||
|
void dsp_set_system_countdown_timer(uint8_t cmd, uint32_t time_value)
|
|||
|
{
|
|||
|
uint8_t data[5];
|
|||
|
data[0] = cmd;
|
|||
|
if ((cmd == 1) || (cmd == 2))
|
|||
|
{
|
|||
|
data[1] = (uint8_t)(time_value >> 24);
|
|||
|
data[2] = (uint8_t)(time_value >> 16);
|
|||
|
data[3] = (uint8_t)(time_value >> 8);
|
|||
|
data[4] = (uint8_t)time_value;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_TIMER_TIME, &data, 5);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_TIMER_TIME, &data, 1);
|
|||
|
}
|
|||
|
}
|
|||
|
uint32_t dsp_get_system_countdown_timer(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.count_down_counter;
|
|||
|
}
|
|||
|
uint8_t dsp_get_system_countdown_timer_state(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.count_down_counter_state;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_temperature_format(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ui_info.temperature_format;
|
|||
|
}
|
|||
|
|
|||
|
uint8_t dsp_get_system_watch_hrm_value(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.watch_hrm_value;
|
|||
|
}
|
|||
|
uint8_t dsp_get_ui_remind_index(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.remind_index;
|
|||
|
}
|
|||
|
void dsp_get_system_win_title(uint8_t msg_id, uint8_t *buffer)
|
|||
|
{
|
|||
|
memset(buffer, 0, 128);
|
|||
|
uint8_t *p_data = &msglist.fifo[msg_id];
|
|||
|
uint8_t title_len = p_data[17];
|
|||
|
memcpy(buffer, p_data + 18, title_len);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_get_system_win_context(uint8_t msg_id, uint8_t *buffer)
|
|||
|
{
|
|||
|
memset(buffer, 0, 256 * 2);
|
|||
|
uint8_t *p_data = &msglist.fifo[msg_id];
|
|||
|
uint8_t title_len = p_data[17];
|
|||
|
uint8_t context_len = p_data[17 + title_len + 1];
|
|||
|
memcpy(buffer, p_data + 19 + title_len, context_len);
|
|||
|
}
|
|||
|
|
|||
|
void dsp_set_system_test_cmd(uint8_t cmd)
|
|||
|
{
|
|||
|
if ((cmd & 0x0f) <= 2)
|
|||
|
{
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_GET_TEST_DATA, &cmd, 1);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
uint8_t data_buff[2];
|
|||
|
data_buff[0] = cmd & 0x7f;
|
|||
|
data_buff[1] = cmd >> 7;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_GET_TEST_DATA, &data_buff, 2);
|
|||
|
}
|
|||
|
}
|
|||
|
static uint8_t stopwatch_state;
|
|||
|
void dsp_set_system_stopwatch_status(uint8_t cmd_status)
|
|||
|
{
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_WATCHSTOP_TIME, &cmd_status, 1);
|
|||
|
stopwatch_state = cmd_status;
|
|||
|
}
|
|||
|
uint8_t dsp_get_system_stopwatch_status(void)
|
|||
|
{
|
|||
|
return stopwatch_state;
|
|||
|
}
|
|||
|
uint8_t dsp_get_system_distance_format(void)
|
|||
|
{
|
|||
|
return sync_cm3_data.ui_info.distance_format;
|
|||
|
}
|
|||
|
void dsp_set_breathe_work(uint8_t breathe_work)
|
|||
|
{
|
|||
|
uint8_t data[2];
|
|||
|
data[0] = 1;
|
|||
|
data[1] = breathe_work;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_BREATHE, &data, 2);
|
|||
|
}
|
|||
|
void dsp_breathe_state_cut(uint8_t breathe_state)
|
|||
|
{
|
|||
|
uint8_t data[2];
|
|||
|
data[0] = breathe_state;
|
|||
|
data[1] = 0;
|
|||
|
dsp_post_operate_to_m3(DSP_EVT_BREATHE, &data, 2);
|
|||
|
}
|
|||
|
|
|||
|
#endif
|