feat: 为选中项增加了奇怪的动效

This commit is contained in:
2024-01-06 17:19:36 +08:00
parent abca5d603c
commit 737fc2de6b
4 changed files with 79 additions and 105 deletions

View File

@@ -100,7 +100,7 @@ static void Print_Menu_p(void)
// SCREEN_showstr_style(5 * 8, 0, RED, WHITE, "#### MAIN MENU ####"); // SCREEN_showstr_style(5 * 8, 0, RED, WHITE, "#### MAIN MENU ####");
ips200_show_string(0, 0, Text); ips200_show_string(0, 0, Text);
for (uint8_t i = page_menu + 1; i < page_max; i++) { for (uint8_t i = page_menu + 1; i < page_max; i++) {
ips200_show_string(10, i * 16, pagelist[i].Text); ips200_show_string(10, i * 18, pagelist[i].Text);
// SCREEN_showstr(8, i, pagelist[i].Text); // SCREEN_showstr(8, i, pagelist[i].Text);
} }
} }

View File

@@ -3,13 +3,12 @@
#include "cw_page.h" #include "cw_page.h"
#define LINE_HEAD 11 #define LINE_HEAD 11
#define LINE_END 18 #define LINE_END 16
static char Text[] = "RealTime Image"; static char Text[] = "RealTime Image";
static int8_t Curser = LINE_HEAD; // 定义光标位置 static int8_t Curser = LINE_HEAD; // 定义光标位置
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置 static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
static void Print_Menu_p(void);
/*************************************************************************************** /***************************************************************************************
* *
* 以下为页面模板函数 * 以下为页面模板函数
@@ -24,7 +23,6 @@ static void Print_Menu_p(void);
static void Setup() static void Setup()
{ {
ips200_clear(); ips200_clear();
Print_Menu_p();
Print_Curser(Curser, Curser_Last); Print_Curser(Curser, Curser_Last);
} }
@@ -91,13 +89,3 @@ void PageRegister_page_rtcam(unsigned char pageID)
* 以下为页面自定义功能函数 * 以下为页面自定义功能函数
* *
***************************************************************************************/ ***************************************************************************************/
/**
* @brief 打印菜单项
*
*/
static void Print_Menu_p(void)
{
// SCREEN_showstr_style(5 * 8, 0, RED, WHITE, "#### MAIN MENU ####");
ips200_show_string(0, 0, Text);
}

View File

@@ -10,8 +10,17 @@
*/ */
void Print_Curser(uint8_t Curser_In, uint8_t Curser_Last_In) void Print_Curser(uint8_t Curser_In, uint8_t Curser_Last_In)
{ {
ips200_show_string(0, Curser_Last_In * 16, " "); ips200_show_string(0, Curser_Last_In * 18, " ");
ips200_show_string(0, Curser_In * 16, ">"); ips200_show_string(0, Curser_In * 18, ">");
for (uint8_t i = 0; i < 160; i++) {
ips200_draw_point(10 + i, Curser_Last_In * 18 + 19, IPS200_DEFAULT_BGCOLOR);
// system_delay_us(200);
}
for (uint8_t i = 0; i < 160; i++) {
ips200_draw_point(10 + i, Curser_In * 18 + 19, RGB565_WHITE);
system_delay_ms(2);
}
} }
/** /**
@@ -20,9 +29,8 @@ void Print_Curser(uint8_t Curser_In, uint8_t Curser_Last_In)
*/ */
void Print_Menu(const ITEM *item, uint8_t item_sum) void Print_Menu(const ITEM *item, uint8_t item_sum)
{ {
ips200_show_string(0, 0, " --return--");
for (uint8_t i = 0; i < item_sum; i++) { for (uint8_t i = 0; i < item_sum; i++) {
ips200_show_string(8, i * 16 + 16, item[i].text); ips200_show_string(8, i * 18 + 16, item[i].text);
} }
} }

View File

