feat: 显示优化

This commit is contained in:
2024-01-07 17:20:10 +08:00
parent 21fa49966f
commit 36b25f8d00
5 changed files with 229 additions and 149 deletions

View File

@@ -497,6 +497,27 @@ void ips200_draw_point(uint16 x, uint16 y, const uint16 color)
}
}
void ips200_draw_rect(uint16 x1, uint16 y1, uint16 x2, uint16 y2, const uint16 color)
{
if (IPS200_TYPE_SPI == ips200_display_type) {
IPS200_CS(0);
}
ips200_set_region(x1, y1, x2, y2);
for (uint16_t i = ((x2 - x1 + 1) * (y2 - y1 + 1)); i > 0; i--) {
ips200_write_16bit_data(color);
}
if (IPS200_TYPE_SPI == ips200_display_type) {
IPS200_CS(1);
}
}
void ips200_draw_frame(uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint16_t d, const uint16 color)
{
ips200_draw_rect(x1, y1, x2, y1 + d, color);
ips200_draw_rect(x1, y2 - d, x2, y2, color);
ips200_draw_rect(x1, y1, x1 + d, y2, color);
ips200_draw_rect(x2 - d, y1, x2, y2, color);
}
//-------------------------------------------------------------------------------------------------------------------
// 函数简介 IPS200 画线
// 参数说明 x_start 坐标 x 方向的起点 [0, ips200_x_max-1]