diff --git a/app/main.c b/app/main.c index 093ebf3..1d8b9d2 100644 --- a/app/main.c +++ b/app/main.c @@ -26,8 +26,11 @@ #include "by_fan_control.h" #include "./page/cw_page.h" #include "jj_blueteeth.h" +#include "./page/cw_page_ui_widget.h" + int main(void) { + clock_init(SYSTEM_CLOCK_120M); system_delay_init(); debug_init(); diff --git a/app/page/cw_page_ui_widget.c b/app/page/cw_page_ui_widget.c index 594bf99..af04117 100644 --- a/app/page/cw_page_ui_widget.c +++ b/app/page/cw_page_ui_widget.c @@ -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 +} \ No newline at end of file diff --git a/app/page/cw_page_ui_widget.h b/app/page/cw_page_ui_widget.h index 666ef27..a7c368f 100644 --- a/app/page/cw_page_ui_widget.h +++ b/app/page/cw_page_ui_widget.h @@ -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 diff --git a/libraries/zf_device/zf_device_ips200.c b/libraries/zf_device/zf_device_ips200.c index fdd330b..fcfd78e 100644 --- a/libraries/zf_device/zf_device_ips200.c +++ b/libraries/zf_device/zf_device_ips200.c @@ -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] diff --git a/libraries/zf_device/zf_device_ips200.h b/libraries/zf_device/zf_device_ips200.h index 96239ba..6169e6b 100644 --- a/libraries/zf_device/zf_device_ips200.h +++ b/libraries/zf_device/zf_device_ips200.h @@ -1,176 +1,170 @@ /********************************************************************************************************************* -* CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库 -* Copyright (c) 2022 SEEKFREE 逐飞科技 -* -* 本文件是CH32V307VCT6 开源库的一部分 -* -* CH32V307VCT6 开源库 是免费软件 -* 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款 -* 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它 -* -* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证 -* 甚至没有隐含的适销性或适合特定用途的保证 -* 更多细节请参见 GPL -* -* 您应该在收到本开源库的同时收到一份 GPL 的副本 -* 如果没有,请参阅 -* -* 额外注明: -* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本 -* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中 -* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件 -* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明) -* -* 文件名称 zf_device_ips200 -* 公司名称 成都逐飞科技有限公司 -* 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明 -* 开发环境 MounRiver Studio V1.8.1 -* 适用平台 CH32V307VCT6 -* 店铺链接 https://seekfree.taobao.com/ -* -* 修改记录 -* 日期 作者 备注 -* 2022-09-15 大W first version -********************************************************************************************************************/ + * CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库 + * Copyright (c) 2022 SEEKFREE 逐飞科技 + * + * 本文件是CH32V307VCT6 开源库的一部分 + * + * CH32V307VCT6 开源库 是免费软件 + * 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款 + * 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它 + * + * 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证 + * 甚至没有隐含的适销性或适合特定用途的保证 + * 更多细节请参见 GPL + * + * 您应该在收到本开源库的同时收到一份 GPL 的副本 + * 如果没有,请参阅 + * + * 额外注明: + * 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本 + * 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中 + * 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件 + * 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明) + * + * 文件名称 zf_device_ips200 + * 公司名称 成都逐飞科技有限公司 + * 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明 + * 开发环境 MounRiver Studio V1.8.1 + * 适用平台 CH32V307VCT6 + * 店铺链接 https://seekfree.taobao.com/ + * + * 修改记录 + * 日期 作者 备注 + * 2022-09-15 大W first version + ********************************************************************************************************************/ /********************************************************************************************************************* -* 接线定义: -* ------------------------------------ -* 模块管脚 单片机管脚 -* // 双排排针 并口两寸屏 硬件引脚 -* RD 查看 zf_device_ips200.h 中 IPS200_RD_PIN_PARALLEL8 宏定义 -* WR 查看 zf_device_ips200.h 中 IPS200_WR_PIN_PARALLEL8 宏定义 -* RS 查看 zf_device_ips200.h 中 IPS200_RS_PIN_PARALLEL8 宏定义 -* RST 查看 zf_device_ips200.h 中 IPS200_RST_PIN_PARALLEL8 宏定义 -* CS 查看 zf_device_ips200.h 中 IPS200_CS_PIN_PARALLEL8 宏定义 -* BL 查看 zf_device_ips200.h 中 IPS200_BL_PIN_PARALLEL8 宏定义 -* D0-D7 查看 zf_device_ips200.h 中 IPS200_Dx_PIN_PARALLEL8 宏定义 -* // 单排排针 SPI 两寸屏 硬件引脚 -* SCL 查看 zf_device_ips200.h 中 IPS200_SCL_PIN_SPI 宏定义 -* SDA 查看 zf_device_ips200.h 中 IPS200_SDA_PIN_SPI 宏定义 -* RST 查看 zf_device_ips200.h 中 IPS200_RST_PIN_SPI 宏定义 -* DC 查看 zf_device_ips200.h 中 IPS200_DC_PIN_SPI 宏定义 -* CS 查看 zf_device_ips200.h 中 IPS200_CS_PIN_SPI 宏定义 -* BLk 查看 zf_device_ips200.h 中 IPS200_BLk_PIN_SPI 宏定义 -* 电源引脚 -* VCC 3.3V电源 -* GND 电源地 -* 最大分辨率 320 * 240 -* ------------------------------------ -********************************************************************************************************************/ + * 接线定义: + * ------------------------------------ + * 模块管脚 单片机管脚 + * // 双排排针 并口两寸屏 硬件引脚 + * RD 查看 zf_device_ips200.h 中 IPS200_RD_PIN_PARALLEL8 宏定义 + * WR 查看 zf_device_ips200.h 中 IPS200_WR_PIN_PARALLEL8 宏定义 + * RS 查看 zf_device_ips200.h 中 IPS200_RS_PIN_PARALLEL8 宏定义 + * RST 查看 zf_device_ips200.h 中 IPS200_RST_PIN_PARALLEL8 宏定义 + * CS 查看 zf_device_ips200.h 中 IPS200_CS_PIN_PARALLEL8 宏定义 + * BL 查看 zf_device_ips200.h 中 IPS200_BL_PIN_PARALLEL8 宏定义 + * D0-D7 查看 zf_device_ips200.h 中 IPS200_Dx_PIN_PARALLEL8 宏定义 + * // 单排排针 SPI 两寸屏 硬件引脚 + * SCL 查看 zf_device_ips200.h 中 IPS200_SCL_PIN_SPI 宏定义 + * SDA 查看 zf_device_ips200.h 中 IPS200_SDA_PIN_SPI 宏定义 + * RST 查看 zf_device_ips200.h 中 IPS200_RST_PIN_SPI 宏定义 + * DC 查看 zf_device_ips200.h 中 IPS200_DC_PIN_SPI 宏定义 + * CS 查看 zf_device_ips200.h 中 IPS200_CS_PIN_SPI 宏定义 + * BLk 查看 zf_device_ips200.h 中 IPS200_BLk_PIN_SPI 宏定义 + * 电源引脚 + * VCC 3.3V电源 + * GND 电源地 + * 最大分辨率 320 * 240 + * ------------------------------------ + ********************************************************************************************************************/ #ifndef _zf_device_ips200_h_ #define _zf_device_ips200_h_ #include "zf_common_typedef.h" - // --------------------单排两寸屏幕 SPI 接口引脚定义--------------------// -#define IPS200_USE_SOFT_SPI (0 ) // 默认使用硬件 SPI 方式驱动 建议使用硬件 SPI 方式驱动 -#if IPS200_USE_SOFT_SPI // 这两段 颜色正常的才是正确的 颜色灰的就是没有用的 +#define IPS200_USE_SOFT_SPI (0) // 默认使用硬件 SPI 方式驱动 建议使用硬件 SPI 方式驱动 +#if IPS200_USE_SOFT_SPI // 这两段 颜色正常的才是正确的 颜色灰的就是没有用的 //====================================================软件 SPI 驱动==================================================== // 如果使用的是单排排针的两寸屏幕 SPI 驱动控制引脚 可以修改 -#define IPS200_SOFT_SPI_DELAY (1 ) // 软件 SPI 的时钟延时周期 数值越小 SPI 通信速率越快 -#define IPS200_SCL_PIN (B13) // 软件 SPI SCK 引脚 -#define IPS200_SDA_PIN (B15) // 软件 SPI MOSI 引脚 +#define IPS200_SOFT_SPI_DELAY (1) // 软件 SPI 的时钟延时周期 数值越小 SPI 通信速率越快 +#define IPS200_SCL_PIN (B13) // 软件 SPI SCK 引脚 +#define IPS200_SDA_PIN (B15) // 软件 SPI MOSI 引脚 //====================================================软件 SPI 驱动==================================================== #else //====================================================硬件 SPI 驱动==================================================== // 如果使用的是单排排针的两寸屏幕 SPI 驱动控制引脚 可以修改 -#define IPS200_SPI_SPEED (72 * 1000 * 1000 ) // 硬件 SPI 速率 这里设置为系统时钟二分频 -#define IPS200_SPI (SPI_2 ) // 硬件 SPI 号 -#define IPS200_SCL_PIN_SPI (SPI2_MAP0_SCK_B13 ) // 硬件 SPI SCK 引脚 -#define IPS200_SDA_PIN_SPI (SPI2_MAP0_MOSI_B15) // 硬件 SPI MOSI 引脚 +#define IPS200_SPI_SPEED (72 * 1000 * 1000) // 硬件 SPI 速率 这里设置为系统时钟二分频 +#define IPS200_SPI (SPI_2) // 硬件 SPI 号 +#define IPS200_SCL_PIN_SPI (SPI2_MAP0_SCK_B13) // 硬件 SPI SCK 引脚 +#define IPS200_SDA_PIN_SPI (SPI2_MAP0_MOSI_B15) // 硬件 SPI MOSI 引脚 //====================================================硬件 SPI 驱动==================================================== #endif // 如果使用的是单排排针的两寸屏幕 SPI 驱动控制引脚 可以修改 -#define IPS200_RST_PIN_SPI (D8 ) // 液晶复位引脚定义 -#define IPS200_DC_PIN_SPI (D9 ) // 液晶命令位引脚定义 -#define IPS200_CS_PIN_SPI (D10 ) -#define IPS200_BLk_PIN_SPI (D11 ) - +#define IPS200_RST_PIN_SPI (D8) // 液晶复位引脚定义 +#define IPS200_DC_PIN_SPI (D9) // 液晶命令位引脚定义 +#define IPS200_CS_PIN_SPI (D10) +#define IPS200_BLk_PIN_SPI (D11) // --------------------单排两寸屏幕 SPI 接口引脚定义--------------------// - - // --------------------双排两寸屏幕并口引脚定义--------------------// -#define IPS200_RD_PIN_PARALLEL8 (B13) -#define IPS200_WR_PIN_PARALLEL8 (B15) -#define IPS200_RS_PIN_PARALLEL8 (B7 ) -#define IPS200_RST_PIN_PARALLEL8 (D7 ) -#define IPS200_CS_PIN_PARALLEL8 (D4 ) -#define IPS200_BL_PIN_PARALLEL8 (D0 ) +#define IPS200_RD_PIN_PARALLEL8 (B13) +#define IPS200_WR_PIN_PARALLEL8 (B15) +#define IPS200_RS_PIN_PARALLEL8 (B7) +#define IPS200_RST_PIN_PARALLEL8 (D7) +#define IPS200_CS_PIN_PARALLEL8 (D4) +#define IPS200_BL_PIN_PARALLEL8 (D0) -//8 个数据引脚必须连续 例如 B0-B7,B6-B13 等等。 +// 8 个数据引脚必须连续 例如 B0-B7,B6-B13 等等。 //--------------数据端口寄存器-------------- -#define IPS200_DATAPORT GPIOE +#define IPS200_DATAPORT GPIOE //--------------数据端口起始地址偏移-------------- -#define DATA_START_NUM 0 +#define DATA_START_NUM 0 -//例:D1-D8 IPS200_DATAPORT 设置为 GPIOD DATA_START_NUM 设置为 1 -//例:C5-C12 IPS200_DATAPORT 设置为 GPIOC DATA_START_NUM 设置为 5 -// --------------------双排 SPI 接口两寸屏幕引脚定义--------------------// +// 例:D1-D8 IPS200_DATAPORT 设置为 GPIOD DATA_START_NUM 设置为 1 +// 例:C5-C12 IPS200_DATAPORT 设置为 GPIOC DATA_START_NUM 设置为 5 +// --------------------双排 SPI 接口两寸屏幕引脚定义--------------------// -#define IPS200_DEFAULT_DISPLAY_DIR (IPS200_PORTAIT) // 默认的显示方向 -#define IPS200_DEFAULT_PENCOLOR (RGB565_YELLOW ) // 默认的画笔颜色 -#define IPS200_DEFAULT_BGCOLOR (RGB565_BLACK ) // 默认的背景颜色 -#define IPS200_DEFAULT_DISPLAY_FONT (IPS200_8X16_FONT) // 默认的字体模式 +#define IPS200_DEFAULT_DISPLAY_DIR (IPS200_PORTAIT) // 默认的显示方向 +#define IPS200_DEFAULT_PENCOLOR (RGB565_YELLOW) // 默认的画笔颜色 +#define IPS200_DEFAULT_BGCOLOR (RGB565_BLACK) // 默认的背景颜色 +#define IPS200_DEFAULT_DISPLAY_FONT (IPS200_8X16_FONT) // 默认的字体模式 // 控制语句 -#define IPS200_RD(x) ((x) ? (gpio_high(IPS200_RD_PIN_PARALLEL8)) : (gpio_low(IPS200_RD_PIN_PARALLEL8))) -#define IPS200_WR(x) ((x) ? (gpio_high(IPS200_WR_PIN_PARALLEL8)) : (gpio_low(IPS200_WR_PIN_PARALLEL8))) -#define IPS200_RST(x) ((x) ? (gpio_high(ips_rst_pin)) : (gpio_low(ips_rst_pin))) -#define IPS200_BL(x) ((x) ? (gpio_high(ips_bl_pin)) : (gpio_low(ips_bl_pin))) -#define IPS200_RS(x) ((x) ? (gpio_high(IPS200_RS_PIN_PARALLEL8)) : (gpio_low(IPS200_RS_PIN_PARALLEL8))) +#define IPS200_RD(x) ((x) ? (gpio_high(IPS200_RD_PIN_PARALLEL8)) : (gpio_low(IPS200_RD_PIN_PARALLEL8))) +#define IPS200_WR(x) ((x) ? (gpio_high(IPS200_WR_PIN_PARALLEL8)) : (gpio_low(IPS200_WR_PIN_PARALLEL8))) +#define IPS200_RST(x) ((x) ? (gpio_high(ips_rst_pin)) : (gpio_low(ips_rst_pin))) +#define IPS200_BL(x) ((x) ? (gpio_high(ips_bl_pin)) : (gpio_low(ips_bl_pin))) +#define IPS200_RS(x) ((x) ? (gpio_high(IPS200_RS_PIN_PARALLEL8)) : (gpio_low(IPS200_RS_PIN_PARALLEL8))) -#define IPS200_DC(x) ((x) ? (gpio_high(IPS200_DC_PIN_SPI)) : (gpio_low(IPS200_DC_PIN_SPI))) -#define IPS200_CS(x) ((x) ? (gpio_high(ips_cs_pin)) : (gpio_low(ips_cs_pin))) +#define IPS200_DC(x) ((x) ? (gpio_high(IPS200_DC_PIN_SPI)) : (gpio_low(IPS200_DC_PIN_SPI))) +#define IPS200_CS(x) ((x) ? (gpio_high(ips_cs_pin)) : (gpio_low(ips_cs_pin))) +typedef enum { + IPS200_TYPE_SPI, // SPI 驱动 + IPS200_TYPE_PARALLEL8, // 并口驱动 +} ips200_type_enum; -typedef enum -{ - IPS200_TYPE_SPI, // SPI 驱动 - IPS200_TYPE_PARALLEL8, // 并口驱动 -}ips200_type_enum; +typedef enum { + IPS200_PORTAIT = 0, // 竖屏模式 + IPS200_PORTAIT_180 = 1, // 竖屏模式 旋转 180 + IPS200_CROSSWISE = 2, // 横屏模式 + IPS200_CROSSWISE_180 = 3, // 横屏模式 旋转 180 +} ips200_dir_enum; -typedef enum -{ - IPS200_PORTAIT = 0, // 竖屏模式 - IPS200_PORTAIT_180 = 1, // 竖屏模式 旋转 180 - IPS200_CROSSWISE = 2, // 横屏模式 - IPS200_CROSSWISE_180 = 3, // 横屏模式 旋转 180 -}ips200_dir_enum; +typedef enum { + IPS200_6X8_FONT = 0, // 6x8 字体 + IPS200_8X16_FONT = 1, // 8x16 字体 + IPS200_16X16_FONT = 2, // 16x16 字体 目前不支持 +} ips200_font_size_enum; -typedef enum -{ - IPS200_6X8_FONT = 0, // 6x8 字体 - IPS200_8X16_FONT = 1, // 8x16 字体 - IPS200_16X16_FONT = 2, // 16x16 字体 目前不支持 -}ips200_font_size_enum; +void ips200_clear(void); +void ips200_full(const uint16 color); +void ips200_set_dir(ips200_dir_enum dir); +void ips200_set_font(ips200_font_size_enum font); +void ips200_set_color(const uint16 pen, const uint16 bgcolor); +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); +void ips200_draw_frame(uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint16_t d, const uint16 color); +void ips200_draw_line(uint16 x_start, uint16 y_start, uint16 x_end, uint16 y_end, const uint16 color); -void ips200_clear (void); -void ips200_full (const uint16 color); -void ips200_set_dir (ips200_dir_enum dir); -void ips200_set_font (ips200_font_size_enum font); -void ips200_set_color (const uint16 pen, const uint16 bgcolor); -void ips200_draw_point (uint16 x, uint16 y, const uint16 color); -void ips200_draw_line (uint16 x_start, uint16 y_start, uint16 x_end, uint16 y_end, const uint16 color); +void ips200_show_char(uint16 x, uint16 y, const char dat); +void ips200_show_string(uint16 x, uint16 y, const char dat[]); +void ips200_show_int(uint16 x, uint16 y, const int32 dat, uint8 num); +void ips200_show_uint(uint16 x, uint16 y, const uint32 dat, uint8 num); +void ips200_show_float(uint16 x, uint16 y, const double dat, uint8 num, uint8 pointnum); -void ips200_show_char (uint16 x, uint16 y, const char dat); -void ips200_show_string (uint16 x, uint16 y, const char dat[]); -void ips200_show_int (uint16 x, uint16 y, const int32 dat, uint8 num); -void ips200_show_uint (uint16 x, uint16 y, const uint32 dat, uint8 num); -void ips200_show_float (uint16 x, uint16 y, const double dat, uint8 num, uint8 pointnum); +void ips200_show_binary_image(uint16 x, uint16 y, const uint8 *image, uint16 width, uint16 height, uint16 dis_width, uint16 dis_height); +void ips200_show_gray_image(uint16 x, uint16 y, const uint8 *image, uint16 width, uint16 height, uint16 dis_width, uint16 dis_height, uint8 threshold); +void ips200_show_rgb565_image(uint16 x, uint16 y, const uint16 *image, uint16 width, uint16 height, uint16 dis_width, uint16 dis_height, uint8 color_mode); -void ips200_show_binary_image (uint16 x, uint16 y, const uint8 *image, uint16 width, uint16 height, uint16 dis_width, uint16 dis_height); -void ips200_show_gray_image (uint16 x, uint16 y, const uint8 *image, uint16 width, uint16 height, uint16 dis_width, uint16 dis_height, uint8 threshold); -void ips200_show_rgb565_image (uint16 x, uint16 y, const uint16 *image, uint16 width, uint16 height, uint16 dis_width, uint16 dis_height, uint8 color_mode); - -void ips200_show_wave (uint16 x, uint16 y, const uint16 *wave, uint16 width, uint16 value_max, uint16 dis_width, uint16 dis_value_max); -void ips200_show_chinese (uint16 x, uint16 y, uint8 size, const uint8 *chinese_buffer, uint8 number, const uint16 color); +void ips200_show_wave(uint16 x, uint16 y, const uint16 *wave, uint16 width, uint16 value_max, uint16 dis_width, uint16 dis_value_max); +void ips200_show_chinese(uint16 x, uint16 y, uint8 size, const uint8 *chinese_buffer, uint8 number, const uint16 color); //------------------------------------------------------------------------------------------------------------------- // 函数简介 IPS200 显示小钻风图像 @@ -181,7 +175,7 @@ void ips200_show_chinese (uint16 x, uint16 y, uint8 size, const u // 使用示例 ips200_displayimage7725(ov7725_image_binary[0], 80, 60); // 备注信息 //------------------------------------------------------------------------------------------------------------------- -#define ips200_displayimage7725(p, width, height) (ips200_show_binary_image(0, 0, (p), OV7725_W, OV7725_H, (width), (height))) +#define ips200_displayimage7725(p, width, height) (ips200_show_binary_image(0, 0, (p), OV7725_W, OV7725_H, (width), (height))) //------------------------------------------------------------------------------------------------------------------- // 函数简介 IPS200 显示总钻风图像 不带二值化 显示灰度图像 @@ -192,7 +186,7 @@ void ips200_show_chinese (uint16 x, uint16 y, uint8 size, const u // 使用示例 ips200_displayimage03x(mt9v03x_image[0], 94, 60); // 备注信息 如果要显示二值化图像就去调用 ips200_show_gray_image 函数 //------------------------------------------------------------------------------------------------------------------- -#define ips200_displayimage03x(p, width, height) (ips200_show_gray_image(0, 0, (p), MT9V03X_W, MT9V03X_H, (width), (height), 0)) +#define ips200_displayimage03x(p, width, height) (ips200_show_gray_image(0, 0, (p), MT9V03X_W, MT9V03X_H, (width), (height), 0)) //------------------------------------------------------------------------------------------------------------------- // 函数简介 IPS200 显示凌瞳图像 @@ -203,8 +197,8 @@ void ips200_show_chinese (uint16 x, uint16 y, uint8 size, const u // 使用示例 ips200_displayimage8660(scc8660_image[0], 80, 60); // 备注信息 //------------------------------------------------------------------------------------------------------------------- -#define ips200_displayimage8660(p, width, height) (ips200_show_rgb565_image(0, 0, (p), SCC8660_W, SCC8660_H, (width), (height), 1)) +#define ips200_displayimage8660(p, width, height) (ips200_show_rgb565_image(0, 0, (p), SCC8660_W, SCC8660_H, (width), (height), 1)) -void ips200_init (ips200_type_enum type_select); +void ips200_init(ips200_type_enum type_select); #endif