@@ -316,10 +316,10 @@ static void ips200_set_region(uint16 x1, uint16 y1, uint16 x2, uint16 y2)
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
// 检查一下你的显示调用的函数 自己计算一下哪里超过了屏幕显示范围 // 检查一下你的显示调用的函数 自己计算一下哪里超过了屏幕显示范围
zf_assert(x1 < ips200_x_max); // zf_assert(x1 < ips200_x_max);
zf_assert(y1 < ips200_y_max); // zf_assert(y1 < ips200_y_max);
zf_assert(x2 < ips200_x_max); // zf_assert(x2 < ips200_x_max);
zf_assert(y2 < ips200_y_max); // zf_assert(y2 < ips200_y_max);
ips200_write_command(0x2a); ips200_write_command(0x2a);
ips200_write_16bit_data(x1); ips200_write_16bit_data(x1);
@@ -484,8 +484,8 @@ void ips200_draw_point(uint16 x, uint16 y, const uint16 color)
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
if (IPS200_TYPE_SPI == ips200_display_type) { if (IPS200_TYPE_SPI == ips200_display_type) {
IPS200_CS(0); IPS200_CS(0);
@@ -512,10 +512,10 @@ void ips200_draw_line(uint16 x_start, uint16 y_start, uint16 x_end, uint16 y_end
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x_start < ips200_x_max); // zf_assert(x_start < ips200_x_max);
zf_assert(y_start < ips200_y_max); // zf_assert(y_start < ips200_y_max);
zf_assert(x_end < ips200_x_max); // zf_assert(x_end < ips200_x_max);
zf_assert(y_end < ips200_y_max); // zf_assert(y_end < ips200_y_max);
int16 x_dir = (x_start < x_end ? 1 : -1); int16 x_dir = (x_start < x_end ? 1 : -1);
int16 y_dir = (y_start < y_end ? 1 : -1); int16 y_dir = (y_start < y_end ? 1 : -1);
@@ -565,61 +565,39 @@ void ips200_show_char(uint16 x, uint16 y, const char dat)
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
uint8 i = 0, j = 0; uint8 i = 0, j = 0;
if (IPS200_TYPE_SPI == ips200_display_type) { if (IPS200_TYPE_SPI == ips200_display_type) {
IPS200_CS(0); IPS200_CS(0);
} }
switch (ips200_display_font) { uint16 display_buffer[8 * 16];
case IPS200_6X8_FONT: { ips200_set_region(x, y, x + 7, y + 15);
uint16 display_buffer[6 * 8]; for (i = 0; 8 > i; i++) {
ips200_set_region(x, y, x + 5, y + 7); uint8 temp_top = ascii_font_8x16[dat - 32][i];
for (i = 0; 6 > i; i++) { uint8 temp_bottom = ascii_font_8x16[dat - 32][i + 8];
// 减 32 因为是取模是从空格开始取得 空格在 ascii 中序号是 32 for (j = 0; 8 > j; j++) {
uint8 temp_top = ascii_font_6x8[dat - 32][i]; if (temp_top & 0x01) {
for (j = 0; 8 > j; j++) { display_buffer[i + j * 8] = (ips200_pencolor);
if (temp_top & 0x01) { } else {
display_buffer[i + j * 6] = (ips200_pencolor); display_buffer[i + j * 8] = (ips200_bgcolor);
} else {
display_buffer[i + j * 6] = (ips200_bgcolor);
}
temp_top >>= 1;
}
} }
ips200_write_16bit_data_array(display_buffer, 6 * 8); temp_top >>= 1;
} break; }
case IPS200_8X16_FONT: { for (j = 0; 8 > j; j++) {
uint16 display_buffer[8 * 16]; if (temp_bottom & 0x01) {
ips200_set_region(x, y, x + 7, y + 15); display_buffer[i + j * 8 + 4 * 16] = (ips200_pencolor);
for (i = 0; 8 > i; i++) { } else {
uint8 temp_top = ascii_font_8x16[dat - 32][i]; display_buffer[i + j * 8 + 4 * 16] = (ips200_bgcolor);
uint8 temp_bottom = ascii_font_8x16[dat - 32][i + 8];
for (j = 0; 8 > j; j++) {
if (temp_top & 0x01) {
display_buffer[i + j * 8] = (ips200_pencolor);
} else {
display_buffer[i + j * 8] = (ips200_bgcolor);
}
temp_top >>= 1;
}
for (j = 0; 8 > j; j++) {
if (temp_bottom & 0x01) {
display_buffer[i + j * 8 + 4 * 16] = (ips200_pencolor);
} else {
display_buffer[i + j * 8 + 4 * 16] = (ips200_bgcolor);
}
temp_bottom >>= 1;
}
} }
ips200_write_16bit_data_array(display_buffer, 8 * 16); temp_bottom >>= 1;
} break; }
case IPS200_16X16_FONT: {
// 暂不支持 ips200_write_16bit_data_array(display_buffer, 8 * 16);
} break;
} }
if (IPS200_TYPE_SPI == ips200_display_type) { if (IPS200_TYPE_SPI == ips200_display_type) {
IPS200_CS(1); IPS200_CS(1);
} }
@@ -638,8 +616,8 @@ void ips200_show_string(uint16 x, uint16 y, const char dat[])
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
uint16 j = 0; uint16 j = 0;
while ('\0' != dat[j]) { while ('\0' != dat[j]) {
@@ -671,10 +649,10 @@ void ips200_show_int(uint16 x, uint16 y, const int32 dat, uint8 num)
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
zf_assert(0 < num); // zf_assert(0 < num);
zf_assert(10 >= num); // zf_assert(10 >= num);
int32 dat_temp = dat; int32 dat_temp = dat;
int32 offset = 1; int32 offset = 1;
@@ -708,10 +686,10 @@ void ips200_show_uint(uint16 x, uint16 y, const uint32 dat, uint8 num)
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
zf_assert(0 < num); // zf_assert(0 < num);
zf_assert(10 >= num); // zf_assert(10 >= num);
uint32 dat_temp = dat; uint32 dat_temp = dat;
int32 offset = 1; int32 offset = 1;
@@ -748,12 +726,12 @@ void ips200_show_float(uint16 x, uint16 y, const double dat, uint8 num, uint8 po
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
zf_assert(0 < num); // zf_assert(0 < num);
zf_assert(8 >= num); // zf_assert(8 >= num);
zf_assert(0 < pointnum); // zf_assert(0 < pointnum);
zf_assert(6 >= pointnum); // zf_assert(6 >= pointnum);
double dat_temp = dat; double dat_temp = dat;
double offset = 1.0; double offset = 1.0;
@@ -790,9 +768,9 @@ void ips200_show_binary_image(uint16 x, uint16 y, const uint8 *image, uint16 wid
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
zf_assert(NULL != image); // zf_assert(NULL != image);
uint32 i = 0, j = 0; uint32 i = 0, j = 0;
uint8 temp = 0; uint8 temp = 0;
@@ -844,9 +822,9 @@ void ips200_show_gray_image(uint16 x, uint16 y, const uint8 *image, uint16 width
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
zf_assert(NULL != image); // zf_assert(NULL != image);
uint32 i = 0, j = 0; uint32 i = 0, j = 0;
uint16 color = 0, temp = 0; uint16 color = 0, temp = 0;
@@ -901,9 +879,9 @@ void ips200_show_rgb565_image(uint16 x, uint16 y, const uint16 *image, uint16 wi
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
zf_assert(NULL != image); // zf_assert(NULL != image);
uint32 i = 0, j = 0; uint32 i = 0, j = 0;
uint16 data_buffer[dis_width]; uint16 data_buffer[dis_width];
@@ -947,9 +925,9 @@ void ips200_show_wave(uint16 x, uint16 y, const uint16 *wave, uint16 width, uint
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
zf_assert(NULL != wave); // zf_assert(NULL != wave);
uint32 i = 0, j = 0; uint32 i = 0, j = 0;
uint32 width_index = 0, value_max_index = 0; uint32 width_index = 0, value_max_index = 0;
@@ -992,9 +970,9 @@ void ips200_show_chinese(uint16 x, uint16 y, uint8 size, const uint8 *chinese_bu
{ {
// 如果程序在输出了断言信息 并且提示出错位置在这里 // 如果程序在输出了断言信息 并且提示出错位置在这里
// 那么一般是屏幕显示的时候超过屏幕分辨率范围了 // 那么一般是屏幕显示的时候超过屏幕分辨率范围了
zf_assert(x < ips200_x_max); // zf_assert(x < ips200_x_max);
zf_assert(y < ips200_y_max); // zf_assert(y < ips200_y_max);
zf_assert(NULL != chinese_buffer); // zf_assert(NULL != chinese_buffer);
int i = 0, j = 0, k = 0; int i = 0, j = 0, k = 0;
uint8 temp = 0, temp1 = 0, temp2 = 0; uint8 temp = 0, temp1 = 0, temp2 = 0;