This commit is contained in:
bmy
2024-01-08 22:16:40 +08:00
5 changed files with 228 additions and 149 deletions

View File

@@ -30,6 +30,7 @@
int main(void)
{
clock_init(SYSTEM_CLOCK_120M);
system_delay_init();
debug_init();
@@ -48,7 +49,6 @@ int main(void)
Page_Run();
queue_pop_read();
if (mt9v03x_finish_flag) {
// 该操作消耗大概 1970 个 tick折合约 110us

View File

@@ -17,8 +17,10 @@ void Print_Curser(uint8_t Curser_In, uint8_t Curser_Last_In)
ips200_draw_point(10 + i, Curser_Last_In * 18 + 19, IPS200_DEFAULT_BGCOLOR);
// system_delay_us(200);
}
ips200_draw_rect(10, Curser_Last_In * 18 + 19, 170, Curser_Last_In * 18 + 19, IPS200_DEFAULT_BGCOLOR);
for (uint8_t i = 0; i < 160; i++) {
ips200_draw_point(10 + i, Curser_In * 18 + 19, RGB565_WHITE);
ips200_draw_point(10 + i, Curser_In * 18 + 19, RGB565_PURPLE);
system_delay_ms(1);
}
}
@@ -146,15 +148,76 @@ void Show_Marked_Image(void)
float vertical_zoom_rate = ((float)(IMAGE_DISPLAY_HEIGHT)) / ((float)(MT9V03X_H));
ips200_show_gray_image(START_X, START_Y, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, IMAGE_DISPLAY_WIDTH, IMAGE_DISPLAY_HEIGHT, 0);
ips200_draw_frame(START_X - 3, START_Y - 3, START_X + IMAGE_DISPLAY_WIDTH + 2, START_Y + IMAGE_DISPLAY_HEIGHT + 2, 2, RGB565_BLUE);
// 确认边线数组在显示前不会清空
for (uint i = 0; i < PT_MAXLEN; i++) {
ips200_draw_point(START_X + (uint16_t)((float)pts_right[i][1] * horizontal_zoom_rate), START_Y + (uint16_t)((float)pts_right[i][0] * vertical_zoom_rate), RGB565_GREEN);
ips200_draw_point(START_X + (uint16_t)((float)pts_right[i][1] * horizontal_zoom_rate) - 1, START_Y + (uint16_t)((float)pts_right[i][0] * vertical_zoom_rate), RGB565_GREEN);
ips200_draw_point(START_X + (uint16_t)((float)pts_left[i][1] * horizontal_zoom_rate), START_Y + (uint16_t)((float)pts_left[i][0] * vertical_zoom_rate), RGB565_YELLOW);
ips200_draw_point(START_X + (uint16_t)((float)pts_left[i][1] * horizontal_zoom_rate) + 1, START_Y + (uint16_t)((float)pts_left[i][0] * vertical_zoom_rate), RGB565_YELLOW);
uint16_t l_x = START_X + (uint16_t)((float)pts_right[i][1] * horizontal_zoom_rate);
uint16_t l_y = START_Y + (uint16_t)((float)pts_right[i][0] * vertical_zoom_rate);
uint16_t r_x = START_X + (uint16_t)((float)pts_left[i][1] * horizontal_zoom_rate);
uint16_t r_y = START_Y + (uint16_t)((float)pts_left[i][0] * vertical_zoom_rate);
ips200_draw_rect(l_x, l_y, l_x + 2, l_y, RGB565_RED);
ips200_draw_rect(r_x - 2, r_y, r_x, r_y, RGB565_BLUE);
// ips200_draw_point(START_X + (uint16_t)((float)pts_right[i][1] * horizontal_zoom_rate), START_Y + (uint16_t)((float)pts_right[i][0] * vertical_zoom_rate), RGB565_GREEN);
// ips200_draw_point(START_X + (uint16_t)((float)pts_right[i][1] * horizontal_zoom_rate) - 1, START_Y + (uint16_t)((float)pts_right[i][0] * vertical_zoom_rate), RGB565_GREEN);
// ips200_draw_point(START_X + (uint16_t)((float)pts_left[i][1] * horizontal_zoom_rate), START_Y + (uint16_t)((float)pts_left[i][0] * vertical_zoom_rate), RGB565_YELLOW);
// ips200_draw_point(START_X + (uint16_t)((float)pts_left[i][1] * horizontal_zoom_rate) + 1, START_Y + (uint16_t)((float)pts_left[i][0] * vertical_zoom_rate), RGB565_YELLOW);
}
#undef IMAGE_DISPLAY_WIDTH
#undef START_X
#undef START_Y
}
uint16_t rgb_gradient(uint16_t i)
{
#define STEP1 (32.0f / 33.0f)
#define STEP2 (64.0f / 33.0f)
static uint16_t color = 0;
static uint16_t i_last;
static float r = 32;
static float g = 0;
static float b = 0;
uint8_t r_h = 0;
uint8_t g_h = 0;
uint8_t b_h = 0;
if (i == i_last) {
return color;
}
if (i < 33) {
if (0 == i) {
r = 32;
g = 0;
b = 0;
}
r = r - STEP1;
g = g + STEP2;
b = 0;
} else if (i > 33) {
if (i < 67) {
r = 0;
g = g - STEP2;
b = b + STEP1;
} else {
r = r + STEP1;
g = 0;
b = b - STEP1;
}
}
color = 0;
r_h = (uint8_t)r;
g_h = (uint8_t)g;
b_h = (uint8_t)b;
printf("%d - r:%d, g:%d, b:%d\r\n", i, r_h, g_h, b_h);
color |= (r_h & 0x1F) << 11;
color |= (g_h & 0x3F) << 5;
color |= (b_h & 0x1F);
i_last = i;
return color;
#undef STEP1
#undef STEP2
}

View File

@@ -4,14 +4,15 @@
#include "zf_common_headfile.h"
typedef struct {
char *text; //变量显示名
uint8_t data_tag; //变量结构体
char *text; // 变量显示名
uint8_t data_tag; // 变量结构体
} ITEM;
void Print_Curser(uint8_t Curser_In, uint8_t Curser_Last_In);
void Print_Menu(const ITEM* item, uint8_t item_sum);
void Print_Value(const ITEM* item, uint8_t item_sum);
void Set_Vaule(ITEM* item, uint8_t item_num, float step);
void Print_Menu(const ITEM *item, uint8_t item_sum);
void Print_Value(const ITEM *item, uint8_t item_sum);
void Set_Vaule(ITEM *item, uint8_t item_num, float step);
void Show_Marked_Image(void);
uint16_t rgb_gradient(uint16_t i);
#endif