90 lines
1.8 KiB
C
90 lines
1.8 KiB
C
|
|
#include "includes.h"
|
|||
|
|
#include "ui/ui_api.h"
|
|||
|
|
#include "led_lyric.h"
|
|||
|
|
#include "fm/fm_manage.h"
|
|||
|
|
#include "fm/fm_api.h"
|
|||
|
|
|
|||
|
|
#if TCFG_APP_FM_EN
|
|||
|
|
|
|||
|
|
#if (TCFG_UI_ENABLE && (CONFIG_UI_STYLE == STYLE_JL_LED_LYRICS))
|
|||
|
|
|
|||
|
|
static void lrc_show_fm(void)
|
|||
|
|
{
|
|||
|
|
u8 buf[50] = {"FM TASK"};
|
|||
|
|
lyrics_update_font(buf, strlen(buf), NULL);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void lrc_show_puase(void)
|
|||
|
|
{
|
|||
|
|
u8 buf[50] = {"FM PAUSE"};
|
|||
|
|
lyrics_update_font(buf, strlen(buf), NULL);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void lyric_show_freq(u16 fre)
|
|||
|
|
{
|
|||
|
|
u8 buf[50] = {0};
|
|||
|
|
u8 fm_integer = fre / 100;
|
|||
|
|
u8 fm_radix = (fre - fm_integer * 100) / 10;
|
|||
|
|
sprintf(buf, "FM: %d.%d", fm_integer, fm_radix);
|
|||
|
|
lyrics_update_font(buf, strlen(buf), NULL);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void lyric_fm_show_station(u32 arg)
|
|||
|
|
{
|
|||
|
|
u8 buf[50] = {0};
|
|||
|
|
sprintf(buf, "P:%d", arg);
|
|||
|
|
lyrics_update_font(buf, strlen(buf), NULL);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void lyric_ui_fm_open(void)
|
|||
|
|
{
|
|||
|
|
//lyric_ui_set_auto_reflash(500);//设置主页500ms自动刷新
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void lyric_ui_close_fm(void)
|
|||
|
|
{
|
|||
|
|
//lyrics_hide_update();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void lyric_ui_fm_main(void) //主界面显示
|
|||
|
|
{
|
|||
|
|
u8 fm_status = fm_get_status();
|
|||
|
|
if (!fm_status) {
|
|||
|
|
u16 fre = fm_manage_get_fre();
|
|||
|
|
if (fre != 0) {
|
|||
|
|
lyric_show_freq(fre);
|
|||
|
|
} else {
|
|||
|
|
lrc_show_fm();
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
lrc_show_puase();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static int lyric_ui_fm_user(u8 menu, u32 arg)//子界面显示 //返回true不继续传递 ,返回false由common统一处理
|
|||
|
|
{
|
|||
|
|
int ret = true;
|
|||
|
|
switch (menu) {
|
|||
|
|
case MENU_FM_STATION:
|
|||
|
|
lyric_fm_show_station(arg);
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
ret = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return ret;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
const struct lyric_ui_dis lyric_fm_main = {
|
|||
|
|
.lyric_ui = LED_LYRICS_FM_MENU_MAIN,
|
|||
|
|
.lyric_open = lyric_ui_fm_open,
|
|||
|
|
.lyric_ui_main = lyric_ui_fm_main,
|
|||
|
|
.lyric_ui_user = lyric_ui_fm_user,
|
|||
|
|
.lyric_close = lyric_ui_close_fm,
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif
|
|||
|
|
#endif
|