mcu_ab568x/app/platform/bsp/bsp_cm.c
2025-05-30 18:03:10 +08:00

39 lines
1.0 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "include.h"
#include "func.h"
#include "app_variable.h"
#define TRACE_EN 0
#if TRACE_EN
#define TRACE(...) printf(__VA_ARGS__)
#else
#define TRACE(...)
#endif
///CM Init时判断该Page参数是否有效有效则加载
bool cm_loadparam(void *buff, uint page)
{
return true;
}
///CM Init时如果找不到有效的参数则进行出厂值设置
void cm_factory(void *buff, uint page)
{
u8 *buf = buff;
memset(buf, 0, 250);
TRACE("cm_factory: %d\n", page);
if (page == SYS_CM_PAGE_NUM) {
//系统参数初始化
sys_cb.vol = SYS_INIT_VOLUME;
sys_cb.hfp_vol = SYS_INIT_VOLUME / sys_cb.hfp2sys_mul;
sys_cb.lang_id = LANG_SELECT;
#if defined(TJD_SET_PUSH_DIAL_FLAH_TO_BUILT_IN_DIAL_FLASH)
sys_cb.ble_dial_updated = 0;
#endif
buf[PARAM_SYS_VOL] = sys_cb.vol;
//buf[PARAM_HSF_VOL] = sys_cb.hfp_vol;
buf[PARAM_LANG_ID] = sys_cb.lang_id;
PUT_LE32(buf + PARAM_RANDOM_KEY, sys_get_rand_key());
}
}