119 lines
2.2 KiB
C
119 lines
2.2 KiB
C
#include "app_config.h"
|
|
#include "key_event_deal.h"
|
|
#include "system/includes.h"
|
|
#include "tone_player.h"
|
|
#include "app_task.h"
|
|
#include "tone_player.h"
|
|
#include "media/includes.h"
|
|
#include "system/sys_time.h"
|
|
#include "alarm.h"
|
|
#include "clock_cfg.h"
|
|
|
|
|
|
/*************************************************************
|
|
此文件函数主要是rtc模式按键处理和事件处理
|
|
|
|
**************************************************************/
|
|
|
|
|
|
#if TCFG_APP_RTC_EN
|
|
|
|
|
|
|
|
#define LOG_TAG_CONST APP_RTC
|
|
#define LOG_TAG "[APP_RTC]"
|
|
#define LOG_ERROR_ENABLE
|
|
#define LOG_DEBUG_ENABLE
|
|
#define LOG_INFO_ENABLE
|
|
/* #define LOG_DUMP_ENABLE */
|
|
#define LOG_CLI_ENABLE
|
|
#include "debug.h"
|
|
|
|
|
|
struct rtc_opr {
|
|
void *dev_handle;
|
|
u8 rtc_set_mode;
|
|
u8 rtc_pos;
|
|
u8 alm_enable;
|
|
u8 alm_num;
|
|
struct sys_time set_time;
|
|
};
|
|
|
|
|
|
static struct rtc_opr *__this = NULL;
|
|
static u8 switch_to_rtc_reason = 0;
|
|
|
|
|
|
static void rtc_app_init()
|
|
{
|
|
if (!__this) {
|
|
__this = zalloc(sizeof(struct rtc_opr));
|
|
ASSERT(__this, "%s %di \n", __func__, __LINE__);
|
|
__this->dev_handle = dev_open("rtc", NULL);
|
|
if (!__this->dev_handle) {
|
|
ASSERT(0, "%s %d \n", __func__, __LINE__);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//*----------------------------------------------------------------------------*/
|
|
/**@brief rtc 退出
|
|
@param 无
|
|
@return
|
|
@note
|
|
*/
|
|
/*----------------------------------------------------------------------------*/
|
|
static void rtc_task_close()
|
|
{
|
|
if (__this) {
|
|
if (__this->dev_handle) {
|
|
dev_close(__this->dev_handle);
|
|
__this->dev_handle = NULL;
|
|
}
|
|
free(__this);
|
|
__this = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
//*----------------------------------------------------------------------------*/
|
|
/**@brief rtc 启动
|
|
@param 无
|
|
@return
|
|
@note
|
|
*/
|
|
/*----------------------------------------------------------------------------*/
|
|
void rtc_task_start()
|
|
{
|
|
rtc_app_init();
|
|
}
|
|
|
|
|
|
|
|
//*----------------------------------------------------------------------------*/
|
|
/**@brief rtc 主任务
|
|
@param 无
|
|
@return 无
|
|
@note
|
|
*/
|
|
/*----------------------------------------------------------------------------*/
|
|
void app_rtc_task()
|
|
{
|
|
rtc_task_start();
|
|
}
|
|
|
|
#else
|
|
|
|
|
|
void app_rtc_task()
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|