chore: Remove tracked build artifacts
This commit is contained in:
@ -1,317 +0,0 @@
|
||||
#include "app_config.h"
|
||||
#include "includes.h"
|
||||
#include "ui/ui_api.h"
|
||||
#include "ui/ui.h"
|
||||
#include "typedef.h"
|
||||
#include "ui/ui_simple/ui_res.h"
|
||||
#include "font/font_textout.h"
|
||||
#include "ui/lcd_simple/ui_mainmenu.h"
|
||||
|
||||
|
||||
#if (TCFG_UI_ENABLE&&(CONFIG_UI_STYLE == STYLE_UI_SIMPLE))
|
||||
#include "key_event_deal.h"
|
||||
#include "app_task.h"
|
||||
#include "font/language_list.h"
|
||||
|
||||
extern u8 LCDBuff[8][128];
|
||||
|
||||
#define UI_TASK_NAME "ui"
|
||||
|
||||
|
||||
|
||||
/* static const struct ui_dis_api *ui_dis_main[] = { */
|
||||
/* #if TCFG_APP_BT_EN */
|
||||
/* #endif */
|
||||
/* #if TCFG_APP_MUSIC_EN */
|
||||
/* #endif */
|
||||
/* #if TCFG_APP_FM_EN */
|
||||
/* #endif */
|
||||
/* #if TCFG_APP_RECORD_EN */
|
||||
/* #endif */
|
||||
/* #if TCFG_APP_LINEIN_EN */
|
||||
/* #endif */
|
||||
/* #if TCFG_APP_RTC_EN */
|
||||
/* #endif */
|
||||
/* #if TCFG_APP_PC_EN */
|
||||
/* #endif */
|
||||
/* #if TCFG_APP_SPDIF_EN */
|
||||
/* #endif */
|
||||
/* }; */
|
||||
/* */
|
||||
|
||||
|
||||
struct ui_display_env {
|
||||
u8 init;
|
||||
OS_SEM sem;//用来做模式初始化的信号量
|
||||
struct lcd_interface *lcd;
|
||||
int main_menu;//当前主页
|
||||
int this_menu;//当前子页面
|
||||
};
|
||||
|
||||
|
||||
static struct ui_display_env __ui_display_env = {0};
|
||||
|
||||
#define __ui_display (&__ui_display_env)
|
||||
#define __this (__ui_display)
|
||||
|
||||
static int post_ui_msg(int *msg, u8 len)
|
||||
{
|
||||
int count = 0;
|
||||
int err = 0;
|
||||
if (!__ui_display->init) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
__retry:
|
||||
err = os_taskq_post_type(UI_TASK_NAME, msg[0], len - 1, &msg[1]);
|
||||
if (cpu_in_irq() || cpu_irq_disabled()) {
|
||||
return err;
|
||||
}
|
||||
if (err) {
|
||||
|
||||
if (!strcmp(os_current_task(), UI_TASK_NAME)) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (count > 10) {
|
||||
return -1;
|
||||
}
|
||||
count++;
|
||||
os_time_dly(1);
|
||||
goto __retry;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
// @brief: 应用往ui发送key消息,由ui控件分配
|
||||
//=================================================================================//
|
||||
int ui_simple_key_msg_post(int key, int value)
|
||||
{
|
||||
int msg[8];
|
||||
|
||||
/* if (key >= 0x80) { */
|
||||
/* return -1; */
|
||||
/* } */
|
||||
/* */
|
||||
msg[0] = Q_EVENT | SYS_KEY_EVENT;
|
||||
msg[1] = key;
|
||||
msg[2] = value;
|
||||
return post_ui_msg(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void clear_lcd()
|
||||
{
|
||||
if (!__this->init) {
|
||||
return;
|
||||
}
|
||||
__this->lcd->clear_screen(0);
|
||||
}
|
||||
|
||||
|
||||
void draw_lcd(u8 start_page, u8 page_len)
|
||||
{
|
||||
if (!__this->init) {
|
||||
return;
|
||||
}
|
||||
__this->lcd->draw_page(&(LCDBuff[start_page][0]), start_page, page_len);
|
||||
}
|
||||
|
||||
void clear_lcd_area(u8 start_page, u8 end_page)
|
||||
{
|
||||
if (end_page > 8) {
|
||||
end_page = 8;
|
||||
}
|
||||
for (; start_page < end_page; start_page++) {
|
||||
memset(&LCDBuff[start_page][0], 0x00, 128);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern u8 app_get_curr_task();
|
||||
|
||||
extern void demo_simple_ui_mode();
|
||||
|
||||
static void ui_task_loop()
|
||||
{
|
||||
while (1) {
|
||||
#if APP_CASE_EARPHONE
|
||||
demo_simple_ui_mode();
|
||||
#else
|
||||
switch (app_get_curr_task()) {
|
||||
case APP_POWERON_TASK:
|
||||
case APP_POWEROFF_TASK:
|
||||
case APP_BT_TASK:
|
||||
case APP_MUSIC_TASK:
|
||||
case APP_FM_TASK:
|
||||
case APP_RECORD_TASK:
|
||||
case APP_LINEIN_TASK:
|
||||
case APP_RTC_TASK:
|
||||
case APP_PC_TASK:
|
||||
case APP_SPDIF_TASK:
|
||||
case APP_IDLE_TASK:
|
||||
case APP_SLEEP_TASK:
|
||||
case APP_SMARTBOX_ACTION_TASK:
|
||||
demo_simple_ui_mode();
|
||||
break;
|
||||
default:
|
||||
printf(" no task \n");
|
||||
os_time_dly(100);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void test_ui()
|
||||
{
|
||||
/* ResShowPic(2,0,0); */
|
||||
/* ResShowPic(2,0,16); */
|
||||
/* ResShowMultiString(0,0,7); */
|
||||
struct font_info *info = font_open(NULL, Chinese_Simplified);
|
||||
info->flags = FONT_SHOW_PIXEL;//显示
|
||||
info->text_height = 16;
|
||||
info->text_width = 128;//设置显示窗口大小
|
||||
font_textout_utf8(info, "杰理科技", strlen("杰理科技"), 24, 0);
|
||||
font_textout_utf8(info, "按ok按键开始", strlen("按ok按键开始"), 0, 16);
|
||||
font_textout_utf8(info, "测试", strlen("测试"), 24, 32);
|
||||
font_close(info);
|
||||
ResShowPic(2, 0, 48);
|
||||
ResShowPic(2, 110, 48);
|
||||
draw_lcd(0, 8);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void __font_pix_copy(u8 *pix, struct rect *draw, int x, int y,
|
||||
int height, int width, u8 color)
|
||||
{
|
||||
|
||||
int i, j, h;
|
||||
for (j = 0; j < (height + 7) / 8; j++) { /* 纵向8像素为1字节 */
|
||||
for (i = 0; i < width; i++) {
|
||||
if (((i + x) >= draw->left)
|
||||
&& ((i + x) <= (draw->left + draw->width - 1))) { /* x在绘制区域,要绘制 */
|
||||
u8 pixel = pix[j * width + i];
|
||||
int hh = height - (j * 8);
|
||||
if (hh > 8) {
|
||||
hh = 8;
|
||||
}
|
||||
for (h = 0; h < hh; h++) {
|
||||
if (((y + j * 8 + h) >= draw->top)
|
||||
&& ((y + j * 8 + h) <= (draw->top + draw->height - 1))) { /* y在绘制区域,要绘制 */
|
||||
u16 clr = pixel & BIT(h) ? color : !color;
|
||||
if (clr) {
|
||||
LCDBuff[j + (y + h) / 8][x + i] |= (BIT(h));
|
||||
} else {
|
||||
LCDBuff[j + (y + h) / 8][x + i] &= ~(BIT(h));
|
||||
}
|
||||
}
|
||||
} /* endof for h */
|
||||
|
||||
}
|
||||
}/* endof for i */
|
||||
}/* endof for j */
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ui_simple_putchar(struct font_info *info, u8 *pixel, u16 width, u16 height, u16 x, u16 y)
|
||||
{
|
||||
struct rect draw;
|
||||
u8 color = 1;
|
||||
draw.left = x;
|
||||
draw.top = y;
|
||||
draw.width = info->text_width;
|
||||
draw.height = info->text_height;
|
||||
__font_pix_copy(pixel,
|
||||
(struct rect *)&draw,
|
||||
(s16)x,
|
||||
(s16)y,
|
||||
height,
|
||||
width,
|
||||
color);
|
||||
}
|
||||
|
||||
static void half_second_tick()
|
||||
{
|
||||
ui_simple_key_msg_post(MSG_HALF_SECOND, 0);
|
||||
//半秒的事件
|
||||
}
|
||||
|
||||
static void ui_task(void *p)
|
||||
{
|
||||
__ui_display->init = 1;
|
||||
|
||||
struct lcd_info info = {0};
|
||||
__this->lcd = lcd_get_hdl();
|
||||
printf("ui_task_run_Check ...\n");
|
||||
ASSERT(__this->lcd);
|
||||
ASSERT(__this->lcd->init);
|
||||
ASSERT(__this->lcd->get_screen_info);
|
||||
ASSERT(__this->lcd->draw);
|
||||
ASSERT(__this->lcd->set_draw_area);
|
||||
ASSERT(__this->lcd->backlight_ctrl);
|
||||
ASSERT(__this->lcd->clear_screen);
|
||||
ASSERT(__this->lcd->draw_page);
|
||||
|
||||
if (__this->lcd->init) {
|
||||
__this->lcd->init(p);
|
||||
}
|
||||
|
||||
if (__this->lcd->backlight_ctrl) {
|
||||
__this->lcd->backlight_ctrl(true);
|
||||
}
|
||||
|
||||
if (__this->lcd->get_screen_info) {
|
||||
__this->lcd->get_screen_info(&info);
|
||||
}
|
||||
|
||||
printf("ui_platform_init :: [%d,%d,%d,%d]\n", 0, 0, info.width, info.height);
|
||||
os_sem_post(&__ui_display->sem);
|
||||
#if APP_CASE_EARPHONE
|
||||
findtaskexist(3);
|
||||
#else
|
||||
findtaskexist(APP_TASK_MAX_INDEX);
|
||||
#endif
|
||||
ResOpen("mnt/sdfile/res/menu.res");
|
||||
test_ui();
|
||||
sys_timer_add(NULL, half_second_tick, 500); //制作半秒的时机
|
||||
while (1) {
|
||||
ui_task_loop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int lcd_ui_init(void *arg)
|
||||
{
|
||||
int err = 0;
|
||||
os_sem_create(&__ui_display->sem, 0);
|
||||
err = task_create(ui_task, arg, UI_TASK_NAME);
|
||||
os_sem_pend(&__ui_display->sem, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
int ui_simple_key_msg_post(int key, int value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1,315 +0,0 @@
|
||||
#include "app_config.h"
|
||||
#include "includes.h"
|
||||
#include "system/includes.h"
|
||||
#include "fs/fs.h"
|
||||
#include "ui/ui_simple/ui_res.h"
|
||||
#include "ui/lcd_simple/ui.h"
|
||||
#include "key_event_deal.h"
|
||||
|
||||
|
||||
#if (TCFG_UI_ENABLE&&(CONFIG_UI_STYLE == STYLE_UI_SIMPLE))
|
||||
|
||||
s8 MenuItemSelectOnNum; //当前屏幕活动page序号:0--(MENUITEMSUMPERSCR-1)
|
||||
s8 CurrentScreenNum; //当前所处屏幕数,从0序号开始
|
||||
u8 NeedScreenSumViaItem; //菜单项目总数将占用屏幕的屏数
|
||||
u8 LaseScreenRemainMenuItem; //最后一屏只需显示的菜单项目数
|
||||
|
||||
#define LCDPAGE 8
|
||||
#define LCDCOLUMN 128
|
||||
#define SCR_WIDTH LCDCOLUMN
|
||||
#define SCR_HEIGHT (LCDPAGE*8)
|
||||
|
||||
|
||||
|
||||
extern u8 LCDBuff[8][128];
|
||||
extern u8 LanguageMode ; //语言模式,ID号
|
||||
|
||||
//滑动块//
|
||||
u8 SetSlider(u8 start_x, u8 start_y, u8 length)
|
||||
{
|
||||
start_x = start_x;
|
||||
length = length;
|
||||
// u8 x;
|
||||
// if( (start_x>SCR_WIDTH-length+2) || (start_y>LCDPAGE) || (length>SLIDERLENGTH))
|
||||
// return false;
|
||||
//
|
||||
// LCDBuff[start_y][start_x]=0x3C;
|
||||
// for(x=start_x+1; x<start_x+1+length+1; x++)
|
||||
// {
|
||||
// LCDBuff[start_y][x] = 0x24;
|
||||
// }
|
||||
// LCDBuff[start_y][start_x+length+1]=0x3C;
|
||||
// return true;
|
||||
if (ResShowPic(SLIDER, 0, start_y * 8)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
u8 SetSlideBlock(u8 Start_x, u8 Start_y)
|
||||
{
|
||||
u8 SlideBlockPixelBuf[4] = {0x7E, 0xFF, 0xFF, 0x7E};
|
||||
u8 x;
|
||||
|
||||
if ((Start_x > SCR_WIDTH - 4) || (Start_y > LCDPAGE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (x = Start_x; x < Start_x + 4; x++) {
|
||||
LCDBuff[Start_y][x] = SlideBlockPixelBuf[x - Start_x];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
u8 SetSlideBlock1(u8 Start_x, u8 Start_y)
|
||||
{
|
||||
if (ResShowPic(SLIDER_P, Start_x, Start_y * 8)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
u8 draw_slider(s8 currentpos, u8 slider_y_pos, u8 sliderlength)
|
||||
{
|
||||
if ((currentpos > sliderlength) || (slider_y_pos > LCDPAGE) || (sliderlength > SLIDERLENGTH)) { //判断滑动条是否超出屏幕范围
|
||||
return false;
|
||||
}
|
||||
|
||||
if (currentpos <= 0) { //界限判断
|
||||
currentpos = 0;
|
||||
} else if (currentpos > SLIDERLENGTH) {
|
||||
currentpos = SLIDERLENGTH;
|
||||
}
|
||||
|
||||
//ClearLcdBuf_Page(slider_y_pos,1);
|
||||
clear_lcd_area(slider_y_pos, slider_y_pos + 1);
|
||||
SetSlider((SCR_WIDTH - sliderlength) / 2, slider_y_pos, sliderlength);
|
||||
SetSlideBlock1((SCR_WIDTH - sliderlength) / 2 + currentpos, slider_y_pos);
|
||||
draw_lcd(slider_y_pos, slider_y_pos + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
u8 UI_Slider(FUN gslider)
|
||||
{
|
||||
int msg[16] = {0};
|
||||
struct sys_event *event = NULL;
|
||||
u8 currentpos;
|
||||
u8 autoruntime = SLIDER_NOMOVE_TIMEEXIT;
|
||||
|
||||
clear_lcd();
|
||||
currentpos = gslider(UI_SLIDER_CURR_VALUE);
|
||||
draw_slider(currentpos, 5, SLIDERLENGTH);
|
||||
draw_lcd(0, LCDPAGE);
|
||||
|
||||
while (1) {
|
||||
int ret = os_taskq_pend(NULL, msg, ARRAY_SIZE(msg)); //500ms_reflash
|
||||
if (ret != OS_TASKQ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (msg[0] != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
switch (msg[1]) { //action
|
||||
case KEY_OK:
|
||||
return 0x00;
|
||||
|
||||
case KEY_UP: //HOLD
|
||||
autoruntime = SLIDER_NOMOVE_TIMEEXIT;
|
||||
clear_lcd_area(1, 4);
|
||||
currentpos = gslider(UI_SLIDER_DEC);
|
||||
draw_slider(currentpos, 5, SLIDERLENGTH);
|
||||
draw_lcd(0, 8);
|
||||
break;
|
||||
|
||||
case KEY_DOWN: //HOLD
|
||||
autoruntime = SLIDER_NOMOVE_TIMEEXIT;
|
||||
clear_lcd_area(1, 4);
|
||||
currentpos = gslider(UI_SLIDER_INC);
|
||||
draw_slider(currentpos, 5, SLIDERLENGTH);
|
||||
draw_lcd(0, 8);
|
||||
break;
|
||||
|
||||
case MSG_HALF_SECOND:
|
||||
autoruntime-- ;
|
||||
if (autoruntime == 0) {
|
||||
return currentpos ;
|
||||
//return 0xff;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//进度条//
|
||||
u8 UI_Progress(u8 currentpos, u8 progress_y_pos, u8 progresslength)
|
||||
{
|
||||
u8 i;
|
||||
if ((currentpos > progresslength) || (progress_y_pos > LCDPAGE) || (progresslength > 100)) {
|
||||
return false;
|
||||
}
|
||||
memset(&LCDBuff[0][0], 0x00, sizeof(LCDBuff));
|
||||
//while(1)
|
||||
{
|
||||
SetProgress((SCR_WIDTH - progresslength) / 2, progress_y_pos, progresslength);
|
||||
for (i = 1; i < currentpos + 1; i++) {
|
||||
LCDBuff[progress_y_pos][(SCR_WIDTH - progresslength) / 2 + i] = 0xFF;
|
||||
}
|
||||
draw_lcd(0, LCDPAGE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
u8 SetProgress(u8 start_x, u8 start_y, u8 length)
|
||||
{
|
||||
u8 x;
|
||||
if ((start_x > SCR_WIDTH - length + 2) || (start_y > LCDPAGE) || (length > 100)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LCDBuff[start_y][start_x] = 0x7E;
|
||||
for (x = start_x + 1; x < start_x + 1 + length + 1; x++) {
|
||||
LCDBuff[start_y][x] = 0x81;
|
||||
}
|
||||
LCDBuff[start_y][start_x + length + 1] = 0x7E;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Scrol_String(u16 StringID)
|
||||
{
|
||||
res_infor_t stringinfor;
|
||||
u8 yy;
|
||||
u32 sdimageaddr = 0;
|
||||
static u32 ScrolOffset = 0;
|
||||
//putchar(0x30+StringID);
|
||||
//u16 StringID = menulist.ItemString[menulist.ActiveItemNum-1];
|
||||
|
||||
void *file = ResGetFp();
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if(!IsScrolString) return;
|
||||
fseek(file, sizeof(res_head_t) + 2 * sizeof(res_entry_t) + BMPID_SUM * sizeof(res_infor_t) + ((StringID - 1)*LANGUAGEID_SUM + LanguageMode - 1)*sizeof(res_infor_t), SEEK_SET);
|
||||
fread(file, (u8 *)&stringinfor, sizeof(res_infor_t));
|
||||
|
||||
stringinfor.dwOffset = ntohl(stringinfor.dwOffset); //res文件保存为大端模式,PC为小端模式,故加此三句,单片机下应该不加此三句
|
||||
stringinfor.wWidth = ntoh(stringinfor.wWidth);
|
||||
|
||||
sdimageaddr = stringinfor.dwOffset;
|
||||
|
||||
if (stringinfor.wWidth > SCR_WIDTH - MENUICONWIDTH - SCROLLBARWIDTH) { //字符串图片宽度 > 屏幕所能显示最大宽度(减去菜单Icon占用的宽度)
|
||||
//需要进行滚屏处理
|
||||
for (yy = 0; yy < MENUITEMHEIGHT / 8 ; yy++) {
|
||||
fseek(file, sdimageaddr + ScrolOffset, SEEK_SET);
|
||||
fread(file, &LCDBuff[MenuItemSelectOnNum * 2 + yy][MENUICONWIDTH], (SCR_WIDTH - MENUICONWIDTH - SCROLLBARWIDTH));
|
||||
sdimageaddr += stringinfor.wWidth;
|
||||
}
|
||||
ScrolOffset += 1;
|
||||
if (ScrolOffset + (SCR_WIDTH - MENUICONWIDTH - SCROLLBARWIDTH) >= stringinfor.wWidth) {
|
||||
ScrolOffset = 0;
|
||||
}
|
||||
//TRACE("sdimageaddr: %d , ScrolOffset: %d \n", sdimageaddr, ScrolOffset );
|
||||
UI_MenuSelectOn(MenuItemSelectOnNum);
|
||||
draw_lcd(0, LCDPAGE);
|
||||
}
|
||||
// else
|
||||
// IsScrolString = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
u8 SetScrollBar(u8 Start_x)
|
||||
{
|
||||
u8 x, y;
|
||||
u8 ScrollBarPixelBuf[8][6] = { 0xFC, 0x02, 0x01, 0x01, 0x02, 0xFC,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||
0x3F, 0x40, 0x80, 0x80, 0x40, 0x3F
|
||||
};
|
||||
if (Start_x > SCR_WIDTH - 6) { //6为滚动条的象ç´ 宽度
|
||||
return false;
|
||||
}
|
||||
|
||||
for (x = Start_x; x < Start_x + 6; x++) {
|
||||
for (y = 0; y < 8; y++) {
|
||||
LCDBuff[y][x] = ScrollBarPixelBuf[y][x - Start_x];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
u8 TurnPixelReverse_Page(u8 startpage, u8 pagelen)
|
||||
{
|
||||
u8 hnum, l;
|
||||
|
||||
if ((startpage > 8) || (pagelen > 8)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (hnum = startpage; hnum < startpage + pagelen; hnum = hnum + 1) {
|
||||
for (l = 0; l < SCR_WIDTH; l++) {
|
||||
LCDBuff[hnum][l] = ~LCDBuff[hnum][l];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
u8 TurnPixelReverse_Rect(u8 left, u8 top, u8 right, u8 bottom)
|
||||
{
|
||||
//left、right取值范围:0--(SCR_WIDTH-1) ; top、bottom取值范围:0--(SCR_HEIGHT/8-1)
|
||||
u8 hnum, l;
|
||||
if ((left > SCR_WIDTH) || (top > SCR_HEIGHT) || (left >= right) || (top >= bottom)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (hnum = top; hnum < bottom + 1; hnum = hnum + 1) {
|
||||
for (l = left; l < right + 1; l++) {
|
||||
LCDBuff[hnum][l] = ~LCDBuff[hnum][l];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
u8 ClearLcdBuf_Page(u8 startpage, u8 pagelen)
|
||||
{
|
||||
u8 hnum, l;
|
||||
|
||||
if ((startpage > 8) || (pagelen > 8)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (hnum = startpage; hnum < startpage + pagelen; hnum = hnum + 1) {
|
||||
for (l = 0; l < SCR_WIDTH; l++) {
|
||||
LCDBuff[hnum][l] = 0x00;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,258 +0,0 @@
|
||||
#include "app_config.h"
|
||||
#include "includes.h"
|
||||
#include "system/includes.h"
|
||||
#include "fs/fs.h"
|
||||
#include "ui/ui_simple/ui_res.h"
|
||||
#include "ui/lcd_simple/ui_mainmenu.h"
|
||||
#include "ui/lcd_simple/ui.h"
|
||||
#include "key_event_deal.h"
|
||||
#include "app_task.h"
|
||||
#include "app_msg.h"
|
||||
|
||||
|
||||
#if (TCFG_UI_ENABLE&&(CONFIG_UI_STYLE == STYLE_UI_SIMPLE))
|
||||
|
||||
|
||||
/* APP_POWERON_TASK = 1, */
|
||||
/* APP_POWEROFF_TASK = 2, */
|
||||
/* APP_BT_TASK = 3, */
|
||||
/* APP_MUSIC_TASK = 4, */
|
||||
/* APP_FM_TASK = 5, */
|
||||
/* APP_RECORD_TASK = 6, */
|
||||
/* APP_LINEIN_TASK = 7, */
|
||||
/* APP_RTC_TASK = 8, */
|
||||
/* APP_SLEEP_TASK = 9, */
|
||||
/* APP_IDLE_TASK = 10, */
|
||||
/* APP_PC_TASK = 11, */
|
||||
/* APP_SPDIF_TASK = 12, */
|
||||
/* APP_WATCH_UPDATE_TASK = 13, */
|
||||
/* APP_SMARTBOX_ACTION_TASK = 14, */
|
||||
/* */
|
||||
const TASKSTRUCT taskbuf[TASKTOTLE] = {
|
||||
{"none", 0xffff, 0xffff, 0,},//0
|
||||
{"poweron", 0xffff, 0xffff, 0,},//1
|
||||
{"powerff", 0xffff, 0xffff, 0,},//2
|
||||
{"bt", FM, t_fm, 1,},//3
|
||||
{"music", MUSIC1, t_music, 1,},//4
|
||||
{"fm", FM, t_fm, 1,},//5
|
||||
{"record", RECORD1, t_record, 1,},//6
|
||||
{"linein", LINEIN1, alarm1, 1,},//7
|
||||
{"rtctime", TOOLP, fm_rtue, 1,},//8
|
||||
{"end", 0xffff, 0xffff, 0,},//必须 以end 结束
|
||||
};
|
||||
|
||||
u8 taskindex[TASKTOTLE] = {0xff, 0, 1, 2, 3, 4, 5, 0xff, 0xff, 6, 7};
|
||||
u8 taskshow[TASKTOTLE];
|
||||
|
||||
u8 g_taskshowsum;
|
||||
|
||||
#define LCDPAGE 8
|
||||
#define LCDCOLUMN 128
|
||||
#define SCR_WIDTH LCDCOLUMN
|
||||
#define SCR_HEIGHT (LCDPAGE*8)
|
||||
|
||||
|
||||
extern u8 LCDBuff[LCDPAGE][LCDCOLUMN];
|
||||
|
||||
void findtaskexist(u8 tasksum)
|
||||
{
|
||||
u8 i;
|
||||
u8 ret;
|
||||
u8 n = 0;
|
||||
u8 appnumber = 0;
|
||||
u16 taskexist = 0x0001; //必有 main task
|
||||
u8 taskfile[16];
|
||||
|
||||
memset(&taskindex, 0xff, sizeof(taskindex));
|
||||
for (i = 1; i < tasksum; i++) { //不用检查main task 0
|
||||
if (!strcmp(taskbuf[i].taskname, "end")) {
|
||||
break;
|
||||
}
|
||||
taskexist |= BIT(i);
|
||||
if (taskbuf[i].showflag == 1) { //该task需显性显示
|
||||
taskshow[n] = i;
|
||||
taskindex[i] = appnumber++;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
g_taskshowsum = n;
|
||||
}
|
||||
|
||||
u8 Set_LeftTriangle(u8 Start_x, u8 Start_y) //左三角标
|
||||
{
|
||||
u8 x, y;
|
||||
u8 LeftTrianglePixelBuf[2][3] = {0x80, 0xC0, 0xE0,
|
||||
0x00, 0x01, 0x03
|
||||
};
|
||||
|
||||
if ((Start_x > SCR_WIDTH - 3) || (Start_y > LCDPAGE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (x = Start_x; x < Start_x + 3; x++) {
|
||||
for (y = Start_y; y < Start_y + 2; y++) {
|
||||
LCDBuff[y][x] = LeftTrianglePixelBuf[y - Start_y][x - Start_x];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
u8 Set_RightTriangle(u8 Start_x, u8 Start_y) //右三角标
|
||||
{
|
||||
u8 x, y;
|
||||
u8 LeftTrianglePixelBuf[2][3] = {0xE0, 0xC0, 0x80,
|
||||
0x03, 0x01, 0x00
|
||||
};
|
||||
|
||||
if ((Start_x > SCR_WIDTH - 3) || (Start_y > LCDPAGE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (x = Start_x; x < Start_x + 3; x++) {
|
||||
for (y = Start_y; y < Start_y + 2; y++) {
|
||||
LCDBuff[y][x] = LeftTrianglePixelBuf[y - Start_y][x - Start_x];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void draw_mainmenu(s8 scr_index, s8 start_task_num)
|
||||
{
|
||||
u8 n;
|
||||
u8 mem_start_task_num;
|
||||
mem_start_task_num = start_task_num;
|
||||
clear_lcd();
|
||||
for (n = 0; n < (g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM); n++) {
|
||||
if (n == scr_index) {
|
||||
clear_lcd_area(0, 1);
|
||||
ResShowMultiString(0, 0, taskbuf[taskshow[start_task_num]].strID);
|
||||
ResShowPic(taskbuf[taskshow[start_task_num]].bmpID + 1, n * 24 + 4, 2 * 8); //选中的图标
|
||||
} else {
|
||||
ResShowPic(taskbuf[taskshow[start_task_num]].bmpID + 0, n * 24 + 4, 2 * 8); //未选中的图标
|
||||
}
|
||||
start_task_num++;
|
||||
}
|
||||
|
||||
if (mem_start_task_num != (g_taskshowsum - (g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM))) {
|
||||
Set_RightTriangle((SCR_WIDTH - 1) - 3, 3);
|
||||
}
|
||||
if (mem_start_task_num != 0) {
|
||||
Set_LeftTriangle(0, 3);
|
||||
}
|
||||
draw_lcd(0, 8) ;
|
||||
}
|
||||
|
||||
u8 UI_mainmenu(s8 apprun)
|
||||
{
|
||||
u8 need_draw = 0 ;
|
||||
u8 autoruntime = AUTORUNTIMEMAX;
|
||||
int msg[16] = {0};
|
||||
|
||||
s8 task_index; //任务索引号
|
||||
s8 screen_index; //当前屏幕显示高亮图标的索引号0-4
|
||||
s8 start_task_index; //当前屏幕显示的第一个任务图标的索引号
|
||||
s8 mem_task_app; //传递进来的任务号
|
||||
|
||||
mem_task_app = apprun;//6 1
|
||||
task_index = taskindex[apprun]; //5 0
|
||||
// deg_string("\n task_index init: ");
|
||||
// printf_u8(task_index);
|
||||
if (task_index <= (g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM)) {
|
||||
if (task_index == SCREENSHOWTASKSUM) {
|
||||
screen_index = task_index - 1;
|
||||
start_task_index = task_index - ((g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM) - 1);
|
||||
//task_index = task_index-1;
|
||||
} else {
|
||||
screen_index = task_index;
|
||||
start_task_index = 0;
|
||||
}
|
||||
} else {
|
||||
screen_index = (g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM) - 1; //4
|
||||
start_task_index = task_index - ((g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM) - 1); //1
|
||||
}
|
||||
draw_mainmenu(screen_index, start_task_index);
|
||||
while (1) {
|
||||
|
||||
if (need_draw != 0) {
|
||||
draw_mainmenu(screen_index, start_task_index) ;
|
||||
need_draw = FALSE;
|
||||
draw_lcd(0, 8) ;
|
||||
autoruntime = AUTORUNTIMEMAX;
|
||||
}
|
||||
|
||||
app_task_get_msg(msg, ARRAY_SIZE(msg), 1);
|
||||
switch (msg[0]) {
|
||||
#if APP_CASE_EARPHONE
|
||||
case Q_EVENT:
|
||||
#else
|
||||
case APP_MSG_SYS_EVENT:
|
||||
#endif
|
||||
printf("ui %s key = %d value = %x\n", __func__, msg[1], msg[2]);
|
||||
switch (msg[1]) {
|
||||
case KEY_OK:
|
||||
return taskshow[task_index];
|
||||
case KEY_UP:
|
||||
task_index--;
|
||||
if (task_index < 0) {
|
||||
task_index = 0;
|
||||
}
|
||||
|
||||
screen_index--;
|
||||
if (screen_index < 0) {
|
||||
start_task_index--;
|
||||
if (start_task_index < 0) {
|
||||
start_task_index = 0;
|
||||
}
|
||||
}
|
||||
if (screen_index < 0) {
|
||||
screen_index = 0;
|
||||
}
|
||||
|
||||
// deg_string("\n task_index: ");
|
||||
// printf_u8(task_index);
|
||||
// deg_string("\n screen_index: ");
|
||||
// printf_u8(screen_index);
|
||||
need_draw = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
case KEY_DOWN:
|
||||
task_index++;
|
||||
if (task_index > (g_taskshowsum - 1)) {
|
||||
task_index = g_taskshowsum - 1 ;
|
||||
}
|
||||
|
||||
screen_index++;
|
||||
if (screen_index > (g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM) - 1) {
|
||||
start_task_index++;
|
||||
if (start_task_index > g_taskshowsum - (g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM)) {
|
||||
start_task_index = g_taskshowsum - (g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM);
|
||||
}
|
||||
}
|
||||
if (screen_index > ((g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM) - 1)) {
|
||||
screen_index = (g_taskshowsum < SCREENSHOWTASKSUM ? g_taskshowsum : SCREENSHOWTASKSUM) - 1;
|
||||
}
|
||||
|
||||
|
||||
// deg_string("\n task_index: ");
|
||||
// printf_u8(task_index);
|
||||
// deg_string("\n screen_index: ");
|
||||
// printf_u8(screen_index);
|
||||
need_draw = TRUE;
|
||||
break;
|
||||
|
||||
case MSG_HALF_SECOND:
|
||||
autoruntime-- ;
|
||||
if (autoruntime == 0) {
|
||||
//return taskshow[mem_task_app-1];
|
||||
clear_lcd();
|
||||
return 0xff;
|
||||
}
|
||||
break ;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user