75 lines
1.2 KiB
C
75 lines
1.2 KiB
C
#include "include.h"
|
|
#include "func.h"
|
|
#include "func_bt.h"
|
|
|
|
typedef struct f_bt_t_ {
|
|
|
|
} f_bt_t;
|
|
|
|
void func_bt_init(void)
|
|
{
|
|
if (!bt_cb.bt_is_inited) {
|
|
msg_queue_clear();
|
|
dis_auto_pwroff();
|
|
bsp_bt_init();
|
|
bt_cb.bt_is_inited = 1;
|
|
}
|
|
}
|
|
|
|
void func_bt_chk_off(void)
|
|
{
|
|
if ((func_cb.sta != FUNC_BT) && (bt_cb.bt_is_inited)) {
|
|
bt_disconnect(1);
|
|
bt_off();
|
|
bt_cb.bt_is_inited = 0;
|
|
}
|
|
}
|
|
|
|
void func_bt_process(void)
|
|
{
|
|
func_process();
|
|
|
|
if(sys_cb.pwroff_delay == 0) {
|
|
func_cb.sta = FUNC_PWROFF;
|
|
return;
|
|
}
|
|
}
|
|
|
|
//蓝牙音乐消息处理
|
|
static void func_bt_message(size_msg_t msg)
|
|
{
|
|
switch (msg) {
|
|
default:
|
|
func_message(msg);
|
|
break;
|
|
}
|
|
}
|
|
|
|
void func_bt_enter(void)
|
|
{
|
|
func_cb.f_cb = func_zalloc(sizeof(f_bt_t));
|
|
}
|
|
|
|
void func_bt_exit(void)
|
|
{
|
|
#if !BT_BACKSTAGE_EN
|
|
bt_disconnect(1);
|
|
bt_off();
|
|
bt_cb.bt_is_inited = 0;
|
|
#endif
|
|
|
|
bt_cb.rec_pause = 0;
|
|
func_cb.last = FUNC_BT;
|
|
}
|
|
|
|
void func_bt(void)
|
|
{
|
|
printf("%s\n", __func__);
|
|
func_bt_enter();
|
|
while (func_cb.sta == FUNC_BT) {
|
|
func_bt_process();
|
|
func_bt_message(msg_dequeue());
|
|
}
|
|
func_bt_exit();
|
|
}
|