模拟菜单功能;优化字符显示(支持不同宽度字符)

This commit is contained in:
gb 2024-02-06 11:49:41 +08:00
parent fcb90d0b7d
commit aa26512313
9 changed files with 813 additions and 591 deletions

View File

@ -104,6 +104,11 @@ typedef struct _size
u_int32_t cx;
u_int32_t cy;
}SIZE, *LPSIZE;
typedef struct _point
{
u_int32_t x;
u_int32_t y;
}POINT, *LPPOINT;
#pragma pack(pop)

View File

@ -46,6 +46,6 @@
#define WORDS_MENU_YES "\347\241\256\345\256\232"
#define WORDS_MENU_NO "\345\217\226\346\266\210"
#define WORDS_FUNCTION_COUNT "\345\274\240\346\225\260"
#define WORDS_FUNCTION_COUNT "\345\274\240\346\225\260\357\274\232"
#define WORDS_STATUS_READY "\345\260\261\347\273\252"

View File

@ -837,14 +837,16 @@ void Lcd::clear(int x, int y, int w, int h)
write_end();
}
}
void Lcd::write_line(uint8_t rows, uint8_t cols, uint8_t cnt, uint8_t** data, int x, int y, uint8_t mask)
void Lcd::write_line(uint8_t** data, uint8_t cnt, int x, int y, uint8_t mask)
{
uint8_t *ptr[16] = {0};
uint8_t *ptr[16] = {0},
blank[Lcd::LCD_WIDTH] = {0},
over = 0;
for(int i = 0; i < cnt && i < _countof(ptr); ++i)
ptr[i] = data[i];
ptr[i] = data[i] + 2;
for(int r = 0; r < rows / LCD_LINE_PER_PAGE; ++r)
for(int r = 0; r < data[0][1] / LCD_LINE_PER_PAGE; ++r)
{
go_to(y / LCD_LINE_PER_PAGE + r, x);
write_before();
@ -852,7 +854,7 @@ void Lcd::write_line(uint8_t rows, uint8_t cols, uint8_t cnt, uint8_t** data, in
for(int ind = 0; ind < cnt; ++ind)
{
for(int c = 0; c < cols; ++c)
for(int c = 0; c < data[ind][0]; ++c)
{
write_char(*ptr[ind]++, mask);
}

View File

@ -68,7 +68,7 @@ public:
// size: 32lines x 1056px
void go_to(uint8_t page, uint8_t col);
void write(uint8_t val, bool data, uint8_t mask = 0);
void write_line(uint8_t rows, uint8_t cols, uint8_t cnt, uint8_t** data, int x = 0, int y = 0, uint8_t mask = 0);
void write_line(uint8_t** data, uint8_t cnt, int x = 0, int y = 0, uint8_t mask = 0);
void clear(int x = 0, int y = 0, int w = -1, int h = -1);
private:

View File

@ -291,21 +291,28 @@ ui_mgr::ui_mgr() : disp_data_("lcd-msg")
lcd_->Lcd_Initial_Lcd(false);
lcd_->clear();
ready_.cnt = get_string_font(WORDS_STATUS_READY, ready_.ptr, &ready_.rows, &ready_.cols);
ready_.x = (Lcd::LCD_WIDTH - ready_.cols * ready_.cnt) / 2;
ready_.y = (Lcd::LCD_HEIGHT - ready_.rows) / 2;
srand(time(nullptr));
his_cnt_ = rand() % 1000000;
rol_cnt_ = his_cnt_ / (2 + (rand() % 5));
ready_.cnt = custom_font::get_string_font(WORDS_STATUS_READY, ready_.ptr);
ready_.x = (Lcd::LCD_WIDTH - ready_.ptr[0][0] * ready_.cnt) / 2;
ready_.y = (Lcd::LCD_HEIGHT - ready_.ptr[0][1]) / 2;
ready_.mask = 0;
keyboard_.reset(new KeyMonitor(ke));
disp_thrd_.reset(new std::thread(&ui_mgr::thread_display, this));
// refresh_lcd(true);
auto display = [this](void) -> void
{
thread_display();
};
disp_thrd_.start(display, "thread_display");
}
ui_mgr::~ui_mgr()
{
run_ = false;
menu_mode_ = false;
disp_data_.trigger();
if(disp_thrd_.get() && disp_thrd_->joinable())
disp_thrd_->join();
clear();
}
@ -318,7 +325,9 @@ bool ui_mgr::do_menu_command(int cmd)
holdui = handler_[cmd](cur_, cmd);
// at last, we return to main menu OR parent ?
if(!holdui)
if(holdui)
menu_mode_ = false;
else
{
cur_->release();
cur_ = root_; // main menu
@ -333,8 +342,7 @@ void ui_mgr::init(void)
root_ = new dev_menu();
// 分纸强度(低中高)
{
// 分纸强度(低中高� {
child = new dev_menu(true);
child->add_menu(WORDS_MENU_LOW, MENU_CMD_ID_SEPARATE_LOW);
{
@ -364,8 +372,7 @@ void ui_mgr::init(void)
root_->add_menu(WORDS_MENU_SEPARATE_STRENGTH, child);
child->release();
}
// 休眠时间不休眠5min, 10min, 20min, 30min, 1h, 2h, 4h
{
// ä¼çœ æ—¶é—´ï¼ˆä¸<C3A4>ä¼çœ ï¼?min, 10min, 20min, 30min, 1h, 2h, 4hï¼? {
child = new dev_menu(true);
child->add_menu(WORDS_MENU_SLEEP_NONE, MENU_CMD_ID_SLEEP_NEVER);
{
@ -443,6 +450,126 @@ void ui_mgr::init(void)
root_->add_menu(WORDS_MENU_POWER, child);
child->release();
}
// 计数模å¼<C3A5>ã€<C3A3>æ‰åŠ¨æ¨¡å¼<C3A5>ã€<C3A3>清ç<E280A6>†çº¸é<C2B8>“ã€<C3A3>历å<E280A0>²å¼ æ•°ã€<C3A3>滚轴张数ã€<C3A3>清除滚轴张æ•?确定,å<C592>æ¶?ã€<C3A3>è¿å…¥ä¼çœ ã€<C3A3>å…³æœ? root_->add_menu(WORDS_MENU_COUNT_MODE, MENU_CMD_ID_COUNT_MODE);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
// ä¿<C3A4>æŒ<C3A6>ç•Œé<C592>¢ï¼šç¬¬ä¸€è¡Œæ˜¾ç¤ºå½“å‰<C3A5>ä¿<C3A4>æŒ<C3A6>的功能
// 第二行显示当å‰<C3A5>功能的信æ<C2A1>¯ï¼Œè¿‡ç¨ä¸­å<C2AD>ªæ´æ°è¯¥è¡? //
// ä»»æ„<C3A6>按键的å<E2809E><C3A5>应:第一行显示“退出当å‰<C3A5>功能â€? // 第二行显示“确定â€<C3A2>ã€<C3A3>“å<C593>消â€<C3A2>,è<C592>œå<C593>•é”®åœ¨æ­¤ä¸¤é¡¹ä¸­è·³è½¬
DISPDATA dd;
memset(&dd, 0, sizeof(dd));
dd.cnt = dd.mask = -1;
disp_data_.save(dd, true);
dd.mask = 0;
dd.cnt = custom_font::get_string_font(WORDS_MENU_COUNT_MODE, dd.ptr);
disp_data_.save(dd, true);
dd.y = dd.ptr[0][1];
dd.cnt = custom_font::get_string_font(WORDS_FUNCTION_COUNT, dd.ptr);
hold_pos_.x = dd.x;
for(int i = 0; i < dd.cnt; ++i)
hold_pos_.x += dd.ptr[i][0] + 1;
hold_pos_.y = dd.y;
hold_pos_.x += 2;
disp_data_.save(dd, true);
auto test = [this](void) -> void
{
thread_test_hold_ui();
};
disp_thrd_.stop("thread_test_hold_ui");
disp_thrd_.start(test, "thread_test_hold_ui");
return true;
};
handler_[MENU_CMD_ID_COUNT_MODE] = f;
}
root_->add_menu(WORDS_MENU_MANUAL_MODE, MENU_CMD_ID_HANDLE_MODE);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
return true;
};
handler_[MENU_CMD_ID_HANDLE_MODE] = f;
}
root_->add_menu(WORDS_MENU_CLEAR_PASSWAY, MENU_CMD_ID_CLEAR_PASSWAY);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
return false;
};
handler_[MENU_CMD_ID_CLEAR_PASSWAY] = f;
}
root_->add_menu(WORDS_MENU_HISTORY_COUNT, MENU_CMD_ID_GET_HISTORY_COUNT);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
DISPDATA dd;
char cnt[40] = {0};
memset(&dd, 0, sizeof(dd));
dd.cnt = dd.mask = -1;
disp_data_.save(dd, true);
dd.mask = 0;
dd.cnt = custom_font::get_string_font(WORDS_MENU_HISTORY_COUNT, dd.ptr);
disp_data_.save(dd, true);
dd.y = dd.ptr[0][1];
dd.x = dd.ptr[0][0] * 2;
sprintf(cnt, "%u", his_cnt_);
dd.cnt = custom_font::get_string_font(cnt, dd.ptr);
disp_data_.save(dd, true);
return true;
};
handler_[MENU_CMD_ID_GET_HISTORY_COUNT] = f;
}
root_->add_menu(WORDS_MENU_ROLLER_COUNT, MENU_CMD_ID_GET_ROLLER_COUNT);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
DISPDATA dd;
char cnt[40] = {0};
memset(&dd, 0, sizeof(dd));
dd.cnt = dd.mask = -1;
disp_data_.save(dd, true);
dd.mask = 0;
dd.cnt = custom_font::get_string_font(WORDS_MENU_ROLLER_COUNT, dd.ptr);
disp_data_.save(dd, true);
dd.y = dd.ptr[0][1];
dd.x = dd.ptr[0][0] * 2;
sprintf(cnt, "%u", rol_cnt_);
dd.cnt = custom_font::get_string_font(cnt, dd.ptr);
disp_data_.save(dd, true);
return true;
};
handler_[MENU_CMD_ID_GET_ROLLER_COUNT] = f;
}
{
child = new dev_menu(false, false);
child->add_menu(WORDS_MENU_YES, MENU_CMD_ID_CLEAR_ROLLER_CNT);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
rol_cnt_ = 0;
return false;
};
handler_[MENU_CMD_ID_CLEAR_ROLLER_CNT] = f;
}
child->add_menu(WORDS_MENU_NO, MENU_CMD_ID_CANCEL);
root_->add_menu(WORDS_MENU_RESET_ROLLOER_CNT, child);
child->release();
}
// 升降台位置(低中高)
{
child = new dev_menu(true);
@ -474,79 +601,6 @@ void ui_mgr::init(void)
root_->add_menu(WORDS_MENU_LIFTER_POS, child);
child->release();
}
// 计数模式、手动模式、清理纸道、历史张数、滚轴张数、清除滚轴张数(确定,取消)、进入休眠、关机
root_->add_menu(WORDS_MENU_COUNT_MODE, MENU_CMD_ID_COUNT_MODE);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
// 保持界面:第一行显示当前保持的功能
// 第二行显示当前功能的信息,过程中只更新该行
//
// 任意按键的反应:第一行显示“退出当前功能”
// 第二行显示“确定”、“取消”,菜单键在此两项中跳转
DISPDATA dd;
memset(&dd, 0, sizeof(dd));
disp_data_.save(dd, true);
dd.cnt = get_string_font(WORDS_MENU_COUNT_MODE, dd.ptr, &dd.rows, &dd.cols);
disp_data_.save(dd, true);
dd.y = dd.rows;
dd.cnt = get_string_font(WORDS_FUNCTION_COUNT, dd.ptr, &dd.rows, &dd.cols);
disp_data_.save(dd, true);
return true;
};
handler_[MENU_CMD_ID_COUNT_MODE] = f;
}
root_->add_menu(WORDS_MENU_MANUAL_MODE, MENU_CMD_ID_HANDLE_MODE);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
return true;
};
handler_[MENU_CMD_ID_HANDLE_MODE] = f;
}
root_->add_menu(WORDS_MENU_CLEAR_PASSWAY, MENU_CMD_ID_CLEAR_PASSWAY);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
return false;
};
handler_[MENU_CMD_ID_CLEAR_PASSWAY] = f;
}
root_->add_menu(WORDS_MENU_HISTORY_COUNT, MENU_CMD_ID_GET_HISTORY_COUNT);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
return false;
};
handler_[MENU_CMD_ID_GET_HISTORY_COUNT] = f;
}
root_->add_menu(WORDS_MENU_ROLLER_COUNT, MENU_CMD_ID_GET_ROLLER_COUNT);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
return false;
};
handler_[MENU_CMD_ID_GET_ROLLER_COUNT] = f;
}
{
child = new dev_menu(false, false);
child->add_menu(WORDS_MENU_YES, MENU_CMD_ID_CLEAR_ROLLER_CNT);
{
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
{
return false;
};
handler_[MENU_CMD_ID_CLEAR_ROLLER_CNT] = f;
}
child->add_menu(WORDS_MENU_NO, MENU_CMD_ID_CANCEL);
root_->add_menu(WORDS_MENU_RESET_ROLLOER_CNT, child);
child->release();
}
{
child = new dev_menu(false, false);
child->add_menu(WORDS_MENU_YES, MENU_CMD_ID_SHUTDOWN);
@ -572,10 +626,8 @@ void ui_mgr::init(void)
dd.mask = 0;
dd.x = 0;
dd.y = 0;
dd.rows = welcome[1];
dd.cols = welcome[0];
dd.cnt = 1;
dd.ptr[0] = welcome + 2;
dd.ptr[0] = welcome;
disp_data_.save(dd, true);
return false;
@ -628,13 +680,14 @@ void ui_mgr::refresh_lcd(bool cur_at_top)
memset(&dd, 0, sizeof(dd));
if(i == 0)
{
dd.cnt = dd.mask = -1;
disp_data_.save(dd, true);
}
dd.mask = i == sel ? 0x0ff : 0;
dd.x = disp[i].find(WORDS_MENU_SELECTED) == 0 ? 0 : font_size_.cx;
dd.y = rows;
dd.rows = font_size_.cy;
dd.cols = font_size_.cx;
dd.cnt = get_string_font(disp[i].c_str(), dd.ptr, &dd.rows, &dd.cols);
dd.cnt = custom_font::get_string_font(disp[i].c_str(), dd.ptr);
cur = disp_data_.save(dd, true);
rows += font_size_.cy;
}
@ -652,19 +705,6 @@ void ui_mgr::move_to(bool next)
}
void ui_mgr::enter(void)
{
if(!menu_mode_)
{
menu_mode_ = true;
if(cur_)
cur_->release();
cur_ = root_;
if(cur_)
cur_->add_ref();
refresh_lcd(true);
return;
}
if(cur_)
{
int id = -1;
@ -684,58 +724,65 @@ void ui_mgr::enter(void)
}
}
}
int ui_mgr::get_string_font(const char* text, uint8_t** ptr, uint8_t* rows, uint8_t* cols)
void ui_mgr::thread_test_hold_ui(void)
{
uint32_t cnt = 99900 + (rand() % 100);
DISPDATA dd;
int cnt = 0, ind = 0;
char number[40] = {0};
custom_font::font_size size = custom_font::FONT_SIZE_16;
for(; text[ind] && cnt < _countof(dd.ptr); ++cnt)
dd.x = hold_pos_.x;
dd.y = hold_pos_.y;
dd.mask = 0;
printf("Start testing count from %d\n", cnt);
while(!menu_mode_)
{
// Fixed ME !!! how to count a character width ? here I assume 3-bytes
char utf8[4] = {text[ind], text[ind + 1], text[ind + 2], 0};
if(text[ind] >= 0 && text[ind] <= 0x7f)
rol_cnt_++;
sprintf(number, "%d", cnt++);
if(size == custom_font::FONT_SIZE_16 && (Lcd::LCD_WIDTH - dd.x) / font_size_.cx < strlen(number))
{
utf8[1] = utf8[2] = 0;
ind++;
}
else
{
ind += 3;
// clear
dd.cnt = -1;
dd.mask = -1;
dd.ptr[0] = nullptr; // perform clear
disp_data_.save(dd, true);
dd.mask = 0;
}
ptr[cnt] = get_font_data(utf8, rows, cols) + 2; // skip height and widht data
size = custom_font::FONT_SIZE_8;
dd.y += Lcd::LCD_LINE_PER_PAGE;
}
return cnt;
dd.cnt = custom_font::get_string_font(number, dd.ptr, size);
disp_data_.save(dd, true);
std::this_thread::sleep_for(std::chrono::seconds(1));
}
printf("Finished testing count from %d\n", cnt);
}
void ui_mgr::thread_display(void)
{
DISPDATA dd;
bool first = true;
int wait = 10;
// welcome
{
uint8_t *ptr[] = {welcome + 2};
lcd_->write_line(welcome[1], welcome[0], 1, ptr);
std::this_thread::sleep_for(std::chrono::seconds(10));
uint8_t *ptr[] = {welcome};
lcd_->write_line(ptr, 1);
}
while(run_)
{
if(disp_data_.take(dd, true, SEC_2_MS(3)))
if(disp_data_.take(dd, true, SEC_2_MS(wait)))
{
if(dd.cnt)
lcd_->write_line(dd.rows, dd.cols, dd.cnt, dd.ptr, dd.x, dd.y, dd.mask);
if(dd.ptr[0])
lcd_->write_line(dd.ptr, dd.cnt, dd.x, dd.y, dd.mask);
else
lcd_->clear();
lcd_->clear(dd.x, dd.y, dd.cnt, dd.mask);
wait = 3;
}
else if(ready_enable_)
{
int elapse = first ? 10 : get_ready_watch_ms() / SEC_2_MS(1);
first = false;
if(elapse >= 3)
if(get_ready_watch_ms() / SEC_2_MS(1) >= wait)
display_ready();
}
}
@ -747,7 +794,7 @@ void ui_mgr::display_ready(void)
menu_mode_ = false;
lcd_->clear();
lcd_->write_line(ready_.rows, ready_.cols, ready_.cnt, ready_.ptr, ready_.x, ready_.y, ready_.mask);
lcd_->write_line(ready_.ptr, ready_.cnt, ready_.x, ready_.y, ready_.mask);
}
void ui_mgr::set_ready_status_enabled(bool enable)
{
@ -770,6 +817,20 @@ int ui_mgr::get_ready_watch_ms(void)
void ui_mgr::key_event(int key)
{
reset_ready_watch();
set_ready_status_enabled(true);
if(!menu_mode_)
{
menu_mode_ = true;
if(cur_)
cur_->release();
cur_ = root_;
if(cur_)
cur_->add_ref();
refresh_lcd(true);
return;
}
if(key == (int)KeyMonitor::HGKey::Key_Menu)
enter();

View File

@ -94,6 +94,10 @@ class ui_mgr : public refer
volatile bool run_ = true;
volatile bool ready_enable_ = true;
SIZE font_size_ = {16, 16};
POINT hold_pos_ = {0, 0};
uint32_t his_cnt_;
uint32_t rol_cnt_;
std::map<int, MENU_CMD_CALLBACK> handler_;
std::unique_ptr<Lcd> lcd_;
@ -105,16 +109,13 @@ class ui_mgr : public refer
void refresh_lcd(bool cur_at_top);
void move_to(bool next);
void enter(void);
int get_string_font(const char* text, uint8_t** ptr, uint8_t* rows, uint8_t* cols);
typedef struct _disp_data
{
uint8_t x;
uint8_t y;
uint8_t rows;
uint8_t cols;
uint8_t cnt; // 0 to clear
uint8_t mask;
uint8_t cnt; // clear width when ptr[0] == nullptr
uint8_t mask; // clear height when ptr[0] == nullptr
uint8_t *ptr[16];
}DISPDATA;
@ -122,7 +123,9 @@ class ui_mgr : public refer
chronograph ready_watch_;
DISPDATA ready_;
safe_fifo<DISPDATA> disp_data_;
std::unique_ptr<std::thread> disp_thrd_;
safe_thread disp_thrd_;
void thread_test_hold_ui(void);
void thread_display(void);
void display_ready(void);
void set_ready_status_enabled(bool enable);

View File

@ -6,35 +6,95 @@
namespace font_data
namespace custom_font
{
static uint8_t question[] = {16, 16
, 0x00, 0xE0, 0xD0, 0x08, 0x08, 0x08, 0x18, 0xF0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x62, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
};
static uint8_t question8x8[] = {8, 8
, 0x00, 0x0C, 0xE4, 0x24, 0x3C, 0x00, 0x00, 0x00
};
class font_init
{
class font_init
{
std::map<std::string, uint8_t*> font_map_;
std::map<std::string, uint8_t*> font_map8x8_;
public:
void init_8x8(void)
{
static uint8_t num0[] = {8, 8
, 0x30, 0xF8, 0x04, 0xF8, 0x00, 0x00, 0x00, 0x00
};
font_map8x8_["\060\000\000"] = num0;
static uint8_t num1[] = {8, 8
, 0x00, 0x08, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map8x8_["\061\000\000"] = num1;
static uint8_t num2[] = {8, 8
, 0x80, 0xC4, 0xA0, 0x9C, 0x00, 0x00, 0x00, 0x00
};
font_map8x8_["\062\000\000"] = num2;
static uint8_t num3[] = {8, 8
, 0x00, 0x0C, 0x04, 0xEC, 0x00, 0x00, 0x00, 0x00
};
font_map8x8_["\063\000\000"] = num3;
static uint8_t num4[] = {8, 8
, 0x20, 0x28, 0xFC, 0xFE, 0x20, 0x00, 0x00, 0x00
};
font_map8x8_["\064\000\000"] = num4;
static uint8_t num5[] = {8, 8
, 0x00, 0x9C, 0x94, 0xB4, 0x60, 0x00, 0x00, 0x00
};
font_map8x8_["\065\000\000"] = num5;
static uint8_t num6[] = {8, 8
, 0x00, 0xF0, 0x28, 0xE0, 0x00, 0x00, 0x00, 0x00
};
font_map8x8_["\066\000\000"] = num6;
static uint8_t num7[] = {8, 8
, 0x04, 0x04, 0xE4, 0x1C, 0x00, 0x00, 0x00, 0x00
};
font_map8x8_["\067\000\000"] = num7;
static uint8_t num8[] = {8, 8
, 0x00, 0xF8, 0x24, 0xFC, 0x00, 0x00, 0x00, 0x00
};
font_map8x8_["\070\000\000"] = num8;
static uint8_t num9[] = {8, 8
, 0x08, 0x3C, 0xA0, 0x7C, 0x00, 0x00, 0x00, 0x00
};
font_map8x8_["\071\000\000"] = num9;
}
public:
font_init()
{
static uint8_t huan[] = {16, 16
init_8x8();
static uint8_t huan[] = {16, 16
, 0x00, 0x00, 0x00, 0x40, 0xE0, 0xE0, 0xE0, 0xC0, 0xC4, 0xFE, 0xFC, 0xE8, 0xE0, 0xE0, 0x00, 0x00
, 0x00, 0x00, 0x19, 0x1B, 0x0F, 0x07, 0x2F, 0x10, 0x1D, 0x0F, 0x05, 0x0D, 0x18, 0x18, 0x30, 0x20
};
font_map_["\346\254\242"] = huan;
font_map_["\346\254\242"] = huan;
static uint8_t ying[] = {16, 16
static uint8_t ying[] = {16, 16
, 0x00, 0x40, 0xE8, 0xF8, 0xD0, 0x18, 0xF8, 0xFC, 0xCE, 0x3C, 0xF8, 0x98, 0xF8, 0xF8, 0x00, 0x00
, 0x00, 0x00, 0x08, 0x0B, 0x0F, 0x0C, 0x09, 0x09, 0x08, 0x18, 0x3F, 0x31, 0x31, 0x30, 0x30, 0x10
};
font_map_["\350\277\216"] = ying;
font_map_["\350\277\216"] = ying;
static uint8_t jiu[] = {32, 32
static uint8_t jiu[] = {32, 32
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0xF8, 0xF8, 0xF0, 0xF0
, 0xE0, 0x80, 0x00, 0x00, 0x60, 0xB0, 0xF0, 0xE0, 0xC0, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00
, 0x00, 0x00, 0x00, 0x0C, 0x1C, 0x1C, 0x1E, 0xCE, 0xF6, 0xEF, 0x77, 0x77, 0xBF, 0xFB, 0xFB, 0xFB
@ -44,9 +104,9 @@ static uint8_t jiu[] = {32, 32
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x03, 0x00, 0x02, 0x06, 0x1F, 0x1F, 0x00, 0x00, 0x03
, 0x03, 0x00, 0x00, 0x03, 0x0F, 0x0F, 0x1E, 0x1C, 0x1C, 0x1C, 0x1C, 0x1E, 0x0E, 0x0F, 0x0F, 0x06
};
font_map_["\345\260\261"] = jiu;
font_map_["\345\260\261"] = jiu;
static uint8_t xu[] = {32, 32
static uint8_t xu[] = {32, 32
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xF8, 0xF8, 0xF0, 0xE0, 0x80
, 0x00, 0x00, 0x01, 0x83, 0xFF, 0xFF, 0xFF, 0xCC, 0xC0, 0x80, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00
, 0x00, 0x00, 0x00, 0x00, 0x18, 0x7C, 0x7E, 0x3E, 0xDF, 0xFF, 0xFF, 0xFF, 0xF3, 0x81, 0x81, 0x83
@ -56,397 +116,454 @@ static uint8_t xu[] = {32, 32
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1F, 0x1F, 0x07, 0x02, 0x01, 0x01, 0x00, 0x00
, 0x00, 0x07, 0x0F, 0x0F, 0x0E, 0x06, 0x1E, 0x7C, 0xFF, 0x7F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\347\273\252"] = xu;
font_map_["\347\273\252"] = xu;
static uint8_t right[] = {16, 16
static uint8_t right[] = {16, 16
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x3C, 0x04, 0x00
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0x1C, 0x30, 0x78, 0x0F, 0x01, 0x00, 0x00, 0x00
};
font_map_["\342\210\232"] = right;
font_map_["\342\210\232"] = right;
static uint8_t fan[] = {16, 16
static uint8_t fan[] = {16, 16
, 0x00, 0x40, 0x40, 0x42, 0xCC, 0x48, 0x00, 0xFC, 0xFC, 0x24, 0x24, 0x24, 0x24, 0xA6, 0xE2, 0x00
, 0x00, 0x00, 0xC0, 0x20, 0x3F, 0x20, 0x58, 0x4F, 0xA1, 0x90, 0x91, 0x8E, 0x86, 0x87, 0x98, 0xB8
};
font_map_["\350\277\224"] = fan;
font_map_["\350\277\224"] = fan;
static uint8_t hui[] = {16, 16
static uint8_t hui[] = {16, 16
, 0x00, 0x00, 0x00, 0xFE, 0x02, 0x02, 0xE2, 0x22, 0x22, 0x22, 0x22, 0xE2, 0xE2, 0x02, 0x02, 0xFE
, 0x00, 0x00, 0x00, 0xFF, 0x20, 0x20, 0x27, 0x22, 0x22, 0x22, 0x22, 0x27, 0x27, 0x20, 0x20, 0xFF
};
font_map_["\345\233\236"] = hui;
font_map_["\345\233\236"] = hui;
static uint8_t shang[] = {16, 16
static uint8_t shang[] = {16, 16
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40
, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40
};
font_map_["\344\270\212"] = shang;
font_map_["\344\270\212"] = shang;
static uint8_t yi[] = {16, 16
static uint8_t yi[] = {16, 16
, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xC0
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\344\270\200"] = yi;
font_map_["\344\270\200"] = yi;
static uint8_t ji[] = {16, 16
static uint8_t ji[] = {16, 16
, 0x00, 0x80, 0xE0, 0xB0, 0x0E, 0x86, 0x60, 0x30, 0x04, 0xFC, 0xFC, 0x04, 0xC4, 0xF4, 0x9C, 0x84
, 0x00, 0x00, 0xD8, 0x4E, 0x4B, 0x49, 0x84, 0x64, 0x38, 0x9F, 0x83, 0x4C, 0x70, 0x70, 0xCE, 0x83
};
font_map_["\347\272\247"] = ji;
font_map_["\347\272\247"] = ji;
static uint8_t cai[] = {16, 16
static uint8_t cai[] = {16, 16
, 0x00, 0x00, 0x04, 0x04, 0x84, 0x04, 0x3F, 0x3F, 0x64, 0xA4, 0x2F, 0x3F, 0x34, 0xF4, 0x74, 0x04
, 0x00, 0x04, 0x84, 0x84, 0x44, 0x67, 0x34, 0x1C, 0x0C, 0xFF, 0x0C, 0x14, 0x27, 0x45, 0xC4, 0x84
};
font_map_["\350\217\234"] = cai;
font_map_["\350\217\234"] = cai;
static uint8_t dan[] = {16, 16
static uint8_t dan[] = {16, 16
, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x48, 0x4B, 0x4E, 0xF8, 0xF8, 0x48, 0x4E, 0x4B, 0xF8, 0xF8, 0x00
, 0x00, 0x00, 0x10, 0x10, 0x17, 0x12, 0x12, 0x12, 0xFF, 0xFF, 0x12, 0x12, 0x12, 0x17, 0x17, 0x10
};
font_map_["\345\215\225"] = dan;
font_map_["\345\215\225"] = dan;
static uint8_t fen[] = {16, 16
static uint8_t fen[] = {16, 16
, 0x00, 0x00, 0x00, 0x80, 0xE0, 0xB8, 0x9E, 0x86, 0x80, 0x80, 0x81, 0x8F, 0x98, 0xE0, 0x40, 0xC0
, 0x00, 0x00, 0x01, 0x00, 0x80, 0x40, 0x30, 0x1F, 0x03, 0x80, 0x80, 0x80, 0xFF, 0x07, 0x00, 0x00
};
font_map_["\345\210\206"] = fen;
font_map_["\345\210\206"] = fen;
static uint8_t zhi[] = {16, 16
static uint8_t zhi[] = {16, 16
, 0x00, 0x80, 0xC0, 0xB0, 0x8E, 0xC6, 0x60, 0x20, 0xF8, 0x40, 0x44, 0x44, 0xFC, 0x44, 0x46, 0x46
, 0x00, 0x40, 0x78, 0x2E, 0x2B, 0x29, 0x14, 0x00, 0xFF, 0x40, 0x20, 0x20, 0x07, 0x1E, 0x30, 0x60
};
font_map_["\347\272\270"] = zhi;
font_map_["\347\272\270"] = zhi;
static uint8_t qiang[] = {16, 16
static uint8_t qiang[] = {16, 16
, 0x00, 0x00, 0xE2, 0xE2, 0x22, 0x22, 0x7E, 0x00, 0x80, 0xBE, 0x92, 0x92, 0xF2, 0x92, 0xBE, 0xBE
, 0x00, 0x00, 0x87, 0x82, 0x82, 0xFE, 0x1E, 0x80, 0x9F, 0x88, 0x88, 0x88, 0xFF, 0x88, 0x88, 0xFF
};
font_map_["\345\274\272"] = qiang;
font_map_["\345\274\272"] = qiang;
static uint8_t du[] = {16, 16
static uint8_t du[] = {16, 16
, 0x00, 0x00, 0x00, 0xFC, 0x24, 0x24, 0x24, 0xFC, 0xF4, 0x27, 0x26, 0x24, 0xFC, 0xF4, 0x24, 0x24
, 0x00, 0x80, 0x70, 0x1F, 0x00, 0x00, 0x04, 0x87, 0x9D, 0x65, 0x65, 0x65, 0x9D, 0x8D, 0x84, 0x80
};
font_map_["\345\272\246"] = du;
font_map_["\345\272\246"] = du;
static uint8_t di[] = {16, 16
static uint8_t di[] = {16, 16
, 0x00, 0x00, 0xC0, 0xF0, 0xFE, 0x07, 0x00, 0xF8, 0x88, 0x88, 0x80, 0xFC, 0x84, 0x86, 0x86, 0x80
, 0x00, 0x01, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x60, 0x20, 0xD0, 0x83, 0x1F, 0x38, 0x60, 0xC0
};
font_map_["\344\275\216"] = di;
font_map_["\344\275\216"] = di;
static uint8_t zhong[] = {16, 16
static uint8_t zhong[] = {16, 16
, 0x00, 0x00, 0x10, 0xF0, 0x10, 0x10, 0x10, 0x10, 0xFF, 0xFF, 0x10, 0x10, 0x10, 0x10, 0x10, 0xF0
, 0x00, 0x00, 0x00, 0x07, 0x02, 0x02, 0x02, 0x02, 0xFF, 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x07
};
font_map_["\344\270\255"] = zhong;
font_map_["\344\270\255"] = zhong;
static uint8_t gao[] = {16, 16
static uint8_t gao[] = {16, 16
, 0x00, 0x00, 0x04, 0x04, 0x04, 0xF4, 0x54, 0x54, 0x57, 0x56, 0x54, 0x54, 0xF4, 0x14, 0x04, 0x04
, 0x00, 0x00, 0x00, 0xFF, 0x01, 0x01, 0x7D, 0x25, 0x25, 0x25, 0x25, 0x7D, 0x85, 0x81, 0x81, 0xFF
};
font_map_["\351\253\230"] = gao;
font_map_["\351\253\230"] = gao;
static uint8_t xiu[] = {16, 16
static uint8_t xiu[] = {16, 16
, 0x00, 0x00, 0x80, 0x60, 0xFC, 0x07, 0x12, 0x10, 0x10, 0xD0, 0xFF, 0xFF, 0xF0, 0x10, 0x10, 0x10
, 0x00, 0x03, 0x01, 0x00, 0xFF, 0x20, 0x10, 0x0C, 0x07, 0x01, 0xFF, 0xFF, 0x00, 0x07, 0x0C, 0x18
};
font_map_["\344\274\221"] = xiu;
font_map_["\344\274\221"] = xiu;
static uint8_t mian[] = {16, 16
static uint8_t mian[] = {16, 16
, 0x00, 0xFC, 0xFC, 0x44, 0x44, 0xFC, 0x00, 0x02, 0xFE, 0x22, 0x22, 0xE2, 0xE2, 0x22, 0x22, 0x7E
, 0x00, 0x7F, 0x7F, 0x22, 0x22, 0x7F, 0x00, 0x80, 0xFF, 0xC1, 0x21, 0x03, 0x1F, 0x71, 0xC1, 0x81
};
font_map_["\347\234\240"] = mian;
font_map_["\347\234\240"] = mian;
static uint8_t shi[] = {16, 16
static uint8_t shi[] = {16, 16
, 0x00, 0x00, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x10, 0x90, 0x90, 0x10, 0x10, 0x10, 0xFF, 0x10, 0x10
, 0x00, 0x00, 0x7F, 0x10, 0x10, 0x10, 0x3F, 0x00, 0x00, 0x03, 0x87, 0x80, 0x80, 0xFF, 0x00, 0x00
};
font_map_["\346\227\266"] = shi;
font_map_["\346\227\266"] = shi;
static uint8_t jian[] = {16, 16
static uint8_t jian[] = {16, 16
, 0x00, 0x00, 0xFC, 0xFC, 0x03, 0x06, 0xE0, 0xE2, 0x22, 0x22, 0x22, 0xE2, 0x02, 0x02, 0x02, 0xFE
, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x1F, 0x1F, 0x09, 0x09, 0x09, 0x1F, 0x80, 0x80, 0x80, 0xFF
};
font_map_["\351\227\264"] = jian;
font_map_["\351\227\264"] = jian;
static uint8_t bu[] = {16, 16
static uint8_t bu[] = {16, 16
, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x82, 0xE2, 0x7A, 0xFE, 0x06, 0x42, 0xC2, 0x82, 0x02, 0x02
, 0x00, 0x10, 0x08, 0x08, 0x06, 0x03, 0x01, 0x00, 0x80, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x03, 0x0E
};
font_map_["\344\270\215"] = bu;
font_map_["\344\270\215"] = bu;
static uint8_t sheng[] = {16, 16
static uint8_t sheng[] = {16, 16
, 0x00, 0x00, 0x88, 0x88, 0x88, 0x80, 0xFC, 0xFC, 0x84, 0x86, 0x80, 0x80, 0xFE, 0x82, 0x80, 0x80
, 0x00, 0x00, 0x00, 0x80, 0x40, 0x30, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00
};
font_map_["\345\215\207"] = sheng;
font_map_["\345\215\207"] = sheng;
static uint8_t jiang[] = {16, 16
static uint8_t jiang[] = {16, 16
, 0x00, 0x00, 0xFE, 0xFE, 0x02, 0xFA, 0x8E, 0x20, 0x90, 0x8E, 0x4F, 0x72, 0x32, 0x5A, 0x4E, 0xC2
, 0x00, 0x00, 0xFF, 0xFF, 0x08, 0x18, 0x0F, 0x16, 0x1E, 0x16, 0x12, 0x12, 0xFF, 0x12, 0x12, 0x12
};
font_map_["\351\231\215"] = jiang;
font_map_["\351\231\215"] = jiang;
static uint8_t tai[] = {16, 16
static uint8_t tai[] = {16, 16
, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0xB0, 0x98, 0x8E, 0x87, 0x02, 0x40, 0x40, 0x50, 0x70, 0x60, 0xC0
, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xFE, 0x02, 0x00
};
font_map_["\345\217\260"] = tai;
font_map_["\345\217\260"] = tai;
static uint8_t wei[] = {16, 16
static uint8_t wei[] = {16, 16
, 0x00, 0x00, 0x80, 0x70, 0xFE, 0x07, 0x10, 0x10, 0x90, 0x10, 0x17, 0x1E, 0x10, 0xD0, 0xD0, 0x10
, 0x00, 0x02, 0x01, 0x00, 0xFF, 0x00, 0x80, 0x80, 0x87, 0xBE, 0x80, 0x80, 0xF8, 0x8F, 0x81, 0x80
};
font_map_["\344\275\215"] = wei;
font_map_["\344\275\215"] = wei;
static uint8_t zhi4[] = {16, 16
static uint8_t zhi4[] = {16, 16
, 0x00, 0x00, 0x40, 0x7E, 0xDE, 0xD2, 0xD2, 0xDE, 0xF2, 0xF2, 0xDE, 0xDE, 0xD2, 0xD2, 0x7E, 0x5E
, 0x00, 0x80, 0x80, 0x80, 0xFF, 0xFF, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xFF, 0x80, 0x80
};
font_map_["\347\275\256"] = zhi4;
font_map_["\347\275\256"] = zhi4;
static uint8_t num5[] = {16, 16
, 0x00, 0x00, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x30, 0x79, 0x41, 0x40, 0x40, 0x61, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\065\000\000"] = num5;
static uint8_t m[] = {16, 16
static uint8_t m[] = {16, 16
, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x40, 0x7F, 0x41, 0x40, 0x7F, 0x7F, 0x40, 0x7F, 0x7F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\155\000\000"] = m;
font_map_["\155\000\000"] = m;
static uint8_t i[] = {16, 16
static uint8_t i[] = {16, 16
, 0x00, 0x00, 0x80, 0x80, 0x98, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x00, 0x40, 0x40, 0x7F, 0x7F, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\151\000\000"] = i;
font_map_["\151\000\000"] = i;
static uint8_t n[] = {16, 16
static uint8_t n[] = {16, 16
, 0x00, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\156\000\000"] = n;
font_map_["\156\000\000"] = n;
static uint8_t num0[] = {16, 16
static uint8_t num0[] = {16, 16
, 0x00, 0xC0, 0xF0, 0x18, 0x08, 0x08, 0x38, 0xF0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x0F, 0x3F, 0x60, 0x40, 0x40, 0x70, 0x3F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\060\000\000"] = num0;
font_map_["\060\000\000"] = num0;
static uint8_t num1[] = {16, 16
static uint8_t num1[] = {16, 16
, 0x00, 0x00, 0x10, 0x10, 0xF0, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x00, 0x40, 0x40, 0x7F, 0x7F, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\061\000\000"] = num1;
font_map_["\061\000\000"] = num1;
static uint8_t num2[] = {16, 16
static uint8_t num2[] = {16, 16
, 0x00, 0x60, 0x70, 0x08, 0x08, 0x08, 0x98, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x60, 0x70, 0x48, 0x44, 0x42, 0x41, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\062\000\000"] = num2;
font_map_["\062\000\000"] = num2;
static uint8_t num3[] = {16, 16
static uint8_t num3[] = {16, 16
, 0x00, 0x30, 0x38, 0x08, 0x08, 0x88, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x30, 0x70, 0x40, 0x41, 0x41, 0x62, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\063\000\000"] = num3;
font_map_["\063\000\000"] = num3;
static uint8_t num4[] = {16, 16
static uint8_t num4[] = {16, 16
, 0x00, 0x00, 0x00, 0x80, 0x60, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x0C, 0x0B, 0x09, 0x48, 0x7F, 0x7F, 0x48, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\064\000\000"] = num4;
font_map_["\064\000\000"] = num4;
static uint8_t h[] = {16, 16
static uint8_t num5[] = {16, 16
, 0x00, 0x00, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x30, 0x79, 0x41, 0x40, 0x40, 0x61, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\065\000\000"] = num5;
static uint8_t num6[] = {16, 16
, 0x00, 0x80, 0xE0, 0x70, 0x90, 0x98, 0x88, 0x88, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x0F, 0x3F, 0x31, 0x60, 0x60, 0x60, 0x31, 0x3F, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\066\000\000"] = num6;
static uint8_t num7[] = {16, 16
, 0x00, 0x30, 0x18, 0x08, 0x08, 0x08, 0xC8, 0x68, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x00, 0x00, 0x20, 0x3E, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\067\000\000"] = num7;
static uint8_t num8[] = {16, 16
, 0x00, 0x00, 0xF0, 0x98, 0x88, 0x08, 0x98, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x1C, 0x1E, 0x31, 0x21, 0x21, 0x21, 0x33, 0x1E, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\070\000\000"] = num8;
static uint8_t num9[] = {16, 16
, 0x00, 0xF0, 0xF8, 0x18, 0x08, 0x08, 0x08, 0xF8, 0xF0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x01, 0x23, 0x22, 0x22, 0x22, 0x32, 0x1F, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\071\000\000"] = num9;
static uint8_t h[] = {16, 16
, 0x00, 0x0C, 0xFC, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x40, 0x7F, 0x41, 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
font_map_["\150\000\000"] = h;
font_map_["\150\000\000"] = h;
static uint8_t ji4[] = {16, 16
static uint8_t ji4[] = {16, 16
, 0x00, 0x40, 0x40, 0x42, 0xC4, 0x4C, 0x00, 0x80, 0x80, 0x80, 0x80, 0xFE, 0x80, 0x80, 0x80, 0x80
, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00
};
font_map_["\350\256\241"] = ji4;
font_map_["\350\256\241"] = ji4;
static uint8_t shu[] = {16, 16
static uint8_t shu[] = {16, 16
, 0x00, 0x00, 0x10, 0x9E, 0x5C, 0xFF, 0xFF, 0x58, 0xD6, 0x92, 0x70, 0xFF, 0x13, 0x10, 0xF0, 0x70
, 0x00, 0x00, 0x05, 0x84, 0x9C, 0x6F, 0x67, 0x34, 0x5C, 0xC1, 0x80, 0x43, 0x3C, 0x3C, 0xCF, 0xC0
};
font_map_["\346\225\260"] = shu;
font_map_["\346\225\260"] = shu;
static uint8_t mo[] = {16, 16
static uint8_t mo[] = {16, 16
, 0x00, 0x10, 0x10, 0xD0, 0xFF, 0x90, 0x90, 0x14, 0xE4, 0xFF, 0xAF, 0xA4, 0xA4, 0xBF, 0xE4, 0xE4
, 0x00, 0x08, 0x06, 0x03, 0xFF, 0x00, 0x0B, 0x08, 0x8F, 0xCB, 0x7A, 0x3E, 0x3A, 0x6A, 0xCF, 0x8F
};
font_map_["\346\250\241"] = mo;
font_map_["\346\250\241"] = mo;
static uint8_t shi4[] = {16, 16
static uint8_t shi4[] = {16, 16
, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xFF, 0xFB, 0x10, 0x12, 0x1E, 0x1C
, 0x00, 0x40, 0xC0, 0x40, 0x60, 0x3F, 0x3F, 0x20, 0x00, 0x10, 0x11, 0x0F, 0x38, 0x60, 0xC0, 0x80
};
font_map_["\345\274\217"] = shi4;
font_map_["\345\274\217"] = shi4;
static uint8_t shou[] = {16, 16
static uint8_t shou[] = {16, 16
, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x40, 0x44, 0xFC, 0xFC, 0x44, 0x44, 0x44, 0x46, 0x46, 0x40
, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x82, 0xFF, 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02
};
font_map_["\346\211\213"] = shou;
font_map_["\346\211\213"] = shou;
static uint8_t dong[] = {16, 16
static uint8_t dong[] = {16, 16
, 0x00, 0x40, 0x44, 0x44, 0xC4, 0xC4, 0x44, 0x44, 0x44, 0x50, 0x10, 0xFF, 0xFF, 0x10, 0x10, 0xF0
, 0x00, 0x30, 0x38, 0x36, 0x13, 0x11, 0x12, 0x1C, 0xB8, 0x60, 0x38, 0x0F, 0x81, 0x80, 0x80, 0xFF
};
font_map_["\345\212\250"] = dong;
font_map_["\345\212\250"] = dong;
static uint8_t qing[] = {16, 16
static uint8_t qing[] = {16, 16
, 0x00, 0x20, 0x60, 0xC6, 0x8E, 0x60, 0x40, 0x44, 0x54, 0x54, 0x7F, 0x7F, 0x54, 0x54, 0x54, 0x44
, 0x00, 0x00, 0xD0, 0xFC, 0x07, 0x00, 0x00, 0xFF, 0x15, 0x15, 0x15, 0x15, 0x95, 0x95, 0xFF, 0xFF
};
font_map_["\346\270\205"] = qing;
font_map_["\346\270\205"] = qing;
static uint8_t li3[] = {16, 16
static uint8_t li3[] = {16, 16
, 0x00, 0x00, 0x84, 0x84, 0xFC, 0x84, 0x84, 0x84, 0xFE, 0x12, 0x12, 0xFE, 0xFE, 0x12, 0x12, 0xFE
, 0x00, 0x20, 0x60, 0x20, 0x3F, 0x10, 0x90, 0x88, 0x93, 0x91, 0x91, 0xFF, 0xFF, 0x91, 0x91, 0x93
};
font_map_["\347\220\206"] = li3;
font_map_["\347\220\206"] = li3;
static uint8_t dao[] = {16, 16
static uint8_t dao[] = {16, 16
, 0x00, 0x40, 0x40, 0x46, 0xCE, 0x00, 0x08, 0x08, 0xEB, 0xAE, 0xBC, 0xB8, 0xAC, 0xAF, 0xEB, 0x28
, 0x00, 0x40, 0x60, 0x30, 0x1F, 0x20, 0x40, 0x40, 0xFF, 0x92, 0x92, 0x92, 0x92, 0x92, 0xBF, 0x80
};
font_map_["\351\201\223"] = dao;
font_map_["\351\201\223"] = dao;
static uint8_t li4[] = {16, 16
static uint8_t li4[] = {16, 16
, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x02, 0x42, 0x42, 0x42, 0xFA, 0xFA, 0x42, 0x42, 0x42, 0x42, 0xC2
, 0x00, 0x00, 0xC0, 0x3F, 0x0F, 0x00, 0x80, 0x60, 0x38, 0x1F, 0x01, 0x80, 0x80, 0x80, 0xF8, 0x7F
};
font_map_["\345\216\206"] = li4;
font_map_["\345\216\206"] = li4;
static uint8_t shi3[] = {16, 16
static uint8_t shi3[] = {16, 16
, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x88, 0x88, 0x88, 0x88, 0xFF, 0xFF, 0x88, 0x88, 0x88, 0xF8, 0xF8
, 0x00, 0x00, 0x00, 0x00, 0x81, 0x82, 0xC4, 0x78, 0x38, 0x3F, 0x60, 0x40, 0xC0, 0xC0, 0x81, 0x81
};
font_map_["\345\217\262"] = shi3;
font_map_["\345\217\262"] = shi3;
static uint8_t zhang[] = {16, 16
static uint8_t zhang[] = {16, 16
, 0x00, 0x00, 0xE2, 0x62, 0x22, 0x22, 0x7E, 0x80, 0x80, 0xFF, 0xFF, 0xA0, 0xB0, 0x98, 0x8C, 0x84
, 0x00, 0x00, 0x83, 0x81, 0x81, 0xFF, 0x07, 0x00, 0x00, 0xFF, 0xFF, 0x41, 0x2E, 0x18, 0x30, 0x60
};
font_map_["\345\274\240"] = zhang;
font_map_["\345\274\240"] = zhang;
static uint8_t gun[] = {16, 16
static uint8_t gun[] = {16, 16
, 0x00, 0x20, 0x60, 0x46, 0x84, 0x60, 0x44, 0xA4, 0xB4, 0x54, 0x25, 0xA7, 0x84, 0xD4, 0x94, 0x34
, 0x00, 0x00, 0xF0, 0xFC, 0x07, 0x20, 0x30, 0x11, 0xF9, 0x8F, 0x47, 0x0E, 0x30, 0x68, 0xCD, 0x86
};
font_map_["\346\273\232"] = gun;
font_map_["\346\273\232"] = gun;
static uint8_t zhou[] = {16, 16
static uint8_t zhou[] = {16, 16
, 0x00, 0x00, 0xC8, 0xF8, 0x9F, 0xF8, 0x88, 0x88, 0x80, 0xF0, 0x10, 0x10, 0xFF, 0x10, 0x10, 0xF0
, 0x00, 0x10, 0x10, 0x18, 0x08, 0xFF, 0x00, 0x04, 0x04, 0xFF, 0x42, 0x42, 0x7F, 0x42, 0x42, 0xFF
};
font_map_["\350\275\264"] = zhou;
font_map_["\350\275\264"] = zhou;
static uint8_t jin[] = {16, 16
static uint8_t jin[] = {16, 16
, 0x00, 0x40, 0x40, 0x44, 0xCC, 0x08, 0x10, 0x10, 0x10, 0xFE, 0x10, 0x10, 0x12, 0xFE, 0x10, 0x10
, 0x00, 0xC0, 0x40, 0x20, 0x3F, 0x20, 0x61, 0xF1, 0x99, 0x87, 0x81, 0x81, 0xE1, 0xBF, 0x81, 0x81
};
font_map_["\350\277\233"] = jin;
font_map_["\350\277\233"] = jin;
static uint8_t ru[] = {16, 16
static uint8_t ru[] = {16, 16
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x86, 0xFC, 0x78, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x80, 0x40, 0x60, 0x30, 0x18, 0x0E, 0x03, 0x00, 0x00, 0x01, 0x07, 0x0C, 0x38, 0x70, 0x60
};
font_map_["\345\205\245"] = ru;
font_map_["\345\205\245"] = ru;
static uint8_t guan[] = {16, 16
static uint8_t guan[] = {16, 16
, 0x00, 0x00, 0x00, 0x10, 0x10, 0x11, 0x12, 0x1E, 0xF0, 0xF0, 0x18, 0x1E, 0x13, 0x10, 0x10, 0x10
, 0x00, 0x00, 0x01, 0x81, 0x81, 0x41, 0x21, 0x19, 0x0F, 0x03, 0x07, 0x19, 0x31, 0x61, 0xC1, 0x81
};
font_map_["\345\205\263"] = guan;
font_map_["\345\205\263"] = guan;
static uint8_t ji1[] = {16, 16
static uint8_t ji1[] = {16, 16
, 0x00, 0x00, 0x10, 0x90, 0xFF, 0x91, 0x90, 0x10, 0x00, 0xFE, 0x02, 0x02, 0x02, 0xFE, 0x02, 0x00
, 0x00, 0x10, 0x0C, 0x03, 0xFF, 0x00, 0x81, 0xC3, 0x38, 0x0F, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x80
};
font_map_["\346\234\272"] = ji1;
font_map_["\346\234\272"] = ji1;
static uint8_t que[] = {16, 16
static uint8_t que[] = {16, 16
, 0x00, 0x00, 0x84, 0xF4, 0xBC, 0x84, 0x84, 0x04, 0x30, 0xFC, 0x27, 0x27, 0xE4, 0x3C, 0x2C, 0xE0
, 0x00, 0x04, 0x03, 0x7F, 0x10, 0x10, 0x3F, 0x80, 0x70, 0x3F, 0x09, 0x09, 0xFF, 0x89, 0x89, 0xFF
};
font_map_["\347\241\256"] = que;
font_map_["\347\241\256"] = que;
static uint8_t ding[] = {16, 16
static uint8_t ding[] = {16, 16
, 0x00, 0x00, 0x20, 0x78, 0x48, 0x48, 0x48, 0x48, 0x49, 0xCE, 0x48, 0x48, 0x48, 0x48, 0x68, 0x58
, 0x00, 0x00, 0x80, 0xC0, 0x3E, 0x1E, 0x20, 0x40, 0xC0, 0xFF, 0x84, 0x84, 0x84, 0x84, 0x84, 0x80
};
font_map_["\345\256\232"] = ding;
font_map_["\345\256\232"] = ding;
static uint8_t qu[] = {16, 16
static uint8_t qu[] = {16, 16
, 0x00, 0x00, 0x02, 0xFE, 0x22, 0x22, 0x22, 0xFE, 0x02, 0x0A, 0x78, 0x88, 0x08, 0x08, 0xF8, 0x38
, 0x00, 0x20, 0x30, 0x1F, 0x11, 0x11, 0x09, 0xFF, 0x08, 0x88, 0x40, 0x37, 0x1C, 0x3F, 0x61, 0xC0
};
font_map_["\345\217\226"] = qu;
font_map_["\345\217\226"] = qu;
static uint8_t xiao[] = {16, 16
static uint8_t xiao[] = {16, 16
, 0x00, 0x00, 0x60, 0xC2, 0x0E, 0x8C, 0x70, 0x02, 0xEE, 0x3C, 0x20, 0x3F, 0x3F, 0x30, 0xEC, 0xE6
, 0x00, 0x00, 0x00, 0xF0, 0xFC, 0x07, 0x00, 0x00, 0xFF, 0x09, 0x09, 0x09, 0x89, 0x89, 0xFF, 0xFF
};
font_map_["\346\266\210"] = xiao;
font_map_["\346\266\210"] = xiao;
static uint8_t chu[] = {16, 16
static uint8_t chu[] = {16, 16
, 0x00, 0x00, 0xFE, 0x02, 0x62, 0x9E, 0x06, 0x40, 0x30, 0x58, 0x4E, 0xC3, 0x44, 0x58, 0x70, 0x60
, 0x00, 0x00, 0xFF, 0x00, 0x08, 0x19, 0x4F, 0x60, 0xBA, 0x9A, 0x82, 0xFF, 0x02, 0x0A, 0x12, 0x62
};
font_map_["\351\231\244"] = chu;
font_map_["\351\231\244"] = chu;
static uint8_t li[] = {16, 16
static uint8_t li[] = {16, 16
, 0x00, 0x00, 0x00, 0x08, 0x08, 0x48, 0x88, 0x09, 0x0B, 0x0E, 0x08, 0x08, 0xE8, 0x48, 0x08, 0x08
, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4F, 0x5E, 0x40, 0x40, 0x70, 0x5F, 0x43, 0x40, 0x40, 0x40
};
font_map_["\347\253\213"] = li;
font_map_["\347\253\213"] = li;
static uint8_t ji4s[] = {16, 16
static uint8_t ji4s[] = {16, 16
, 0x00, 0x00, 0xFE, 0xFE, 0x92, 0x92, 0x92, 0xFE, 0x02, 0x00, 0xFE, 0xFE, 0x02, 0x02, 0x02, 0xFE
, 0x00, 0x00, 0x3F, 0x3F, 0x20, 0x12, 0x14, 0x1D, 0x38, 0x00, 0xFF, 0xFF, 0x08, 0x08, 0x18, 0x1F
};
font_map_["\345\215\263"] = ji4s;
font_map_["\345\215\263"] = ji4s;
static uint8_t maohao[] = {10, 16
, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x61
, 0x00, 0x00, 0x00, 0x00
};
font_map_["\357\274\232"] = maohao;
}
~font_init()
{}
uint8_t* get_font_data(const char* str, uint8_t* rows, uint8_t* cols)
uint8_t* get_font_data(const char* str, font_size fs)
{
if(fs == FONT_SIZE_8)
{
if(font_map8x8_.count(str))
{
return font_map8x8_[str];
}
return custom_font::question8x8;
}
else if(fs == FONT_SIZE_16)
{
if(font_map_.count(str))
{
if(rows)
*rows = font_map_[str][1];
if(cols)
*cols = font_map_[str][0];
return font_map_[str];
}
if(rows)
*rows = font_data::question[1];
if(cols)
*cols = font_data::question[0];
return custom_font::question;
}
return nullptr;
}
};
static font_init g_fi_;
uint8_t* get_font_data(const char* str, font_size fs)
{
return g_fi_.get_font_data(str, fs);
}
int get_string_font(const char* text, uint8_t** ptr, custom_font::font_size fs)
{
int cnt = 0, ind = 0;
for(; text[ind]; ++cnt)
{
// Fixed ME !!! how to count a character width ? here I assume 3-bytes
char utf8[4] = {text[ind], text[ind + 1], text[ind + 2], 0};
if(text[ind] >= 0 && text[ind] <= 0x7f)
{
utf8[1] = utf8[2] = 0;
ind++;
}
else
{
ind += 3;
}
ptr[cnt] = get_font_data(utf8, fs);
}
return cnt;
return font_data::question;
}
};
static font_init g_fi_;
uint8_t* get_font_data(const char* str, uint8_t* rows, uint8_t* cols)
{
return g_fi_.get_font_data(str, rows, cols);
}

View File

@ -4,4 +4,38 @@
#pragma once
#include <base/utils.h>
uint8_t* get_font_data(const char* str, uint8_t* rows, uint8_t* cols);
namespace custom_font
{
enum font_size
{
FONT_SIZE_8 = 0,
FONT_SIZE_16,
FONT_SIZE_24,
FONT_SIZE_32,
};
// Function: get character font dot-array data
//
// Parameters: str - character
//
// fs - font height
//
// Return: the dot array buffer (do not free the buffer)
//
// NOTE: the ptr[0] is cols and ptr[1] is rows, real dot-array data started from ptr[2]
uint8_t* get_font_data(const char* str, font_size fs = FONT_SIZE_16);
// Function: get string font dot-array data
//
// Parameters: text - string
//
// ptr - to receive the font data (do not free the buffer), user should ensure enough space
//
// NOTE: the ptr[i][0] is cols and ptr[i][1] is rows, real dot-array data started from ptr[i][2]
//
// fs - font height
//
// Return: words of the text or valid data put in ptr
int get_string_font(const char* text, uint8_t** ptr, custom_font::font_size fs = FONT_SIZE_16);
};

View File

@ -60,8 +60,8 @@ add_packagedirs("sdk")
add_defines("BUILD_AS_DEVICE")
add_defines("VER_MAIN=2")
add_defines("VER_FAMILY=200")
add_defines("VER_DATE=20240205")
add_defines("VER_BUILD=15")
add_defines("VER_DATE=20240206")
add_defines("VER_BUILD=21")
target("conf")
set_kind("phony")