diff --git a/common/i2c/Base_I2C.c b/common/i2c/Base_I2C.c index ff59664df47d08bb1ad690d85c8a08ecbccdd2c0..18d2da9e707b363f072a99db37b93e9f729fcdbc 100644 --- a/common/i2c/Base_I2C.c +++ b/common/i2c/Base_I2C.c @@ -1,12 +1,15 @@ #include "Base_I2C.h" - -HAL_StatusTypeDef Base_I2C_WriteCmd(uint8_t* hi2cX, uint16_t addr, uint8_t* txData, uint8_t len, uint16_t timeout) +HAL_StatusTypeDef BASE_I2C_Write_Cmd(I2C_HandleTypeDef *hi2cX, uint16_t devAddr, + uint8_t *txData, uint16_t dataLen, uint16_t timeoutMs) { - return HAL_I2C_Master_Transmit((I2C_HandleTypeDef*)hi2cX, addr, (uint8_t*)txData, len, timeout); + return HAL_I2C_Master_Transmit(hi2cX, devAddr, txData, dataLen, timeoutMs); } -HAL_StatusTypeDef Base_I2C_ReadCmd(uint8_t* hi2cX, uint16_t addr, uint8_t* rxData, uint8_t len, uint16_t timeout) +HAL_StatusTypeDef BASE_I2C_Read_Regs(I2C_HandleTypeDef *hi2cX, uint16_t devAddr, + uint8_t regAddr, uint8_t *outBuffer, + uint16_t bufferLen, uint16_t timeoutMs) { - return HAL_I2C_Master_Receive((I2C_HandleTypeDef*)hi2cX, addr, (uint8_t*)rxData, len, timeout); -} + return HAL_I2C_Mem_Read(hi2cX, devAddr, regAddr, I2C_MEMADD_SIZE_8BIT, + outBuffer, bufferLen, timeoutMs); +} \ No newline at end of file diff --git a/common/i2c/Base_I2C.h b/common/i2c/Base_I2C.h index 9e79dad9bf2276ee49d05d031f8bcacd4c4c9285..5a896db71b7b5f1d7674bc8f93dc8d00f1dcfea6 100644 --- a/common/i2c/Base_I2C.h +++ b/common/i2c/Base_I2C.h @@ -1,39 +1,32 @@ -#ifndef __Base_I2C_H -#define __Base_I2C_H +#ifndef BASE_I2C_H +#define BASE_I2C_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "stm32f1xx_hal.h" #include "i2c.h" - /** - * @brief 通过 I2C 接口写入命令数据 - * @param hi2cX: 指向 I2C 句柄的指针,用于指定使用的 I2C 总线实例 - * @param addr: 目标设备的 I2C 地址(7bit),标识要与之通信的从设备 - * @param txData: 指向待发送数据的指针,包含了要写入 I2C 设备的命令或数据内容 - * @param len: 要发送数据的长度,即 txData 中数据的字节数 - * @param timeout: 操作超时时间,若在该时间内操作未完成,则操作失败;单位ms - * @retval HAL_StatusTypeDef: 操作状态,如 HAL_OK 表示成功,其他值表示失败 + * @brief I2C主机发送指令(纯数据发送,无寄存器地址) + * @param hi2cX : I2C句柄指针(如 &hi2c1) + * @param devAddr : I2C设备地址(左移前的7位地址) + * @param txData : 发送数据缓冲区指针 + * @param dataLen : 要发送的数据长度 + * @param timeoutMs : 超时时间(单位ms) + * @retval HAL_StatusTypeDef HAL库状态值(HAL_OK表示成功) */ -HAL_StatusTypeDef Base_I2C_WriteCmd(uint8_t* hi2cX, uint16_t addr, uint8_t* txData, uint8_t len, uint16_t timeout = 100); +HAL_StatusTypeDef BASE_I2C_Write_Cmd(I2C_HandleTypeDef *hi2cX, uint16_t devAddr, + uint8_t *txData, uint16_t dataLen, uint16_t timeoutMs); /** - * @brief 通过 I2C 接口读取命令响应数据 - * @param hi2cX: 指向 I2C 句柄的指针,用于指定使用的 I2C 总线实例 - * @param addr: 目标设备的 I2C 地址(7bit),标识要与之通信的从设备 - * @param rxData: 指向用于存储接收到数据的缓冲区的指针,读取到的数据会存于此 - * @param len: 要读取数据的长度,即期望从 I2C 设备读取的字节数 - * @param timeout: 操作超时时间,若在该时间内操作未完成,则操作失败;单位ms - * @retval HAL_StatusTypeDef: 操作状态,如 HAL_OK 表示成功,其他值表示失败 + * @brief 读取I2C设备多个连续寄存器 + * @param hi2cX : I2C句柄指针(如 &hi2c1) + * @param devAddr : 设备7位I2C地址(左移前) + * @param regAddr : 起始寄存器地址 + * @param outBuffer : 接收数据的缓冲区 + * @param bufferLen : 要读取的字节数 + * @param timeoutMs : 超时时间(单位ms) + * @retval HAL_OK 读取成功, 其他值读取失败 */ -HAL_StatusTypeDef Base_I2C_ReadCmd(uint8_t* hi2cx, uint16_t addr, uint8_t* rxData, uint8_t len, uint16_t timeout = 100); +HAL_StatusTypeDef BASE_I2C_Read_Regs(I2C_HandleTypeDef *hi2cX, uint16_t devAddr, + uint8_t regAddr, uint8_t *outBuffer, + uint16_t bufferLen, uint16_t timeoutMs); -#ifdef __cplusplus -} #endif - -#endif /* __Base_I2C_H */ -//author: 信息23 韩林杏 \ No newline at end of file diff --git a/modules/oled/.keep b/modules/oled/.keep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/modules/oled/HW_OLED.c b/modules/oled/HW_OLED.c index 37ea8b3689dfe99c5bc1d812f8ae6779414c4c85..3227257aabd2f38fd74bfd7fe98a933e62556034 100644 --- a/modules/oled/HW_OLED.c +++ b/modules/oled/HW_OLED.c @@ -1,387 +1,87 @@ -#include "oled_font.h" -#include "oled.h" -#include "Base_i2c.h" -#include "string.h" +#include "hw_oled.h" -#define LEFT 0x27 -#define RIGHT 0x26 -#define UP 0X29 -#define DOWN 0x2A // 修正拼写 -#define ON 0xA7 -#define OFF 0xA6 +static I2C_HandleTypeDef *gI2cHandle; // 全局I2C句柄指针 -#define OLED_Addr 0x78 - -uint16_t const displayWidth = 128; -uint16_t const displayHeight = 64; - -static uint8_t OLED_RAM[8][128]; - -// 修正形参命名为小驼峰 -void HW_OLED_WriteByte(uint8_t regAddr, uint8_t data) { - uint8_t TxData[2] = {regAddr, data}; - Base_I2C_WriteCmd(&hi2c1, OLED_Addr, (uint8_t*)TxData, 2, 10); -} - -// 修正形参命名为小驼峰 -void HW_OLED_WriteCmd(uint8_t iicCommand) { - HAL_I2C_WriteByte(0x00, iicCommand); -} - -// 修正形参命名为小驼峰 -void HW_OLED_WriteDat(uint8_t iicData) { - HAL_I2C_WriteByte(0x40, iicData); -} - -void HW_OLED_Init(void) { - HAL_Delay(500); - - HW_OLED_WriteCmd(0xAE); - HW_OLED_WriteCmd(0x20); - - HW_OLED_WriteCmd(0x10); - HW_OLED_WriteCmd(0xb0); - HW_OLED_WriteCmd(0x00); - HW_OLED_WriteCmd(0x10); - - HW_OLED_WriteCmd(0xc8); - HW_OLED_WriteCmd(0x40); - HW_OLED_WriteCmd(0x81); - HW_OLED_WriteCmd(0xff); - HW_OLED_WriteCmd(0xa1); - HW_OLED_WriteCmd(0xa6); - HW_OLED_WriteCmd(0xa8); - HW_OLED_WriteCmd(0x3F); - HW_OLED_WriteCmd(0xa4); - HW_OLED_WriteCmd(0xd3); - HW_OLED_WriteCmd(0x00); - HW_OLED_WriteCmd(0xd5); - HW_OLED_WriteCmd(0xf0); - HW_OLED_WriteCmd(0xd9); - HW_OLED_WriteCmd(0x22); - HW_OLED_WriteCmd(0xda); - HW_OLED_WriteCmd(0x12); - HW_OLED_WriteCmd(0xdb); - HW_OLED_WriteCmd(0x20); - HW_OLED_WriteCmd(0x8d); - HW_OLED_WriteCmd(0x14); - HW_OLED_WriteCmd(0xaf); - - HW_OLED_FullyClear(); -} - -void HW_OLED_On(void) { - HW_OLED_WriteCmd(0X8D); - HW_OLED_WriteCmd(0X14); - HW_OLED_WriteCmd(0XAF); +// 私有辅助函数 +static void OLED_Write_Byte(uint8_t regCtrl, uint8_t byteVal) +{ + uint8_t txBuf[2] = {regCtrl, byteVal}; + BASE_I2C_Write_Cmd(gI2cHandle, OLED_I2C_ADDR, txBuf, 2, 10); } -void HW_OLED_Off(void) { - HW_OLED_WriteCmd(0X8D); - HW_OLED_WriteCmd(0X10); - HW_OLED_WriteCmd(0XAE); +static void OLED_Write_Cmd(uint8_t cmd) +{ + OLED_Write_Byte(0x00, cmd); } -void HW_OLED_RefreshRAM(void) { - for(uint16_t m = 0; m < displayHeight/8; m++) { - HW_OLED_WriteCmd(0xb0 + m); - HW_OLED_WriteCmd(0x00); - HW_OLED_WriteCmd(0x10); - for(uint16_t n = 0; n < displayWidth; n++) { - HW_OLED_WriteDat(OLED_RAM[m][n]); - } - } +static void OLED_Write_Data(uint8_t data) +{ + OLED_Write_Byte(0x40, data); } -// 修正语法:直接初始化数组,去掉错误循环 -void HW_OLED_ClearRAM(void) { - memset(OLED_RAM, 0x00, sizeof(OLED_RAM)); +static void OLED_Set_Cursor(uint8_t page, uint8_t column) +{ + OLED_Write_Cmd(0xB0 | page); + OLED_Write_Cmd(0x10 | ((column & 0xF0) >> 4)); + OLED_Write_Cmd(0x00 | (column & 0x0F)); } -void HW_OLED_FullyFill(uint8_t fillData) { - for(uint16_t m = 0; m < displayHeight/8; m++) { - for(uint16_t n = 0; n < displayWidth; n++) { - OLED_RAM[m][n] = fillData; - } +static void OLED_Write_Batch(uint8_t page, uint8_t startCol, const uint8_t *data, uint8_t dataLen) +{ + OLED_Set_Cursor(page, startCol); + for (uint8_t i = 0; i < dataLen; ++i) + { + OLED_Write_Data(data[i]); } - HW_OLED_RefreshRAM(); } -void HW_OLED_FullyClear(void) { - HW_OLED_FullyFill(RESET_PIXEL); -} - -void HW_OLED_SetPixel(int16_t x, int16_t y, uint8_t setPixel) { - if (x >= 0 && x < displayWidth && y >= 0 && y < displayHeight) { - if (setPixel) { - OLED_RAM[y/8][x] |= (0x01 << (y%8)); - } else { - OLED_RAM[y/8][x] &= ~(0x01 << (y%8)); - } - } -} - -PixelStatus HW_OLED_GetPixel(int16_t x, int16_t y) { - if (OLED_RAM[y/8][x] >> (y%8) & 0x01) - return SET_PIXEL; - return RESET_PIXEL; -} - -// 修正形参命名:ch → str,TextSize → textSize -void HW_OLED_ShowStr(int16_t x, int16_t y, uint8_t str[], uint8_t textSize) { - if (x >= 0 && x < displayWidth && y >= 0 && y < displayHeight) { - int32_t c = 0; - uint8_t j = 0; - switch (textSize) { - case 1: { - while (str[j] != '\0') { - c = str[j] - 32; - if (c < 0) - break; - - if (x >= 125 || (127 - x < 6)) { - x = 0; - y += 8; - if (63 - y < 8) - break; - } - for (uint8_t m = 0; m < 6; m++) { - for (uint8_t n = 0; n < 8; n++) { - HW_OLED_SetPixel(x + m, y + n, (F6x8[c][m] >> n) & 0x01); - } - } - x += 6; - j++; - } - } break; - case 2: { - while (str[j] != '\0') { - c = str[j] - 32; - if (c < 0) - break; - - if (x >= 127 || (127 - x < 8)) { - x = 0; - y += 16; - if (63 - y < 16) - break; - } - for (uint8_t m = 0; m < 2; m++) { - for (uint8_t n = 0; n < 8; n++) { - for (uint8_t i = 0; i < 8; i++) { - HW_OLED_SetPixel(x + n, y + i + m*8, (F8X16[c][n + m*8] >> i) & 0x01); - } - } - } - x += 8; - j++; - } - } break; - } - } - HW_OLED_RefreshRAM(); -} - -void HW_OLED_ShowCN(int16_t x, int16_t y, uint8_t* str) { - if (x >= 0 && x < displayWidth && y >= 0 && y < displayHeight) { - int32_t len = 0, offset = sizeof(F16x16_CN[0].index); - - while (str[len] != '\0') { - if (x >= 127 || (127 - x < 16)) { - x = 0; - y += 16; - if (63 - y < 16) - break; - } - for (uint8_t i = 0; i < sizeof(F16x16_CN)/sizeof(GB2312_CN); i++) { - if (((F16x16_CN[i].index[0] == str[len]) && (F16x16_CN[i].index[1] == str[len+1]))) { - for (uint8_t m = 0; m < 2; m++) { - for (uint8_t n = 0; n < 16; n++) { - for (uint8_t j = 0; j < 8; j++) { - HW_OLED_SetPixel(x + n, y + j + m*8, (F16x16_CN[i].encoder[n + m*16] >> j) & 0x01); - } - } - } - x += 16; - len += offset; - break; - } - else if (F16x16_CN[i].index[0] == str[len] && str[len] == 0x20) { - for (uint8_t m = 0; m < 2; m++) { - for (uint8_t n = 0; n < 16; n++) { - for (uint8_t j = 0; j < 8; j++) { - HW_OLED_SetPixel(x + n, y + j + m*8, (F16x16_CN[i].encoder[n + m*16] >> j) & 0x01); - } - } - } - x += 16; - len++; - break; - } - } - } +static void OLED_Write_Page(uint8_t page, uint8_t fillValue) +{ + OLED_Set_Cursor(page, 0); + for (uint8_t i = 0; i < 128; ++i) + { + OLED_Write_Data(fillValue); } - HW_OLED_RefreshRAM(); } -void HW_OLED_ShowMixedCH(int16_t x, int16_t y, uint8_t* str) { - if (x >= 0 && x < displayWidth && y >= 0 && y < displayHeight) { - int32_t len = 0, c, offset = sizeof(F16x16_CN[0].index); - - while (str[len] != '\0') { - if (str[len] >= 0xa1) { - for (uint8_t i = 0; i < sizeof(F16x16_CN)/sizeof(GB2312_CN); i++) { - if (((F16x16_CN[i].index[0] == str[len]) && (F16x16_CN[i].index[1] == str[len+1]))) { - if (x >= 127 || (127 - x < 16)) { - x = 0; - y += 16; - if (63 - y < 16) - break; - } - for (uint8_t m = 0; m < 2; m++) { - for (uint8_t n = 0; n < 16; n++) { - for (uint8_t j = 0; j < 8; j++) { - HW_OLED_SetPixel(x + n, y + j + m*8, (F16x16_CN[i].encoder[n + m*16] >> j) & 0x01); - } - } - } - x += 16; - len += offset; - break; - } - } - } - else if (str[len] <= 127) { - c = str[len] - 32; - if (c < 0) - break; - if (x >= 127 || (127 - x < 8)) { - x = 0; - y += 16; - if (63 - y < 16) - break; - } - for (uint8_t m = 0; m < 2; m++) { - for (uint8_t n = 0; n < 8; n++) { - for (uint8_t i = 0; i < 8; i++) { - HW_OLED_SetPixel(x + n, y + i + m*8, (F8X16[c][n + m*8] >> i) & 0x01); - } - } - } - x += 8; - len++; - } - } +// 公共API +void HW_OLED_Init(void) +{ + gI2cHandle = &hi2c1; // 假设使用 hi2c1,根据实际修改 + HAL_Delay(100); + + // 初始化命令序列 + OLED_Write_Cmd(0xAE); // 关闭显示 + OLED_Write_Cmd(0xD5); OLED_Write_Cmd(0x80); + OLED_Write_Cmd(0xA8); OLED_Write_Cmd(0x3F); + OLED_Write_Cmd(0xD3); OLED_Write_Cmd(0x00); + OLED_Write_Cmd(0x40); // 起始行 + OLED_Write_Cmd(0xA1); // 左右反置 + OLED_Write_Cmd(0xC8); // 上下反置 + OLED_Write_Cmd(0xDA); OLED_Write_Cmd(0x12); + OLED_Write_Cmd(0x81); OLED_Write_Cmd(0xCF); + OLED_Write_Cmd(0xD9); OLED_Write_Cmd(0xF1); + OLED_Write_Cmd(0xDB); OLED_Write_Cmd(0x30); + OLED_Write_Cmd(0xA4); // 全局显示开启 + OLED_Write_Cmd(0xA6); // 正常显示 + OLED_Write_Cmd(0x8D); OLED_Write_Cmd(0x14); // 电荷泵使能 + OLED_Write_Cmd(0xAF); // 开启显示 + + HW_OLED_Clear(); +} + +void HW_OLED_Clear(void) +{ + for (uint8_t page = 0; page < 8; ++page) + { + OLED_Write_Page(page, 0x00); } - HW_OLED_RefreshRAM(); } -// 修正形参命名:L → width,H → height,BMP → bmpData -void HW_OLED_DrawBMP(int16_t x0, int16_t y0, int16_t width, int16_t height, const uint8_t bmpData[]) { - if (x0 >= 0 && x0 < displayWidth && x0 + width <= displayWidth && - y0 >= 0 && y0 < displayHeight && y0 + height <= displayHeight) { - uint8_t *p = (uint8_t *)bmpData; - for(int16_t y = y0; y < y0 + height; y +=8) { - for(int16_t x = x0; x < x0 + width; x++) { - for(int16_t i = 0; i < 8; i++) { - HW_OLED_SetPixel(x, y + i, ((*p) >> i) & 0x01); - } - p++; - } - } +void HW_OLED_Fill(void) +{ + for (uint8_t page = 0; page < 8; ++page) + { + OLED_Write_Page(page, 0xFF); } - HW_OLED_RefreshRAM(); } - -// 修正形参命名:L → width,H → height -void OLED_AreaFill(int16_t x0, int16_t y0, int16_t width, int16_t height, uint8_t fillData) { - if (x0 >= 0 && x0 < displayWidth && x0 + width <= displayWidth && - y0 >= 0 && y0 < displayHeight && y0 + height <= displayHeight) { - for(int16_t y = y0; y < y0 + height; y++) { - for(int16_t x = x0; x < x0 + width; x++) { - for(int16_t i = 0; i < 8; i++) { - HW_OLED_SetPixel(x, y + i, (fillData >> i) & SET_PIXEL); - } - } - } - HW_OLED_RefreshRAM(); - } -} - -// 修正形参命名:L → width,H → height -void OLED_AreaClear(int16_t x0, int16_t y0, int16_t width, int16_t height) { - if (x0 >= 0 && x0 < displayWidth && x0 + width <= displayWidth && - y0 >= 0 && y0 < displayHeight && y0 + height <= displayHeight) { - for(int16_t y = y0; y < y0 + height; y +=8) { - for(int16_t x = x0; x < x0 + width; x++) { - for(int16_t i = 0; i < 8; i++) { - HW_OLED_SetPixel(x, y + i, RESET_PIXEL); - } - } - } - HW_OLED_RefreshRAM(); - } -} - -void HW_OLED_FullyToggle(void) { - for(uint16_t m = 0; m < displayHeight/8; m++) { - for(uint16_t n = 0; n < displayWidth; n++) { - OLED_RAM[m][n] = ~OLED_RAM[m][n]; - } - } - HW_OLED_RefreshRAM(); -} - -// 修正形参命名:L → width,H → height -void HW_OLED_AreaToggle(int16_t x0, int16_t y0, int16_t width, int16_t height) { - if (x0 >= 0 && x0 < displayWidth && x0 + width <= displayWidth && - y0 >= 0 && y0 < displayHeight && y0 + height <= displayHeight) { - for(int16_t y = y0; y < y0 + height; y +=8) { - for(int16_t x = x0; x < x0 + width; x++) { - for(int16_t i = 0; i < 8; i++) { - HW_OLED_SetPixel(x, y + i, !HW_OLED_GetPixel(x, y + i)); - } - } - } - HW_OLED_RefreshRAM(); - } -} - -void HW_OLED_VerticalShift(void) { - for(uint8_t i = 0; i < displayHeight; i++) { - HW_OLED_WriteCmd(0xd3); - HW_OLED_WriteCmd(i); - HAL_Delay(40); - } -} - -void HW_OLED_HorizontalShift(uint8_t direction) { - HW_OLED_WriteCmd(direction); - HW_OLED_WriteCmd(0x00); - HW_OLED_WriteCmd(0x00); - HW_OLED_WriteCmd(0x05); - HW_OLED_WriteCmd(0x07); - HW_OLED_WriteCmd(0x00); - HW_OLED_WriteCmd(0xff); - HW_OLED_WriteCmd(0x2f); -} - -void HW_OLED_VerticalAndHorizontalShift(uint8_t direction) { - HW_OLED_WriteCmd(direction); - HW_OLED_WriteCmd(0x00); - HW_OLED_WriteCmd(0x00); - HW_OLED_WriteCmd(0x05); - HW_OLED_WriteCmd(0x07); - HW_OLED_WriteCmd(0x01); - HW_OLED_WriteCmd(0x2f); -} - -void HW_OLED_DisplayMode(uint8_t mode) { - HW_OLED_WriteCmd(mode); -} - -void HW_OLED_IntensityControl(uint8_t intensity) { - HW_OLED_WriteCmd(0x81); - HW_OLED_WriteCmd(intensity); -} - diff --git a/modules/oled/HW_OLED.h b/modules/oled/HW_OLED.h index 57ac6b3ea71e937f90c0a3c822a3966048b2aa10..a2bb3db2f5806c295f7e472c3706c048eaa8f51e 100644 --- a/modules/oled/HW_OLED.h +++ b/modules/oled/HW_OLED.h @@ -1,220 +1,67 @@ -#ifndef OLED_H__ -#define OLED_H__ +#ifndef HW_OLED_H +#define HW_OLED_H -#include "stm32f1xx_hal.h" // 包含HAL库 +#include "i2c.h" +#include "Base_I2C.h" -/* BMP图片说明 - 图片格式为位映射,索引分别对应图片的宽和高, - BMP_xx[H/8][L]; -*/ -extern const uint8_t BMP_Picture[64/8][64]; +// OLED控制命令宏定义 +#define OLED_CMD_LEFT 0x27 // 左移命令 +#define OLED_CMD_RIGHT 0x26 // 右移命令 +#define OLED_CMD_UP 0x29 // 上移命令 +#define OLED_CMD_DOWN 0x2A // 下移命令 +#define OLED_CMD_ON 0xA7 // 显示开启/点亮命令 +#define OLED_CMD_OFF 0xA6 // 显示关闭/熄灭命令 -/* 像素状态枚举 */ -typedef enum -{ - SET_PIXEL = 0x01, - RESET_PIXEL = 0x00, -} PixelStatus; +#define OLED_I2C_ADDR 0x78 // OLED I2C设备地址 -/** - * @brief 通过I2C写入一个字节数据 - * @param regAddr: 要写入数据的地址,取值范围为0x00 - 0xFF - * @param data: 要写入的字节数据,取值范围为0x00 - 0xFF - * @retval 无 - */ -void HW_OLED_WriteByte(uint8_t regAddr, uint8_t data); +//OLED屏幕参数 +#define OLED_WIDTH 128 // OLED宽度:128 +#define OLED_HEIGHT 64 // OLED高度:64 -/** - * @brief 写命令 - * @param iicCommand: 要写入的IIC命令,取值范围为0x00 - 0xFF - * @retval 无 - */ -void HW_OLED_WriteCmd(uint8_t iicCommand); - -/** - * @brief 写数据 - * @param iicData: 要写入的IIC数据,取值范围为0x00 - 0xFF - * @retval 无 - */ -void HW_OLED_WriteDat(uint8_t iicData); +//屏幕操作函数 /** - * @brief 初始化OLED模块 - * @param 无 - * @retval 无 + * @brief OLED初始化(上电必须调用) */ void HW_OLED_Init(void); /** - * @brief 打开OLED显示 - * @param 无 - * @retval 无 + * @brief OLED清屏(全黑) */ -void HW_OLED_On(void); +void HW_OLED_Clear(void); /** - * @brief 关闭OLED显示 -- 睡眠模式下,OLED功耗小于10uA - * @param 无 - * @retval 无 + * @brief OLED满屏点亮(全白) */ -void HW_OLED_Off(void); +void HW_OLED_Fill(void); /** - * @brief 全量刷新 - * @param 无 - * @retval 无 + * @brief 设置光标位置并连续写入多个字节数据(适用于非重复数据) + * @param page 页地址(0~7,对应 Y 坐标每 8 像素一页) + * @param column 列起始地址(0~127,对应 X 坐标) + * @param data 待写入的数据缓冲区指针 + * @param dataLen 要写入的字节数 */ -void HW_OLED_RefreshRAM(void); +static void HW_OLED_SetCursorAndWriteData(uint8_t page, uint8_t column, + const uint8_t *data, uint8_t dataLen); /** - * @brief 清空数据缓存 - * @param 无 - * @retval 无 + * @brief 将整页(128 列)填充为指定值 + * @param page 页地址(0~7) + * @param fillValue 填充值(0x00 清空,0xFF 全亮) */ -void HW_OLED_ClearRAM(void); +static void HW_OLED_WritePage(uint8_t page, uint8_t fillValue); /** - * @brief 全屏填充 0x00~0xff - * @param fillData: 填充数据(1字节),取值范围为0x00 - 0xFF - * @retval 无 + * @brief 向 OLED 写入命令字节 + * @param cmd 命令字节(如 0xAE 关闭显示) */ -void HW_OLED_FullyFill(uint8_t fillData); +static void HW_OLED_WriteCommand(uint8_t cmd); /** - * @brief 全屏清空 - * @param 无 - * @retval 无 + * @brief 向 OLED 写入数据字节(显示内容) + * @param data 要显示的数据字节(一列 8 像素点) */ -void HW_OLED_FullyClear(void); - -/** - * @brief 设置指定像素点的状态 - * @param x: 起始横坐标,取值范围为0 - 127 - * @param y: 起始纵坐标,取值范围为0 - 63 - * @param setPixel: 设置像素状态,取值为SET_PIXEL(点亮像素)或RESET_PIXEL(熄灭像素) - * @retval 无 - */ -void HW_OLED_SetPixel(int16_t x, int16_t y, uint8_t setPixel); - -/** - * @brief 获取指定像素点的状态 - * @param x: 起始横坐标,取值范围为0 - 127 - * @param y: 起始纵坐标,取值范围为0 - 63 - * @retval PixelStatus: 返回像素的状态,SET_PIXEL(像素点亮)或RESET_PIXEL(像素熄灭) - */ -PixelStatus HW_OLED_GetPixel(int16_t x, int16_t y); - -/** - * @brief 显示codetab.h中的ASCII字符,有6*8和8*16可选 - * @param x: 起始横坐标,取值范围为0 - 127 - * @param y: 起始纵坐标,取值范围为0 - 63 - * @param str[]: 要显示的字符串 - * @param textSize: 字体大小,取值为1(6*8字体)或2(8*16字体) - * @retval 无 - */ -void HW_OLED_ShowStr(int16_t x, int16_t y, uint8_t str[], uint8_t textSize); - -/** - * @brief 显示codetab.h中的汉字,16*16点阵 - * @param x: 起始横坐标,取值范围为0 - 127 - * @param y: 起始纵坐标,取值范围为0 - 7 - * @param str: 对应codetab.h中的汉字 - * @retval 无 - */ -void HW_OLED_ShowCN(int16_t x, int16_t y, uint8_t* str); - -/** - * @brief 显示codetab.h中的汉字,16*16点阵,英文,8*16点阵 - * @param x: 起始横坐标,取值范围为0 - 127 - * @param y: 起始纵坐标,取值范围为0 - 7 - * @param str: 对应codetab.h中的汉字和英文 - * @retval 无 - */ -void HW_OLED_ShowMixedCH(int16_t x, int16_t y, uint8_t* str); - -/** - * @brief 图片显示函数,显示BMP位图,格式使用二维数组存储 - * @param x0: 起始横坐标,取值范围为0 - 127 - * @param y0: 起始纵坐标,取值范围为0 - 63 - * @param width: 图片长度,取值需保证图片不会超出屏幕范围 - * @param height: 图片高度,取值需保证图片不会超出屏幕范围 - * @param bmpData: 位图数据 - * @retval 无 - */ -void HW_OLED_DrawBMP(int16_t x0, int16_t y0, int16_t width, int16_t height, const uint8_t bmpData[]); - -/** - * @brief 区域填充 - * @param x0: 起始横坐标,取值范围为0 - 127 - * @param y0: 起始纵坐标,取值范围为0 - 63 - * @param width: 填充区域长度,取值需保证区域不会超出屏幕范围 - * @param height: 填充区域高度,取值需保证区域不会超出屏幕范围 - * @param fillData: 填充数据,取值范围为0x00 - 0xFF - * @retval 无 - */ -void HW_OLED_AreaFill(int16_t x0, int16_t y0, int16_t width, int16_t height, uint8_t fillData); - -/** - * @brief 区域清空 - * @param x0: 起始横坐标,取值范围为0 - 127 - * @param y0: 起始纵坐标,取值范围为0 - 63 - * @param width: 清空区域长度,取值需保证区域不会超出屏幕范围 - * @param height: 清空区域高度,取值需保证区域不会超出屏幕范围 - * @retval 无 - */ -void HW_OLED_AreaClear(int16_t x0, int16_t y0, int16_t width, int16_t height); - -/** - * @brief 全屏反色显示 - * @param 无 - * @retval 无 - */ -void HW_OLED_FullyToggle(void); - -/** - * @brief 区域反色显示 - * @param x0: 起始横坐标,取值范围为0 - 127 - * @param y0: 起始纵坐标,取值范围为0 - 63 - * @param width: 反色区域长度,取值需保证区域不会超出屏幕范围 - * @param height: 反色区域高度,取值需保证区域不会超出屏幕范围 - * @retval 无 - */ -void HW_OLED_AreaToggle(int16_t x0, int16_t y0, int16_t width, int16_t height); - -/** - * @brief 全屏垂直滚动显示 - * @param 无 - * @retval 无 - */ -void HW_OLED_VerticalShift(void); - -/** - * @brief 全屏水平滚动显示 - * @param direction: 滚动方向,具体取值含义需根据实际实现确定 - * @retval 无 - */ -void HW_OLED_HorizontalShift(uint8_t direction); - -/** - * @brief 全屏同时垂直和水平滚动显示 - * @param direction: 滚动方向,具体取值含义需根据实际实现确定 - * @retval 无 - */ -void HW_OLED_VerticalAndHorizontalShift(uint8_t direction); - -/** - * @brief 屏幕显示模式选择 - * @param mode: 显示模式,具体取值含义需根据实际实现确定 - * @retval 无 - */ -void HW_OLED_DisplayMode(uint8_t mode); - -/** - * @brief 屏幕亮度控制 - * @param intensity: 亮度值,取值范围需根据实际硬件确定 - * @retval 无 - */ -void HW_OLED_IntensityControl(uint8_t intensity); +static void HW_OLED_WriteData(uint8_t data); #endif - diff --git a/modules/oled/HW_OLED_Font.h b/modules/oled/HW_OLED_Font.h deleted file mode 100644 index ee300e1deb82a03fd53d12a568104f22855e5b65..0000000000000000000000000000000000000000 --- a/modules/oled/HW_OLED_Font.h +++ /dev/null @@ -1,262 +0,0 @@ -#ifndef OLED_FONT_H__ -#define OLED_FONT_H__ -#ifdef __cplusplus - extern "C" { -#endif - -#include "stm32f1xx_hal.h" - -const uint8_t F6x8[][6] = -{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,// sp - 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00,// ! - 0x00, 0x00, 0x07, 0x00, 0x07, 0x00,// " - 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14,// # - 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12,// $ - 0x00, 0x62, 0x64, 0x08, 0x13, 0x23,// % - 0x00, 0x36, 0x49, 0x55, 0x22, 0x50,// & - 0x00, 0x00, 0x05, 0x03, 0x00, 0x00,// ' - 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00,// ( - 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00,// ) - 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14,// * - 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,// + - 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00,// , - 0x00, 0x08, 0x08, 0x08, 0x08, 0x08,// - - 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,// . - 0x00, 0x20, 0x10, 0x08, 0x04, 0x02,// / - 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0 - 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,// 1 - 0x00, 0x42, 0x61, 0x51, 0x49, 0x46,// 2 - 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31,// 3 - 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,// 4 - 0x00, 0x27, 0x45, 0x45, 0x45, 0x39,// 5 - 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6 - 0x00, 0x01, 0x71, 0x09, 0x05, 0x03,// 7 - 0x00, 0x36, 0x49, 0x49, 0x49, 0x36,// 8 - 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,// 9 - 0x00, 0x00, 0x36, 0x36, 0x00, 0x00,// : - 0x00, 0x00, 0x56, 0x36, 0x00, 0x00,// ; - 0x00, 0x08, 0x14, 0x22, 0x41, 0x00,// < - 0x00, 0x14, 0x14, 0x14, 0x14, 0x14,// = - 0x00, 0x00, 0x41, 0x22, 0x14, 0x08,// > - 0x00, 0x02, 0x01, 0x51, 0x09, 0x06,// ? - 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E,// @ - 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C,// A - 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,// B - 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,// C - 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C,// D - 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,// E - 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,// F - 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,// G - 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,// H - 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,// I - 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01,// J - 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,// K - 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,// L - 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F,// M - 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F,// N - 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,// O - 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,// P - 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q - 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46,// R - 0x00, 0x46, 0x49, 0x49, 0x49, 0x31,// S - 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,// T - 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,// U - 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,// V - 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F,// W - 0x00, 0x63, 0x14, 0x08, 0x14, 0x63,// X - 0x00, 0x07, 0x08, 0x70, 0x08, 0x07,// Y - 0x00, 0x61, 0x51, 0x49, 0x45, 0x43,// Z - 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,// [ - 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55,// 55 - 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,// ] - 0x00, 0x04, 0x02, 0x01, 0x02, 0x04,// ^ - 0x00, 0x40, 0x40, 0x40, 0x40, 0x40,// _ - 0x00, 0x00, 0x01, 0x02, 0x04, 0x00,// ' - 0x00, 0x20, 0x54, 0x54, 0x54, 0x78,// a - 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38,// b - 0x00, 0x38, 0x44, 0x44, 0x44, 0x20,// c - 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F,// d - 0x00, 0x38, 0x54, 0x54, 0x54, 0x18,// e - 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02,// f - 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,// g - 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78,// h - 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00,// i - 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,// j - 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,// k - 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00,// l - 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,// m - 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78,// n - 0x00, 0x38, 0x44, 0x44, 0x44, 0x38,// o - 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18,// p - 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC,// q - 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08,// r - 0x00, 0x48, 0x54, 0x54, 0x54, 0x20,// s - 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20,// t - 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C,// u - 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,// v - 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C,// w - 0x00, 0x44, 0x28, 0x10, 0x28, 0x44,// x - 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C,// y - 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44,// z - 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,// horiz lines -}; -/****************************************8*16的点阵************************************/ -const uint8_t F8X16[][16]= -{ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0 - 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1 - 0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2 - 0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3 - 0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4 - 0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5 - 0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6 - 0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7 - 0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8 - 0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9 - 0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10 - 0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11 - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12 - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13 - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14 - 0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15 - 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16 - 0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17 - 0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18 - 0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19 - 0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20 - 0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21 - 0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22 - 0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23 - 0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24 - 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25 - 0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26 - 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27 - 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28 - 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29 - 0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30 - 0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31 - 0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32 - 0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33 - 0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34 - 0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35 - 0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36 - 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37 - 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38 - 0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39 - 0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40 - 0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41 - 0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42 - 0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43 - 0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44 - 0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45 - 0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46 - 0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47 - 0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48 - 0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49 - 0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50 - 0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51 - 0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52 - 0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53 - 0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54 - 0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55 - 0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56 - 0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57 - 0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58 - 0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59 - 0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60 - 0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61 - 0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62 - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63 - 0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64 - 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65 - 0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66 - 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67 - 0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68 - 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69 - 0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70 - 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71 - 0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72 - 0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73 - 0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74 - 0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75 - 0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76 - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77 - 0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78 - 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79 - 0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80 - 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81 - 0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82 - 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83 - 0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84 - 0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85 - 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86 - 0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87 - 0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88 - 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89 - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90 - 0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91 - 0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92 - 0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93 - 0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94 -}; - -typedef struct { - char index[2]; - uint8_t encoder[32]; -}GB2312_CN; - -const GB2312_CN F16x16_CN[] = { - {"温", - 0x10,0x60,0x02,0x8C,0x00,0x00,0xFE,0x92,0x92,0x92,0x92,0x92,0xFE,0x00,0x00,0x00,0x04,0x04,0x7E,0x01,0x40,0x7E,0x42,0x42,0x7E,0x42,0x7E,0x42,0x42,0x7E,0x40,0x00,/*"温"*/ - }, - {"度", - 0x00,0x00,0xFC,0x24,0x24,0x24,0xFC,0x25,0x26,0x24,0xFC,0x24,0x24,0x24,0x04,0x00,0x40,0x30,0x8F,0x80,0x84,0x4C,0x55,0x25,0x25,0x25,0x55,0x4C,0x80,0x80,0x80,0x00,/*"度"*/ - } -}; - -const uint8_t BMP_Picture[64/8][64] = { -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, -0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x30,0x1E, -0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x3C,0x40,0x60,0x20,0x20,0x20,0x20, -0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60,0xC0,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x30,0x10,0x10,0x08,0x04,0x04,0x02,0xFD,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x10,0x10,0x0C,0x06,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE, -0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x07,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFB,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x30,0x00,0x00,0x00,0x00,0x03, -0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x50,0x80,0x00,0x00,0x80, -0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x70,0xF0,0x0F, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -}; - - - -#ifdef __cplusplus -} -#endif -#endif - - - - diff --git a/modules/oled/OLED_FONT_8X16_ENGLISH.h b/modules/oled/OLED_FONT_8X16_ENGLISH.h new file mode 100644 index 0000000000000000000000000000000000000000..9039df5c0d064c304c1089dc3652d88ddb94294a --- /dev/null +++ b/modules/oled/OLED_FONT_8X16_ENGLISH.h @@ -0,0 +1,199 @@ +#ifndef OLED_FONT_8X16_ENGLISH_H +#define OLED_FONT_8X16_ENGLISH_H + +#include + +static const uint8_t OLED_F8x16[][16]= +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},// 0 + + {0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00},//! 1 + + {0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//" 2 + + {0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00},//# 3 + + {0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00},//$ 4 + + {0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00},//% 5 + + {0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10},//& 6 + + {0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//' 7 + + {0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00},//( 8 + + {0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00},//) 9 + + {0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00},//* 10 + + {0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00},//+ 11 + + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00},//, 12 + + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01},//- 13 + + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00},//. 14 + + {0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00},/// 15 + + {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00},//0 16 + + {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},//1 17 + + {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00},//2 18 + + {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00},//3 19 + + {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00},//4 20 + + {0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00},//5 21 + + {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00},//6 22 + + {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00},//7 23 + + {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00},//8 24 + + {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00},//9 25 + + {0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00},//: 26 + + {0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00},//; 27 + + {0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00},//< 28 + + {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00},//= 29 + + {0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00},//> 30 + + {0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00},//? 31 + + {0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00},//@ 32 + + {0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20},//A 33 + + {0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00},//B 34 + + {0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00},//C 35 + + {0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00},//D 36 + + {0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00},//E 37 + + {0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00},//F 38 + + {0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00},//G 39 + + {0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20},//H 40 + + {0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},//I 41 + + {0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00},//J 42 + + {0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00},//K 43 + + {0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00},//L 44 + + {0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00},//M 45 + + {0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00},//N 46 + + {0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00},//O 47 + + {0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00},//P 48 + + {0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00},//Q 49 + + {0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20},//R 50 + + {0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00},//S 51 + + {0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00},//T 52 + + {0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00},//U 53 + + {0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00},//V 54 + + {0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00},//W 55 + + {0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20},//X 56 + + {0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00},//Y 57 + + {0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00},//Z 58 + + {0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00},//[ 59 + + {0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00},//\ 60 + + {0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00},//] 61 + + {0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//^ 62 + + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80},//_ 63 + + {0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//` 64 + + {0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20},//a 65 + + {0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00},//b 66 + + {0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00},//c 67 + + {0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20},//d 68 + + {0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00},//e 69 + + {0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},//f 70 + + {0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00},//g 71 + + {0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20},//h 72 + + {0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},//i 73 + + {0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00},//j 74 + + {0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00},//k 75 + + {0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},//l 76 + + {0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F},//m 77 + + {0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20},//n 78 + + {0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00},//o 79 + + {0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00},//p 80 + + {0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80},//q 81 + + {0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00},//r 82 + + {0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00},//s 83 + + {0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00},//t 84 + + {0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20},//u 85 + + {0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00},//v 86 + + {0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00},//w 87 + + {0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00},//x 88 + + {0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00},//y 89 + + {0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00},//z 90 + + {0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40},//{ 91 + + {0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00},//| 92 + + {0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00},//} 93 + + {0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}//~ 94 +}; + +#endif diff --git a/modules/oled/OLED_FONT_MANAGE.h b/modules/oled/OLED_FONT_MANAGE.h new file mode 100644 index 0000000000000000000000000000000000000000..aa8a781fbe1a53e0b4ed783b5577b2828013b879 --- /dev/null +++ b/modules/oled/OLED_FONT_MANAGE.h @@ -0,0 +1,23 @@ +#ifndef OLED_FONT_MANAGE_H +#define OLED_FONT_MANAGE_H + +#include +#include "HW_OLED.h" + +// 宏定义:选择当前使用的OLED字库(仅开启一个即可) +#define OLED_FONT_8X16_ENGLISH // 8x16英文字库(默认开启) +//#define OLED_FONT_16X16_CHINESE // 16x16中文字库 +//#define OLED_FONT_8X16_NUMBER // 8x16数字字库 + +#ifdef OLED_FONT_8X16_ENGLISH + #include "OLED_FONT_8X16_ENGLISH.h" +#elif defined(OLED_FONT_16X16_CHINESE) + #include "OLED_FONT_16X16_CHINESE.h" +#elif defined(OLED_FONT_8X16_NUMBER) + #include "OLED_FONT_8X16_NUMBER.h" +#else + + #include "OLED_FONT_8X16_ENGLISH.h" // 无任何字库定义时,默认加载标准英文字库 +#endif + +#endif