146 lines
5.4 KiB
C
146 lines
5.4 KiB
C
#ifndef _FUNC_H
|
|
#define _FUNC_H
|
|
|
|
#include "func_switching.h"
|
|
#include "func_clock.h"
|
|
#include "func_bt.h"
|
|
#include "func_idle.h"
|
|
#include "func_music.h"
|
|
#include "func_usbdev.h"
|
|
#include "sfunc_record.h"
|
|
#include "sfunc_record_play.h"
|
|
#include "func_lowpwr.h"
|
|
#include "func_update.h"
|
|
#include "func_bt_dut.h"
|
|
|
|
#define TICK_IGNORE_KEY 700 //忽略700ms内的部分消息
|
|
|
|
//task number
|
|
enum {
|
|
FUNC_NULL = 0,
|
|
FUNC_MENU, //主菜单
|
|
FUNC_CLOCK, //时钟表盘
|
|
FUNC_HEARTRATE, //心率
|
|
FUNC_BT, //蓝牙播放器(控制手机音乐)
|
|
FUNC_ALARM_CLOCK, //闹钟
|
|
FUNC_BLOOD_OXYGEN, //血氧
|
|
FUNC_BLOODSUGAR, //血糖
|
|
FUNC_BLOOD_PRESSURE, //血压
|
|
FUNC_BREATHE, //呼吸
|
|
FUNC_CALCULATOR, //计算器
|
|
FUNC_CAMERA, //相机
|
|
FUNC_LIGHT, //亮度调节
|
|
FUNC_TIMER, //计时器
|
|
FUNC_TIMER_SUB_DISP, //计时器--计时显示
|
|
FUNC_TIMER_SUB_CUSTOM, //计时器--自定义
|
|
FUNC_SLEEP, //睡眠
|
|
FUNC_STOPWATCH, //秒表
|
|
FUNC_STOPWATCH_SUB_RECORD, //秒表--秒表记录
|
|
FUNC_WEATHER, //天气
|
|
FUNC_GAME, //游戏
|
|
FUNC_STYLE, //菜单风格
|
|
FUNC_ALTITUDE, //海拔
|
|
FUNC_MAP, //地图
|
|
FUNC_MESSAGE, //消息
|
|
FUNC_SCAN, //扫一扫
|
|
FUNC_VOICE, //语音助手
|
|
FUNC_ALIPAY, //支付宝
|
|
FUNC_COMPASS, //指南针
|
|
FUNC_ADDRESS_BOOK, //电话簿
|
|
FUNC_SPORT, //运动
|
|
FUNC_SPORT_SUB_RUN, //运动--室内跑步
|
|
FUNC_CALL, //电话
|
|
FUNC_FINDPHONE, //寻找手机
|
|
FUNC_CALENDAER, //日历
|
|
FUNC_VOLUME, //音量
|
|
FUNC_ACTIVITY, //活动记录
|
|
FUNC_FLASHLIGHT, //手电筒
|
|
FUNC_SETTING, //设置
|
|
FUNC_SET_SUB_DOUSING, //设置--熄屏
|
|
FUNC_SET_SUB_WRIST, //设置--抬腕
|
|
FUNC_SET_SUB_DISTURD, //设置--勿扰
|
|
FUNC_SET_SUB_SAV, //设置--声音与振动
|
|
FUNC_SET_SUB_LANGUAGE, //设置--语言
|
|
FUNC_LANGUAGE = FUNC_SET_SUB_LANGUAGE,
|
|
FUNC_SET_SUB_TIME, //设置--时间
|
|
FUNC_TIME_SUB_CUSTOM, //调整日期
|
|
FUNC_SET_SUB_PASSWORD, //设置--密码锁
|
|
FUNC_PASSWORD_SUB_DISP, //新密码锁设置
|
|
FUNC_PASSWORD_SUB_SELECT, //确认密码锁
|
|
FUNC_SET_SUB_ABOUT, //设置--关于
|
|
FUNC_SET_SUB_RESTART, //设置--重启
|
|
FUNC_RESTART = FUNC_SET_SUB_RESTART,//重启
|
|
FUNC_SET_SUB_RSTFY, //设置--恢复出厂
|
|
FUNC_RSTFY = FUNC_SET_SUB_RSTFY,
|
|
FUNC_SET_SUB_OFF, //设置--关机
|
|
FUNC_OFF = FUNC_SET_SUB_OFF, //关机
|
|
FUNC_MUSIC,
|
|
FUNC_BTHID,
|
|
FUNC_USBDEV,
|
|
FUNC_AUX,
|
|
FUNC_SPDIF,
|
|
FUNC_SPEAKER,
|
|
FUNC_PWROFF,
|
|
FUNC_SLEEPMODE,
|
|
FUNC_I2S,
|
|
FUNC_BT_DUT,
|
|
FUNC_IDLE,
|
|
|
|
FUNC_LANGUAGE_SUB_CN,
|
|
FUNC_LANGUAGE_SUB_ENG,
|
|
FUNC_LANGUAGE_SUB_FN,
|
|
FUNC_LANGUAGE_SUB_RU,
|
|
FUNC_LANGUAGE_SUB_JP,
|
|
FUNC_LANGUAGE_SUB_PU,
|
|
};
|
|
|
|
//task control block
|
|
typedef struct {
|
|
void *f_cb; //当前任务控制指针
|
|
u32 enter_tick; //记录进入func的tick
|
|
u8 sta; //cur working task number
|
|
u8 last; //lask task number
|
|
u8 menu_style; //菜单样式
|
|
u8 menu_idx; //菜单编号
|
|
u8 sta_break; //被中断的任务
|
|
u8 sort_cnt; //快捷任务个数
|
|
u8 tbl_sort[MAX_FUNC_SORT_CNT]; //快捷任务表
|
|
|
|
void (*mp3_res_play)(u32 addr, u32 len); //各任务的语音播报函数接口
|
|
void (*set_vol_callback)(u8 dir); //设置音量的回调函数,用于各任务的音量事件处理。
|
|
} func_cb_t;
|
|
|
|
|
|
extern func_cb_t func_cb;
|
|
extern const u8 func_sort_table[]; //任务切换排序table
|
|
|
|
ALWAYS_INLINE void func_mp3_res_play(u32 addr, u32 len)
|
|
{
|
|
if (func_cb.mp3_res_play) {
|
|
func_cb.mp3_res_play(addr, len);
|
|
}
|
|
}
|
|
|
|
ALWAYS_INLINE void func_set_vol_callback(u8 dir)
|
|
{
|
|
if (func_cb.set_vol_callback) {
|
|
func_cb.set_vol_callback(dir);
|
|
}
|
|
}
|
|
|
|
void func_run(void);
|
|
compo_form_t *func_create_form(u8 sta); //根据任务名创建窗体
|
|
|
|
void func_switch_prev(bool flag_auto);
|
|
void func_switch_next(bool flag_auto);
|
|
|
|
u8 get_funcs_total(void);
|
|
void func_process(void);
|
|
void func_message(size_msg_t msg);
|
|
void evt_message(size_msg_t msg);
|
|
|
|
compo_textbox_t *func_text_time_create(compo_form_t *frm);
|
|
void func_switching_to_menu(void);
|
|
|
|
#endif // _FUNC_H
|