73 lines
1.6 KiB
C
73 lines
1.6 KiB
C
|
|
#include "includes.h"
|
|||
|
|
#include "ui/ui_api.h"
|
|||
|
|
#include "btstack/avctp_user.h"
|
|||
|
|
#include "led_lyric.h"
|
|||
|
|
|
|||
|
|
#if (TCFG_APP_BT_EN)
|
|||
|
|
|
|||
|
|
#if (TCFG_UI_ENABLE && (CONFIG_UI_STYLE == STYLE_JL_LED_LYRICS))
|
|||
|
|
|
|||
|
|
struct lrc_show_bt_music bt_music_info = {0};
|
|||
|
|
static void lrc_show_bt(void)
|
|||
|
|
{
|
|||
|
|
u8 buf[50] = {"BT TASK"};
|
|||
|
|
lyrics_update_font(buf, strlen(buf), NULL);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void lrc_show_call(void)
|
|||
|
|
{
|
|||
|
|
u8 buf[50] = {"BT CALLING"};
|
|||
|
|
lyrics_update_font(buf, strlen(buf), NULL);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void lyric_ui_bt_open(void)
|
|||
|
|
{
|
|||
|
|
os_mutex_create(&bt_music_info.mutex);
|
|||
|
|
lyric_ui_set_auto_reflash(500);//设置主页500ms自动刷新
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void lyric_ui_close_bt(void)
|
|||
|
|
{
|
|||
|
|
os_mutex_del(&bt_music_info.mutex, 0);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void lyric_ui_bt_main(void) //主界面显示
|
|||
|
|
{
|
|||
|
|
if (BT_STATUS_TAKEING_PHONE == get_bt_connect_status()) {
|
|||
|
|
lrc_show_call();
|
|||
|
|
} else if (BT_STATUS_PLAYING_MUSIC == get_bt_connect_status()) {
|
|||
|
|
os_mutex_pend(&bt_music_info.mutex, 0);
|
|||
|
|
lyrics_update_font(bt_music_info.lyric_info, bt_music_info.lyric_len, NULL);
|
|||
|
|
os_mutex_post(&bt_music_info.mutex);
|
|||
|
|
} else {
|
|||
|
|
lrc_show_bt();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static int lyric_ui_bt_user(u8 menu, u32 arg)//子界面显示 //返回true不继续传递 ,返回false由common统一处理
|
|||
|
|
{
|
|||
|
|
int ret = true;
|
|||
|
|
switch (menu) {
|
|||
|
|
case MENU_BT:
|
|||
|
|
lrc_show_bt();
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
ret = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return ret;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const struct lyric_ui_dis lyric_bt_main = {
|
|||
|
|
.lyric_ui = LED_LYRICS_BT_MENU_MAIN,
|
|||
|
|
.lyric_open = lyric_ui_bt_open,
|
|||
|
|
.lyric_ui_main = lyric_ui_bt_main,
|
|||
|
|
.lyric_ui_user = lyric_ui_bt_user,
|
|||
|
|
.lyric_close = lyric_ui_close_bt,
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif
|
|||
|
|
#endif
|