333 lines
18 KiB
C
333 lines
18 KiB
C
#include "TestUI.h"
|
||
#include "string.h"
|
||
#include "math.h"
|
||
#include "System.h"
|
||
|
||
//-------枚举id,唯一标识一个页面,防止有两个页面使用同一id
|
||
enum
|
||
{
|
||
main_page_id = 0x00,
|
||
logo_page_id,
|
||
setting_page_id,
|
||
curve_page_id,
|
||
lock_page_id,
|
||
about_page_id,
|
||
about_wououi_page_id,
|
||
about_page_version_id,
|
||
};
|
||
//--------定义页面对象
|
||
TitlePage main_page;
|
||
RaderPicPage logo_page;
|
||
ListPage setting_page;
|
||
WavePage curve_page;
|
||
DigitalPage lock_page;
|
||
ListPage about_page;
|
||
RadioPage about_wououi_page; //这两个相关页使用单选项RadioPage类型只是为了展示单选项页面而已
|
||
RadioPage about_page_version_page;
|
||
//--------定义每个页面需要的一些参数
|
||
//部分页面内选项个数
|
||
#define MAIN_PAGE_NUM 5
|
||
#define LOGO_PAGE_NUM 4
|
||
#define SETTING_PAGE_NUM 13
|
||
#define CURVE_PAGE_NUM 2
|
||
#define LOCK_PAGE_LABEL_NUM 2
|
||
#define ABOUT_PAGE_NUM 3
|
||
#define ABOUT_WOUOUI_PAGE_NUM 9
|
||
#define ABOUT_PAGEVERSION_NUM 8
|
||
|
||
//定义部分页面选项
|
||
//********main页面的选项
|
||
Option mian_option_array[MAIN_PAGE_NUM] =
|
||
{///{ order,max,min,step,int_val,text,} //option的成员顺序,但对单纯title的页面来说,只有text需要赋值
|
||
{.text = "- Logo"}, //前两个字符是前缀,不显示,用于标识一般选项(-),二值选项(+),数值弹窗(~),确认弹窗($)
|
||
{.text = "- Setting"},
|
||
{.text = "- Curve"},
|
||
{.text = "- DigLock"},
|
||
{.text = "- Aoubt"},
|
||
};
|
||
//main页面的图标
|
||
Icon main_icon_array[MAIN_PAGE_NUM] =
|
||
{
|
||
[0] = {0xFC,0xFE,0xFF,0x3F,0x1F,0x0F,0x07,0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
||
0x01,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FF,0xFF,0xFF,0xFF,0x00,0x00,
|
||
0x00,0xFF,0xFF,0xFF,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
|
||
0x80,0xC0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0xCF,0xDF,0xFE,0xF8,0xF8,0xF0,
|
||
0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,0xF1,
|
||
0xF1,0xF1,0xF0,0xF8,0xF8,0xFE,0xDF,0xCF}, //DigitalLock
|
||
[4] = {0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0x7F,0x3F,0x3F,0x1F,0x0F,0x0F,0x0F,0x07,0x07,0x07,
|
||
0x07,0x0F,0x0F,0x0F,0x1F,0x3F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFE,0xFC,0xFF,0xFF,
|
||
0xFF,0x3F,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xEE,0xE6,0x66,0x00,
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||
0xF0,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1F,0x1F,0x08,0x00,0x00,0x00,
|
||
0x00,0x00,0x00,0x00,0x60,0xF0,0xFF,0xFF,0xFF,0xFF,0xCF,0xDF,0xFF,0xFF,0xFF,0xFF,
|
||
0xFF,0xFF,0xFF,0xFE,0xFC,0xFC,0xFC,0xFC,0xFC,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,
|
||
0xF8,0xF8,0xF8,0xF8,0xFF,0xFF,0xDF,0xCF} //about
|
||
};
|
||
|
||
//LOGO页面的参数
|
||
const uint8_t logo_wouo_pic[] = {0x00,0x00,0xF8,0xF0,0x80,0x00,0x00,0x00,0xE0,0xFC,0xE0,0x00,0x00,0x00,0x00,0xF0,
|
||
0xFC,0x04,0x18,0x30,0x70,0xE0,0xC0,0xE0,0xF0,0xF8,0x38,0x00,0x00,0x00,0x00,0x00,
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x70,0x70,0xE0,0xC0,0xE0,0xF0,0x78,0x18,0x00,
|
||
0x00,0x00,0x00,0x00,0x1F,0xFF,0xF0,0xF8,0x3F,0x03,0x01,0x1F,0x7E,0xF0,0xE0,0xFE,
|
||
0x7F,0x01,0x00,0x00,0xF8,0x8E,0x83,0x81,0xC1,0x41,0x71,0x3F,0x00,0x00,0x7F,0xC0,
|
||
0xC0,0xC0,0x60,0x30,0x7E,0xFF,0x00,0x00,0xFC,0x8E,0x83,0x81,0xC1,0x61,0x3B,0x1F,
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
|
||
0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||
0x00,0x00,0x00}; //49*20
|
||
const uint8_t logo_ui_pic[] = {0x00,0x00,0x00,0xF0,0xFC,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFE,
|
||
0xFC,0x00,0x00,0x0C,0x0C,0xFC,0xFC,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x7F,
|
||
0xC0,0x80,0x80,0x80,0xC0,0xE0,0x70,0x38,0x1C,0xFF,0xFF,0xF8,0x00,0x00,0x80,0xC0,
|
||
0xFF,0x9F,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,
|
||
0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,
|
||
0x00}; // 27*20
|
||
const uint8_t logo_page_pic[] = {0x00,0x00,0x00,0xF0,0xFC,0x0C,0x0C,0x0C,0x98,0xF0,0x00,0x00,0x00,0x00,0x80,0x00,
|
||
0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x80,
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xCF,0x0C,0x0E,0x06,0x03,0x03,0x00,0x18,
|
||
0x2E,0x21,0x21,0x31,0x1E,0x3C,0x20,0x0C,0x1F,0x11,0x10,0x90,0xFF,0x00,0x1C,0x3E,
|
||
0x65,0x65,0x62,0x21,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x03,
|
||
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //36*20
|
||
const uint8_t logo_version_pic[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,0xE0,0xDC,0x9C,
|
||
0xD8,0xC0,0xC0,0xE8,0xFC,0xDC,0x8C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
|
||
0x01,0x01,0x00,0x0F,0x1F,0x1F,0x0F,0x0F,0x0F,0x07,0x83,0x80,0x80,0x00,0xC0,0xC0,
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,
|
||
0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x83,0x83,
|
||
0xBB,0xBC,0xFC,0xFC,0xFC,0xB8,0x83,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||
0x00,0xFF,0xFF,0xC0,0xC0,0xC0,0xFF,0xFF,0xC0,0xC0,0x00,0x00,0xFE,0xFF,0xC3,0xC1,
|
||
0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0x00,0x00,0x00,0x00,0x00,
|
||
0x00,0x00,0x00,0x00,0x00,0xFF,0x7F,0x60,0x60,0x60,0x60,0xE0,0xC0,0x00,0x00,0x00,
|
||
0xFF,0xFF,0x0F,0x1C,0x38,0x70,0xE0,0x80,0x00,0x00,0x80,0xE0,0x7C,0x1F,0x01,0x00,
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,
|
||
0xFF,0xFF,0x00,0xE0,0xFF,0x07,0x00,0x00,0x80,0xC0,0xE1,0x73,0x3F,0x1E,0x3F,0x71,
|
||
0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x00,0x00,
|
||
0x00,0x00,0x00,0x07,0x07,0x03,0x00,0x07,0x07,0x00,0x00,0x07,0x33,0x79,0x78,0x78,
|
||
0x30,0x80,0xC0,0xE0,0xC0,0x03,0x07,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,
|
||
0x02,0x03,0x03,0x03,0x02,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //36*60 版
|
||
//镭射图片对象
|
||
RaderPic logo_rpp_array[LOGO_PAGE_NUM] =
|
||
{//{pic,x,y,w,h,rd} //镭射图片的成员参数
|
||
{logo_wouo_pic, 4, 8, 49, 20, RD_RIGHT_DOWN},
|
||
{logo_ui_pic, 53, 8, 27, 20, RD_RIGHT_DOWN},
|
||
{logo_page_pic, 20, 36, 36, 20, RD_RIGHT_DOWN},
|
||
{logo_version_pic, 84, 2, 36, 60, RD_RIGHT_DOWN}
|
||
};
|
||
|
||
//设置的列表选项数组
|
||
Option setting_option_array[SETTING_PAGE_NUM] =
|
||
{///{ order,max,min,step,int_val,text,} //option的成员顺序
|
||
{.text = "- Setting"}, //第一个做说明标签,没有功能
|
||
{0, 255, 0, 1, 0, "~ Tile Ani"},
|
||
{0, 255, 0, 1, 0, "~ List Ani"}, //对于数值弹窗,需要给定最大最小值和步长
|
||
{.text = "+ T Ufd Fm Scr", .step = 1,},
|
||
{.text = "+ L Ufd Fm Scr", .step = 1,},
|
||
{.text = "+ T Loop Mode", .step = 1,},
|
||
{.text = "+ L Loop Mode", .step = 1,},
|
||
{.text = "+ ValWin Bok", .step = 1,},
|
||
{.text = "+ ConWin Bok", .step = 1,},
|
||
{.text = "$ Dig Ripple", .step = 1,},
|
||
{.text = "+ RaderPicMode", .step = 1,}, //step为1,能够使用clcik控制取反,为0,则失能取反(通常用于需要外部接管这个变量的情况)
|
||
{0, 10, 1, 1, 0, "~ RP_S_Rate"},
|
||
{0, 100, 0, 1, 0, "~ RP_M_Rate"}, //因为没有办法给初始化的全局变量使用变量值进行初始化,所以int_val暂时先设为0
|
||
};
|
||
|
||
//curve页面的选项数组
|
||
Option curve_option_array[CURVE_PAGE_NUM] =
|
||
{//{ order,max,min,step,int_val,text,} //option的成员顺序
|
||
{.item_max = 50, .item_min = -50, .step = 0, .val = 0, .text = "sin" },
|
||
{.item_max = 50, .item_min = -50, .step = 0, .val = 0, .text = "tri" }, //wave页面的option中text不需要前缀
|
||
};
|
||
int16_t n = 0; //曲线横坐标自增变量
|
||
|
||
//Lock页面参数
|
||
Option lock_option_array[3] = //由于Digital页面有三个数字选项,所以,digital页面选项数组大小必须为3
|
||
{//{ order,max,min,step,int_val,text,} //option的成员顺序
|
||
{.item_max = 99 , .item_min = 0, .step = 1, .val = 0, .text = NULL},
|
||
{.item_max = 99 , .item_min = 0, .step = 1, .val = 0, .text = NULL},
|
||
{.item_max = 99 , .item_min = 0, .step = 1, .val = 0, .text = NULL}, //设置每一个数字的上限值和步长
|
||
} ;
|
||
String lock_label_array[LOCK_PAGE_LABEL_NUM] = {"Confirm", "Clear All"};
|
||
// uint8_t lock_password[3] = {56,34, 12}; //3个两位数字组成的密码(注意三个数字从0-2是从右到左)(两种形式的初始化均可)
|
||
uint8_t lock_password[3] = {[Digital_Pos_IndexLeft] = 12, [Digital_Pos_IndexMid] = 34, [Digital_Pos_IndexRight] = 56}; //3个两位数字组成的密码(注意三个数字从0-2是从右到左)
|
||
uint8_t lcok_page_state = 0; //0表示正常情况,1表示密码正确(Confirm后密码正确),2表示清除所有位(ClearALL)
|
||
|
||
//about页面的选项数组
|
||
Option about_option_array[ABOUT_PAGE_NUM] =
|
||
{
|
||
{.text = "- About wouo"}, //第一项只是说明
|
||
{.text = "- WouoUI origin"}, //原wououi的说明
|
||
{.text = "- Page version"}, //Page version的说明
|
||
};
|
||
|
||
//about wououi页面的数组
|
||
Option about_wououi_option_array[ABOUT_WOUOUI_PAGE_NUM] =
|
||
{ //单选项需要以“=”开头
|
||
{.text = "- From WouoUI1.2"},
|
||
{.text = "- Thanks for the "},
|
||
{.text = " original author"},
|
||
{.text = "- Bilibili UID:"},
|
||
{.text = "= 9182439"},
|
||
{.text = "- Github URL: "},
|
||
{.text = "= https://"},
|
||
{.text = " github.com/"},
|
||
{.text = " RQNG/WouoUI"}
|
||
};
|
||
Option about_pageversion_array[ABOUT_PAGEVERSION_NUM] =
|
||
{
|
||
{.text = "- Page Version"},
|
||
{.text = "- MyBilili UID:"},
|
||
{.text = "= 679703519"},
|
||
{.text = "- Github URL:"},
|
||
{.text = "= https://"},
|
||
{.text = " github.com/"},
|
||
{.text = " Sheep118/WouoUI"},
|
||
{.text = " -PageVersion"},
|
||
};
|
||
//--------定义每个页面的回调函数
|
||
|
||
void MainPage_CallBack(uint8_t self_page_id,Option* select_item)
|
||
{
|
||
switch (select_item->order)
|
||
{
|
||
case 0: OLED_UIJumpToPage(self_page_id,&logo_page); break;
|
||
case 1: OLED_UIJumpToPage(self_page_id,&setting_page); break;
|
||
case 2: OLED_UIJumpToPage(self_page_id,&curve_page); break;
|
||
case 3: OLED_UIJumpToPage(self_page_id,&lock_page); break;
|
||
case 4: OLED_UIJumpToPage(self_page_id,&about_page); break;
|
||
default: break;
|
||
}
|
||
}
|
||
|
||
void SettingPage_CallBack(uint8_t self_page_id,Option* select_item)
|
||
{
|
||
switch (select_item->order) //对选中项的真实参数值赋值
|
||
{ //由于第0项是说明文字“Setting”
|
||
case 1: ui_para.ani_param[TILE_ANI] = select_item->val;break;//ani_tile
|
||
case 2: ui_para.ani_param[LIST_ANI] = select_item->val;break;//ani_list
|
||
case 3: ui_para.ufd_param[TILE_UFD] = select_item->val;break;//ani_tile
|
||
case 4: ui_para.ufd_param[LIST_UFD] = select_item->val;break;//ani_list
|
||
case 5: ui_para.loop_param[TILE_UFD] = select_item->val;break;//loop_tile
|
||
case 6: ui_para.loop_param[LIST_UFD] = select_item->val;break;//loop_list
|
||
case 7: ui_para.valwin_broken = select_item->val;break;//ValWin Broken
|
||
case 8: ui_para.conwin_broken = select_item->val;break;//ConWin Broken
|
||
case 9: ui_para.digital_ripple = select_item->val;break;//Digital Ripple Enable/not
|
||
case 10: ui_para.raderpic_scan_mode = select_item->val;break;//RaderPic scan mode
|
||
case 11: ui_para.raderpic_scan_rate = select_item->val;break;//RaderPic scan rate
|
||
case 12: ui_para.raderpic_move_rate = select_item->val;break;//RaderPic move rate
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void LockPage_CallBack(uint8_t self_page_id,Option* select_item)
|
||
{
|
||
switch (select_item->order)
|
||
{
|
||
case Digital_Pos_IndexLabel: //选中label项,并单击click的话
|
||
if(strcmp(select_item->text, lock_label_array[0]) == 0) //“confirm”
|
||
{
|
||
if(lock_option_array[0].val == lock_password[0] && lock_option_array[1].val == lock_password[1] && lock_option_array[2].val == lock_password[2])
|
||
//密码正确的话,转到logopage
|
||
OLED_UIChangeCurrentPage(&logo_page);
|
||
}
|
||
else if(strcmp(select_item->text, lock_label_array[1]) == 0) //“Clear All”
|
||
OLED_DigitalPage_UpdateDigitalNumAnimation(&lock_page, 0, 0, 0, Digital_Direct_Increase);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void About_CallBack(uint8_t self_page_id,Option* select_item)
|
||
{
|
||
switch (select_item->order)
|
||
{//第0项是说明文字
|
||
case 1: OLED_UIJumpToPage(self_page_id,&about_wououi_page); break;
|
||
case 2: OLED_UIJumpToPage(self_page_id,&about_page_version_page); break;
|
||
default: break;
|
||
}
|
||
}
|
||
|
||
|
||
//-------------一些需要用的内部函数
|
||
//生成三角波的函数
|
||
int16_t Triangle_Func(int16_t x)
|
||
{
|
||
static int16_t ret = 0;
|
||
if(x%20 != 0) ret+= (curve_option_array[1].item_max - curve_option_array[1].item_min)/2/19;
|
||
else ret = curve_option_array[1].item_min/2 ;
|
||
return ret;
|
||
}
|
||
|
||
//--------------给主函数调用的接口函数
|
||
|
||
void TestUI_Init(void)
|
||
{
|
||
OLED_Init(); //硬件的初始化
|
||
LL_mDelay(100);
|
||
OLED_ClearBuff(); //清空缓存
|
||
OLED_RefreshBuff(); //刷新屏幕(清空屏幕)
|
||
OLED_SetPointColor(1); //设置绘制颜色
|
||
OLED_UiInit(); //必要的ui参数初始化
|
||
//补充列表页面的初值
|
||
setting_option_array[1].val = ui_para.ani_param[TILE_ANI];
|
||
setting_option_array[2].val = ui_para.ani_param[LIST_ANI];
|
||
setting_option_array[3].val = ui_para.ani_param[TILE_UFD];
|
||
setting_option_array[4].val = ui_para.ani_param[LIST_UFD];
|
||
setting_option_array[5].val = ui_para.ani_param[TILE_LOOP];
|
||
setting_option_array[6].val = ui_para.ani_param[LIST_LOOP];
|
||
setting_option_array[7].val = ui_para.valwin_broken;
|
||
setting_option_array[8].val = ui_para.conwin_broken;
|
||
setting_option_array[9].val = ui_para.digital_ripple;
|
||
setting_option_array[10].val = ui_para.raderpic_scan_mode;
|
||
setting_option_array[11].val = ui_para.raderpic_scan_rate;
|
||
setting_option_array[12].val = ui_para.raderpic_move_rate;
|
||
//设置界面选项
|
||
OLED_TitlePageInit(&main_page, main_page_id, MAIN_PAGE_NUM, mian_option_array, main_icon_array, MainPage_CallBack);
|
||
OLED_RaderPicPageInit(&logo_page, logo_page_id, LOGO_PAGE_NUM, logo_rpp_array,Rader_Pic_Mode_Loop, NULL);
|
||
OLED_ListPageInit(&setting_page, setting_page_id, SETTING_PAGE_NUM, setting_option_array, SettingPage_CallBack);
|
||
OLED_WavePageInit(&curve_page, curve_page_id, CURVE_PAGE_NUM, curve_option_array, NULL);
|
||
OLED_DigitalPageInit(&lock_page, lock_page_id, lock_option_array, LOCK_PAGE_LABEL_NUM, lock_label_array, '-', 0, 50, LockPage_CallBack);
|
||
OLED_ListPageInit(&about_page, about_page_id, ABOUT_PAGE_NUM, about_option_array, About_CallBack);
|
||
OLED_RadioPageInit(&about_wououi_page, about_wououi_page_id, ABOUT_WOUOUI_PAGE_NUM, about_wououi_option_array, NULL);
|
||
OLED_RadioPageInit(&about_page_version_page,about_page_version_id, ABOUT_PAGEVERSION_NUM, about_pageversion_array, NULL);
|
||
}
|
||
|
||
|
||
void TestUI_Proc(void)
|
||
{
|
||
OLED_UIProc();
|
||
OLED_UIWaveUpdateVal(&(curve_option_array[0]), sin(0.1*n)*(curve_option_array[0].item_max)*0.75);
|
||
OLED_UIWaveUpdateVal(&(curve_option_array[1]), Triangle_Func(n));
|
||
n++;
|
||
}
|
||
|