Merge branch 'ADD-LCD'

This commit is contained in:
yxming66 2025-11-29 17:37:08 +08:00
commit 938bca1918
71 changed files with 6349 additions and 3234 deletions

View File

@ -29,8 +29,7 @@
#include <string.h>
#include "stdio.h"
#include "sx1281.h"
#include "device/lcd.h"
#include "device/lcd_init.h"
#include "device/lcd_driver/lcd.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@ -63,7 +62,8 @@ void SystemClock_Config(void);
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
SX1281_t radio;
float t;
extern const unsigned char logo_M[];
/* USER CODE END 0 */
/**
@ -102,12 +102,39 @@ int main(void)
MX_USART1_UART_Init();
MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */
// SX1281_Init(&radio,MODE_LORA);
// SX1281_SetRXSuccessive();
// SX1281_SetTX();
LCD_Init();
// HAL_Delay(1000);
LCD_Fill(0,0,LCD_W,LCD_H,WHITE);
// 初始化SX1281为BLE模式
SX1281_Init(&radio, MODE_BLE);
LCD_Init(1);
LCD_Clear(BLACK);
// 构造标准的BLE广告数据有效载荷部分
// 注意这是PDU的有效载荷不包括2字节的PDU报头
// BLE广告数据最大长度为37字节
uint8_t advData[] = {
// 标志位
0x02, 0x01, 0x06,
// 完整设备名称
0x08, 0x09, 'S','X','1','2','8','1','_','1',
// 服务UUID
0x03, 0x03, 0x0A, 0x18,
// 制造商特定数据 - 包含自定义设备ID
0x07, 0xFF, 0x4D, 0x52, 0x31, 0x36, 0x01, 0x02,
// 解释:
// 0x07 - 长度 (7 bytes)
// 0xFF - 制造商特定数据类型
// 0x4D,0x52,0x31,0x36 - "MR16" (您的设备标识)
// 0x01,0x02 - 版本或设备编号
};
printf("Starting BLE Advertising...\n");
printf("Advertising data length: %d bytes\n", sizeof(advData));
// 设置并发送BLE广告包
SetBLEAdvertisingPacket(&radio,advData, sizeof(advData));
/* USER CODE END 2 */
/* Infinite loop */
@ -117,11 +144,25 @@ int main(void)
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
// 处理射频中断
SX1281_Running();
// SX1281_Running();
// LCD_ShowFloatNum1(10,99,t,4,RED,WHITE,32);
t+=0.11;
// 每2秒重新发送一次广告包
static uint32_t lastAdvTime = 0;
if (HAL_GetTick() - lastAdvTime > 2000) {
SetBLEAdvertisingPacket(&radio,advData, sizeof(advData));
lastAdvTime = HAL_GetTick();
printf("Resending BLE Advertisement...\n");
}
// LCD显示
LCD_DrawString(200,0,"BLE",AQUA,12,LSB);
LCD_DrawString(150,0,"ADV",VIOLET,16,LSB);
LCD_DrawString(80,0,"SX1281",VIOLET_SOFT,24,LSB);
LCD_DrawString(0,0,"SX12811",MEDIUMORCHID,32,LSB);
LCD_DrawBitmap(logo_M,70,70,64,64,MEDIUMORCHID,MSB);
HAL_Delay(100);
}
/* USER CODE END 3 */
}

File diff suppressed because one or more lines are too long

View File

@ -849,36 +849,36 @@
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>49</FileNumber>
<FileType>1</FileType>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\device\lcd.c</PathWithFileName>
<FilenameWithoutPath>lcd.c</FilenameWithoutPath>
<PathWithFileName>..\User\device\device.h</PathWithFileName>
<FilenameWithoutPath>device.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>50</FileNumber>
<FileType>5</FileType>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\device\lcd.h</PathWithFileName>
<FilenameWithoutPath>lcd.h</FilenameWithoutPath>
<PathWithFileName>..\User\device\lcd_driver\lcd.c</PathWithFileName>
<FilenameWithoutPath>lcd.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>51</FileNumber>
<FileType>1</FileType>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\device\lcd_init.c</PathWithFileName>
<FilenameWithoutPath>lcd_init.c</FilenameWithoutPath>
<PathWithFileName>..\User\device\lcd_driver\lcd.h</PathWithFileName>
<FilenameWithoutPath>lcd.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -889,32 +889,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\device\lcd_init.h</PathWithFileName>
<FilenameWithoutPath>lcd_init.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>53</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\device\lcdfont.h</PathWithFileName>
<FilenameWithoutPath>lcdfont.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>54</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\device\pic.h</PathWithFileName>
<FilenameWithoutPath>pic.h</FilenameWithoutPath>
<PathWithFileName>..\User\device\lcd_driver\lcd_lib.h</PathWithFileName>
<FilenameWithoutPath>lcd_lib.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -928,7 +904,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>8</GroupNumber>
<FileNumber>55</FileNumber>
<FileNumber>53</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -940,7 +916,7 @@
</File>
<File>
<GroupNumber>8</GroupNumber>
<FileNumber>56</FileNumber>
<FileNumber>54</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -952,7 +928,7 @@
</File>
<File>
<GroupNumber>8</GroupNumber>
<FileNumber>57</FileNumber>
<FileNumber>55</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -964,7 +940,7 @@
</File>
<File>
<GroupNumber>8</GroupNumber>
<FileNumber>58</FileNumber>
<FileNumber>56</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -976,7 +952,7 @@
</File>
<File>
<GroupNumber>8</GroupNumber>
<FileNumber>59</FileNumber>
<FileNumber>57</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -988,7 +964,7 @@
</File>
<File>
<GroupNumber>8</GroupNumber>
<FileNumber>60</FileNumber>
<FileNumber>58</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>

View File

@ -704,35 +704,25 @@
<Group>
<GroupName>User/device</GroupName>
<Files>
<File>
<FileName>device.h</FileName>
<FileType>5</FileType>
<FilePath>..\User\device\device.h</FilePath>
</File>
<File>
<FileName>lcd.c</FileName>
<FileType>1</FileType>
<FilePath>..\User\device\lcd.c</FilePath>
<FilePath>..\User\device\lcd_driver\lcd.c</FilePath>
</File>
<File>
<FileName>lcd.h</FileName>
<FileType>5</FileType>
<FilePath>..\User\device\lcd.h</FilePath>
<FilePath>..\User\device\lcd_driver\lcd.h</FilePath>
</File>
<File>
<FileName>lcd_init.c</FileName>
<FileType>1</FileType>
<FilePath>..\User\device\lcd_init.c</FilePath>
</File>
<File>
<FileName>lcd_init.h</FileName>
<FileName>lcd_lib.h</FileName>
<FileType>5</FileType>
<FilePath>..\User\device\lcd_init.h</FilePath>
</File>
<File>
<FileName>lcdfont.h</FileName>
<FileType>5</FileType>
<FilePath>..\User\device\lcdfont.h</FilePath>
</File>
<File>
<FileName>pic.h</FileName>
<FileType>5</FileType>
<FilePath>..\User\device\pic.h</FilePath>
<FilePath>..\User\device\lcd_driver\lcd_lib.h</FilePath>
</File>
</Files>
</Group>

Binary file not shown.

View File

@ -22,7 +22,7 @@ Dialog DLL: TCM.DLL V1.48.0.0
<h2>Project:</h2>
D:\CUBEMX\MR16\MDK-ARM\MR16.uvprojx
Project File Date: 11/27/2025
Project File Date: 11/29/2025
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\cangming\ARM\ARMCC\Bin'
@ -53,7 +53,7 @@ Package Vendor: Keil
* Component: ARM::CMSIS:CORE:5.4.0
Include file: CMSIS\Core\Include\tz_context.h
Build Time Elapsed: 00:00:00
Build Time Elapsed: 00:00:01
</pre>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,6 @@
"mr16\spi_1.o"
"mr16\uart.o"
"mr16\lcd.o"
"mr16\lcd_init.o"
"mr16\crc8.o"
"mr16\crc16.o"
"mr16\user_math.o"

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
Dependencies for Project 'MR16', Target 'MR16': (DO NOT MODIFY !)
CompilerVersion: 5060960::V5.06 update 7 (build 960)::.\ARMCC
F (startup_stm32f103xb.s)(0x692846FC)(--cpu Cortex-M3 -g --apcs=interwork --pd "__MICROLIB SETA 1" -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include --pd "__UVISION_VERSION SETA 534" --pd "_RTE_ SETA 1" --pd "STM32F10X_MD SETA 1" --pd "_RTE_ SETA 1" --list startup_stm32f103xb.lst --xref -o mr16\startup_stm32f103xb.o --depend mr16\startup_stm32f103xb.d)
F (../Core/Src/main.c)(0x6926C42F)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\main.o --omf_browse mr16\main.crf --depend mr16\main.d)
F (../Core/Src/main.c)(0x692AB15F)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\main.o --omf_browse mr16\main.crf --depend mr16\main.d)
I (../Core/Inc/main.h)(0x6926BBE5)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6925BA2A)
@ -38,13 +38,15 @@ I (../Core/Inc/usart.h)(0x691B56EA)
I (../Core/Inc/gpio.h)(0x691B56EA)
I (D:\cangming\ARM\ARMCC\include\string.h)(0x5E8E3CC2)
I (D:\cangming\ARM\ARMCC\include\stdio.h)(0x5E8E3CC2)
I (../sx1281-driver-c/sx1281.h)(0x6925B284)
I (../sx1281-driver-c/sx1281.h)(0x692AAC2E)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
I (../sx1281-driver-c/sx1281_driver.h)(0x69248F54)
I (../sx1281-driver-c/sx1281_driver.h)(0x692AA9D3)
I (D:\cangming\ARM\ARMCC\include\math.h)(0x5E8E3CC2)
I (../User/device/device.h)(0x691D6BB5)
I (../User/device/lcd.h)(0x6925D9CC)
I (../User/device/lcd_init.h)(0x6926C60C)
I (../User/device/lcd_driver/lcd.h)(0x692A51B9)
I (../User/bsp/spi.h)(0x69287B05)
I (../User/bsp/bsp.h)(0x691D6BB5)
I (../User/bsp/gpio.h)(0x691D6BB5)
F (../Core/Src/gpio.c)(0x692846F9)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\gpio.o --omf_browse mr16\gpio.crf --depend mr16\gpio.d)
I (../Core/Inc/gpio.h)(0x691B56EA)
I (../Core/Inc/main.h)(0x6926BBE5)
@ -726,8 +728,8 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
F (..\sx1281-driver-c\radio.h)(0x69249477)()
F (..\sx1281-driver-c\sx1281.c)(0x6926BAA5)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\sx1281.o --omf_browse mr16\sx1281.crf --depend mr16\sx1281.d)
I (..\sx1281-driver-c\sx1281_driver.h)(0x69248F54)
F (..\sx1281-driver-c\sx1281.c)(0x692AAC2E)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\sx1281.o --omf_browse mr16\sx1281.crf --depend mr16\sx1281.d)
I (..\sx1281-driver-c\sx1281_driver.h)(0x692AA9D3)
I (D:\cangming\ARM\ARMCC\include\stdint.h)(0x5E8E3CC2)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
I (D:\cangming\ARM\ARMCC\include\math.h)(0x5E8E3CC2)
@ -771,13 +773,13 @@ I (..\sx1281-driver-c\sx1281_boards.h)(0x69248C05)
I (..\sx1281-driver-c\sx1281_driver_gpio.h)(0x691D7D06)
I (..\sx1281-driver-c\sx1281_driver_spi.h)(0x5ACC746C)
I (..\sx1281-driver-c\sx1281_driver_uart.h)(0x69248C05)
I (..\sx1281-driver-c\sx1281.h)(0x6925B284)
I (..\sx1281-driver-c\sx1281.h)(0x692AAC2E)
I (../User/device/device.h)(0x691D6BB5)
F (..\sx1281-driver-c\sx1281.h)(0x6925B284)()
F (..\sx1281-driver-c\sx1281.h)(0x692AAC2E)()
F (..\sx1281-driver-c\sx1281_boards.h)(0x69248C05)()
F (..\sx1281-driver-c\sx1281_driver.c)(0x6925B026)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\sx1281_driver.o --omf_browse mr16\sx1281_driver.crf --depend mr16\sx1281_driver.d)
I (D:\cangming\ARM\ARMCC\include\string.h)(0x5E8E3CC2)
I (..\sx1281-driver-c\sx1281_driver.h)(0x69248F54)
I (..\sx1281-driver-c\sx1281_driver.h)(0x692AA9D3)
I (D:\cangming\ARM\ARMCC\include\stdint.h)(0x5E8E3CC2)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
I (D:\cangming\ARM\ARMCC\include\math.h)(0x5E8E3CC2)
@ -817,7 +819,7 @@ I (..\sx1281-driver-c\sx1281_driver_gpio.h)(0x691D7D06)
I (../Core/Inc/main.h)(0x6926BBE5)
I (..\sx1281-driver-c\sx1281_driver_spi.h)(0x5ACC746C)
I (..\sx1281-driver-c\sx1281_driver_uart.h)(0x69248C05)
F (..\sx1281-driver-c\sx1281_driver.h)(0x69248F54)()
F (..\sx1281-driver-c\sx1281_driver.h)(0x692AA9D3)()
F (..\sx1281-driver-c\sx1281_driver_gpio.c)(0x6925B284)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\sx1281_driver_gpio.o --omf_browse mr16\sx1281_driver_gpio.crf --depend mr16\sx1281_driver_gpio.d)
I (..\sx1281-driver-c\sx1281_header.h)(0x6925B22C)
I (D:\cangming\ARM\ARMCC\include\stdio.h)(0x5E8E3CC2)
@ -896,13 +898,13 @@ I (../Core/Inc/main.h)(0x6926BBE5)
I (..\sx1281-driver-c\sx1281_driver_spi.h)(0x5ACC746C)
I (..\sx1281-driver-c\sx1281_driver_uart.h)(0x69248C05)
I (..\sx1281-driver-c\sx1281_driver_hal.h)(0x6924A201)
I (..\sx1281-driver-c\sx1281_driver.h)(0x69248F54)
I (..\sx1281-driver-c\sx1281_driver.h)(0x692AA9D3)
I (D:\cangming\ARM\ARMCC\include\math.h)(0x5E8E3CC2)
I (..\sx1281-driver-c\radio.h)(0x69249477)
I (D:\cangming\ARM\ARMCC\include\string.h)(0x5E8E3CC2)
F (..\sx1281-driver-c\sx1281_driver_hal.h)(0x6924A201)()
F (..\sx1281-driver-c\sx1281_driver_spi.c)(0x6925BEAD)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\sx1281_driver_spi.o --omf_browse mr16\sx1281_driver_spi.crf --depend mr16\sx1281_driver_spi.d)
I (../User/bsp/spi.h)(0x691D6BB5)
I (../User/bsp/spi.h)(0x69287B05)
I (../Core/Inc/spi.h)(0x691B56EA)
I (../Core/Inc/main.h)(0x6926BBE5)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
@ -1046,7 +1048,7 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
F (..\User\bsp\gpio.h)(0x691D6BB5)()
F (..\User\bsp\spi.c)(0x69203C74)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\spi_1.o --omf_browse mr16\spi_1.crf --depend mr16\spi_1.d)
F (..\User\bsp\spi.c)(0x69287AF0)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\spi_1.o --omf_browse mr16\spi_1.crf --depend mr16\spi_1.d)
I (../Core/Inc/spi.h)(0x691B56EA)
I (../Core/Inc/main.h)(0x6926BBE5)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
@ -1077,10 +1079,10 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
I (../User/bsp/spi.h)(0x691D6BB5)
I (../User/bsp/spi.h)(0x69287B05)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
I (../User/bsp/bsp.h)(0x691D6BB5)
F (..\User\bsp\spi.h)(0x691D6BB5)()
F (..\User\bsp\spi.h)(0x69287B05)()
F (..\User\bsp\uart.c)(0x69249732)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\uart.o --omf_browse mr16\uart.crf --depend mr16\uart.d)
I (../Core/Inc/usart.h)(0x691B56EA)
I (../Core/Inc/main.h)(0x6926BBE5)
@ -1116,12 +1118,14 @@ I (../User/bsp/uart.h)(0x692496BB)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
I (../User/bsp/bsp.h)(0x691D6BB5)
F (..\User\bsp\uart.h)(0x692496BB)()
F (..\User\device\lcd.c)(0x69269F3F)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\lcd.o --omf_browse mr16\lcd.crf --depend mr16\lcd.d)
I (../User/device/lcd.h)(0x6925D9CC)
F (..\User\device\device.h)(0x691D6BB5)()
F (..\User\device\lcd_driver\lcd.c)(0x692A60A3)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\lcd.o --omf_browse mr16\lcd.crf --depend mr16\lcd.d)
I (../User/device/lcd_driver/lcd.h)(0x692A51B9)
I (../User/device/device.h)(0x691D6BB5)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
I (D:\cangming\ARM\ARMCC\include\stdint.h)(0x5E8E3CC2)
I (..\User\device\lcd_init.h)(0x6926C60C)
I (../User/bsp/spi.h)(0x69287B05)
I (../Core/Inc/spi.h)(0x691B56EA)
I (../Core/Inc/main.h)(0x6926BBE5)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6925BA2A)
@ -1150,45 +1154,13 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
I (..\User\device\lcdfont.h)(0x6926B77D)
F (..\User\device\lcd.h)(0x6925D9CC)()
F (..\User\device\lcd_init.c)(0x6926B7B7)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\lcd_init.o --omf_browse mr16\lcd_init.crf --depend mr16\lcd_init.d)
I (..\User\device\lcd_init.h)(0x6926C60C)
I (..\User\device\device.h)(0x691D6BB5)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
I (D:\cangming\ARM\ARMCC\include\stdint.h)(0x5E8E3CC2)
I (../Core/Inc/main.h)(0x6926BBE5)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6925BA2A)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h)(0x67480A20)
I (../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h)(0x67480A20)
I (../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h)(0x67480A20)
I (../Drivers/CMSIS/Include/core_cm3.h)(0x67480A0A)
I (../Drivers/CMSIS/Include/cmsis_version.h)(0x67480A0A)
I (../Drivers/CMSIS/Include/cmsis_compiler.h)(0x67480A0A)
I (../Drivers/CMSIS/Include/cmsis_armcc.h)(0x67480A0A)
I (../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h)(0x67480A20)
I (D:\cangming\ARM\ARMCC\include\stddef.h)(0x5E8E3CC2)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
I (../Core/Inc/gpio.h)(0x691B56EA)
F (..\User\device\lcd_init.h)(0x6926C60C)()
F (..\User\device\lcdfont.h)(0x6926B77D)()
F (..\User\device\pic.h)(0x5E69B55E)()
I (../User/bsp/bsp.h)(0x691D6BB5)
I (../User/bsp/gpio.h)(0x691D6BB5)
I (../User/device/lcd_driver/lcd_lib.h)(0x692A5F31)
I (D:\cangming\ARM\ARMCC\include\stdlib.h)(0x5E8E3CC2)
I (D:\cangming\ARM\ARMCC\include\stdio.h)(0x5E8E3CC2)
F (..\User\device\lcd_driver\lcd.h)(0x692A51B9)()
F (..\User\device\lcd_driver\lcd_lib.h)(0x692A5F31)()
F (..\User\component\crc8.c)(0x691D6BB5)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\crc8.o --omf_browse mr16\crc8.crf --depend mr16\crc8.d)
I (..\User\component\crc8.h)(0x691D6BB5)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +1,10 @@
mr16\lcd.o: ..\User\device\lcd.c
mr16\lcd.o: ../User/device/lcd.h
mr16\lcd.o: ..\User\device\lcd_driver\lcd.c
mr16\lcd.o: ../User/device/lcd_driver/lcd.h
mr16\lcd.o: ../User/device/device.h
mr16\lcd.o: D:\cangming\ARM\ARMCC\Bin\..\include\stdbool.h
mr16\lcd.o: D:\cangming\ARM\ARMCC\Bin\..\include\stdint.h
mr16\lcd.o: ..\User\device\lcd_init.h
mr16\lcd.o: ../User/bsp/spi.h
mr16\lcd.o: ../Core/Inc/spi.h
mr16\lcd.o: ../Core/Inc/main.h
mr16\lcd.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
mr16\lcd.o: ../Core/Inc/stm32f1xx_hal_conf.h
@ -33,4 +34,8 @@ mr16\lcd.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h
mr16\lcd.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h
mr16\lcd.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h
mr16\lcd.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h
mr16\lcd.o: ..\User\device\lcdfont.h
mr16\lcd.o: ../User/bsp/bsp.h
mr16\lcd.o: ../User/bsp/gpio.h
mr16\lcd.o: ../User/device/lcd_driver/lcd_lib.h
mr16\lcd.o: D:\cangming\ARM\ARMCC\Bin\..\include\stdlib.h
mr16\lcd.o: D:\cangming\ARM\ARMCC\Bin\..\include\stdio.h

Binary file not shown.

Binary file not shown.

View File

@ -41,5 +41,7 @@ mr16\main.o: D:\cangming\ARM\ARMCC\Bin\..\include\stdbool.h
mr16\main.o: ../sx1281-driver-c/sx1281_driver.h
mr16\main.o: D:\cangming\ARM\ARMCC\Bin\..\include\math.h
mr16\main.o: ../User/device/device.h
mr16\main.o: ../User/device/lcd.h
mr16\main.o: ../User/device/lcd_init.h
mr16\main.o: ../User/device/lcd_driver/lcd.h
mr16\main.o: ../User/bsp/spi.h
mr16\main.o: ../User/bsp/bsp.h
mr16\main.o: ../User/bsp/gpio.h

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -24,6 +24,8 @@ static void (*SPI_Callback[BSP_SPI_NUM][BSP_SPI_CB_NUM])(void);
static BSP_SPI_t SPI_Get(SPI_HandleTypeDef *hspi) {
if (hspi->Instance == SPI1)
return BSP_SPI_SX1281;
if (hspi->Instance == SPI2)
return BSP_SPI_LCD;
else
return BSP_SPI_ERR;
}
@ -98,6 +100,8 @@ SPI_HandleTypeDef *BSP_SPI_GetHandle(BSP_SPI_t spi) {
switch (spi) {
case BSP_SPI_SX1281:
return &hspi1;
case BSP_SPI_LCD:
return &hspi2;
default:
return NULL;
}
@ -176,6 +180,13 @@ int8_t BSP_SPI_MemWrite(BSP_SPI_t spi, uint8_t reg, uint8_t *data, uint16_t size
return BSP_SPI_Transmit(spi, data, size, true);
}
HAL_SPI_StateTypeDef BSP_SPI_GetState(BSP_SPI_t spi) {
if (spi >= BSP_SPI_NUM) return BSP_ERR;
SPI_HandleTypeDef *hspi = BSP_SPI_GetHandle(spi);
if (hspi == NULL) return BSP_ERR;
return HAL_SPI_GetState(hspi);
}
/* USER FUNCTION BEGIN */
/* USER FUNCTION END */

View File

@ -28,6 +28,7 @@ extern "C" {
/* SPI实体枚举与设备对应 */
typedef enum {
BSP_SPI_SX1281,
BSP_SPI_LCD,
BSP_SPI_NUM,
BSP_SPI_ERR,
} BSP_SPI_t;
@ -50,7 +51,6 @@ SPI_HandleTypeDef *BSP_SPI_GetHandle(BSP_SPI_t spi);
int8_t BSP_SPI_RegisterCallback(BSP_SPI_t spi, BSP_SPI_Callback_t type,
void (*callback)(void));
int8_t BSP_SPI_Transmit(BSP_SPI_t spi, uint8_t *data, uint16_t size, bool dma);
int8_t BSP_SPI_Receive(BSP_SPI_t spi, uint8_t *data, uint16_t size, bool dma);
int8_t BSP_SPI_TransmitReceive(BSP_SPI_t spi, uint8_t *txData, uint8_t *rxData,
@ -61,6 +61,7 @@ int8_t BSP_SPI_MemWriteByte(BSP_SPI_t spi, uint8_t reg, uint8_t data);
int8_t BSP_SPI_MemRead(BSP_SPI_t spi, uint8_t reg, uint8_t *data, uint16_t size);
int8_t BSP_SPI_MemWrite(BSP_SPI_t spi, uint8_t reg, uint8_t *data, uint16_t size);
HAL_SPI_StateTypeDef BSP_SPI_GetState(BSP_SPI_t spi);
/* USER FUNCTION BEGIN */
/* USER FUNCTION END */

View File

@ -1,557 +0,0 @@
#include "device/lcd.h"
#include "lcd_init.h"
#include "lcdfont.h"
/******************************************************************************
xsta,ysta
xend,yend
color
******************************************************************************/
void LCD_Fill(uint16_t xsta,uint16_t ysta,uint16_t xend,uint16_t yend,uint16_t color)
{
uint16_t i,j;
LCD_Address_Set(xsta,ysta,xend-1,yend-1);//设置显示范围
for(i=ysta;i<yend;i++)
{
for(j=xsta;j<xend;j++)
{
LCD_WR_DATA(color);
}
}
}
/******************************************************************************
x,y
color
******************************************************************************/
void LCD_DrawPoint(uint16_t x,uint16_t y,uint16_t color)
{
LCD_Address_Set(x,y,x,y);//设置光标位置
LCD_WR_DATA(color);
}
/******************************************************************************
线
x1,y1
x2,y2
color 线
******************************************************************************/
void LCD_DrawLine(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2,uint16_t color)
{
uint16_t t;
int xerr=0,yerr=0,delta_x,delta_y,distance;
int incx,incy,uRow,uCol;
delta_x=x2-x1; //计算坐标增量
delta_y=y2-y1;
uRow=x1;//画线起点坐标
uCol=y1;
if(delta_x>0)incx=1; //设置单步方向
else if (delta_x==0)incx=0;//垂直线
else {incx=-1;delta_x=-delta_x;}
if(delta_y>0)incy=1;
else if (delta_y==0)incy=0;//水平线
else {incy=-1;delta_y=-delta_y;}
if(delta_x>delta_y)distance=delta_x; //选取基本增量坐标轴
else distance=delta_y;
for(t=0;t<distance+1;t++)
{
LCD_DrawPoint(uRow,uCol,color);//画点
xerr+=delta_x;
yerr+=delta_y;
if(xerr>distance)
{
xerr-=distance;
uRow+=incx;
}
if(yerr>distance)
{
yerr-=distance;
uCol+=incy;
}
}
}
/******************************************************************************
x1,y1
x2,y2
color
******************************************************************************/
void LCD_DrawRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,uint16_t color)
{
LCD_DrawLine(x1,y1,x2,y1,color);
LCD_DrawLine(x1,y1,x1,y2,color);
LCD_DrawLine(x1,y2,x2,y2,color);
LCD_DrawLine(x2,y1,x2,y2,color);
}
/******************************************************************************
x0,y0
r
color
******************************************************************************/
void Draw_Circle(uint16_t x0,uint16_t y0,uint8_t r,uint16_t color)
{
int a,b;
a=0;b=r;
while(a<=b)
{
LCD_DrawPoint(x0-b,y0-a,color); //3
LCD_DrawPoint(x0+b,y0-a,color); //0
LCD_DrawPoint(x0-a,y0+b,color); //1
LCD_DrawPoint(x0-a,y0-b,color); //2
LCD_DrawPoint(x0+b,y0+a,color); //4
LCD_DrawPoint(x0+a,y0-b,color); //5
LCD_DrawPoint(x0+a,y0+b,color); //6
LCD_DrawPoint(x0-b,y0+a,color); //7
a++;
if((a*a+b*b)>(r*r))//判断要画的点是否过远
{
b--;
}
}
}
/******************************************************************************
x,y显示坐标
*s
fc
bc
sizey 16 24 32
mode: 0 1
******************************************************************************/
void LCD_ShowChinese(uint16_t x,uint16_t y,uint8_t *s,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode)
{
while(*s!=0)
{
if(sizey==12) LCD_ShowChinese12x12(x,y,s,fc,bc,sizey,mode);
else if(sizey==16) LCD_ShowChinese16x16(x,y,s,fc,bc,sizey,mode);
else if(sizey==24) LCD_ShowChinese24x24(x,y,s,fc,bc,sizey,mode);
else if(sizey==32) LCD_ShowChinese32x32(x,y,s,fc,bc,sizey,mode);
else return;
s+=2;
x+=sizey;
}
}
/******************************************************************************
12x12汉字
x,y显示坐标
*s
fc
bc
sizey
mode: 0 1
******************************************************************************/
void LCD_ShowChinese12x12(uint16_t x,uint16_t y,uint8_t *s,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode)
{
uint8_t i,j,m=0;
uint16_t k;
uint16_t HZnum;//汉字数目
uint16_t TypefaceNum;//一个字符所占字节大小
uint16_t x0=x;
TypefaceNum=(sizey/8+((sizey%8)?1:0))*sizey;
HZnum=sizeof(tfont12)/sizeof(typFNT_GB12); //统计汉字数目
for(k=0;k<HZnum;k++)
{
if((tfont12[k].Index[0]==*(s))&&(tfont12[k].Index[1]==*(s+1)))
{
LCD_Address_Set(x,y,x+sizey-1,y+sizey-1);
for(i=0;i<TypefaceNum;i++)
{
for(j=0;j<8;j++)
{
if(!mode)//非叠加方式
{
if(tfont12[k].Msk[i]&(0x01<<j))LCD_WR_DATA(fc);
else LCD_WR_DATA(bc);
m++;
if(m%sizey==0)
{
m=0;
break;
}
}
else//叠加方式
{
if(tfont12[k].Msk[i]&(0x01<<j)) LCD_DrawPoint(x,y,fc);//画一个点
x++;
if((x-x0)==sizey)
{
x=x0;
y++;
break;
}
}
}
}
}
continue; //查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响
}
}
/******************************************************************************
16x16汉字
x,y显示坐标
*s
fc
bc
sizey
mode: 0 1
******************************************************************************/
void LCD_ShowChinese16x16(uint16_t x,uint16_t y,uint8_t *s,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode)
{
uint8_t i,j,m=0;
uint16_t k;
uint16_t HZnum;//汉字数目
uint16_t TypefaceNum;//一个字符所占字节大小
uint16_t x0=x;
TypefaceNum=(sizey/8+((sizey%8)?1:0))*sizey;
HZnum=sizeof(tfont16)/sizeof(typFNT_GB16); //统计汉字数目
for(k=0;k<HZnum;k++)
{
if ((tfont16[k].Index[0]==*(s))&&(tfont16[k].Index[1]==*(s+1)))
{
LCD_Address_Set(x,y,x+sizey-1,y+sizey-1);
for(i=0;i<TypefaceNum;i++)
{
for(j=0;j<8;j++)
{
if(!mode)//非叠加方式
{
if(tfont16[k].Msk[i]&(0x01<<j))LCD_WR_DATA(fc);
else LCD_WR_DATA(bc);
m++;
if(m%sizey==0)
{
m=0;
break;
}
}
else//叠加方式
{
if(tfont16[k].Msk[i]&(0x01<<j)) LCD_DrawPoint(x,y,fc);//画一个点
x++;
if((x-x0)==sizey)
{
x=x0;
y++;
break;
}
}
}
}
}
continue; //查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响
}
}
/******************************************************************************
24x24汉字
x,y显示坐标
*s
fc
bc
sizey
mode: 0 1
******************************************************************************/
void LCD_ShowChinese24x24(uint16_t x,uint16_t y,uint8_t *s,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode)
{
uint8_t i,j,m=0;
uint16_t k;
uint16_t HZnum;//汉字数目
uint16_t TypefaceNum;//一个字符所占字节大小
uint16_t x0=x;
TypefaceNum=(sizey/8+((sizey%8)?1:0))*sizey;
HZnum=sizeof(tfont24)/sizeof(typFNT_GB24); //统计汉字数目
for(k=0;k<HZnum;k++)
{
if ((tfont24[k].Index[0]==*(s))&&(tfont24[k].Index[1]==*(s+1)))
{
LCD_Address_Set(x,y,x+sizey-1,y+sizey-1);
for(i=0;i<TypefaceNum;i++)
{
for(j=0;j<8;j++)
{
if(!mode)//非叠加方式
{
if(tfont24[k].Msk[i]&(0x01<<j))LCD_WR_DATA(fc);
else LCD_WR_DATA(bc);
m++;
if(m%sizey==0)
{
m=0;
break;
}
}
else//叠加方式
{
if(tfont24[k].Msk[i]&(0x01<<j)) LCD_DrawPoint(x,y,fc);//画一个点
x++;
if((x-x0)==sizey)
{
x=x0;
y++;
break;
}
}
}
}
}
continue; //查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响
}
}
/******************************************************************************
32x32汉字
x,y显示坐标
*s
fc
bc
sizey
mode: 0 1
******************************************************************************/
void LCD_ShowChinese32x32(uint16_t x,uint16_t y,uint8_t *s,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode)
{
uint8_t i,j,m=0;
uint16_t k;
uint16_t HZnum;//汉字数目
uint16_t TypefaceNum;//一个字符所占字节大小
uint16_t x0=x;
TypefaceNum=(sizey/8+((sizey%8)?1:0))*sizey;
HZnum=sizeof(tfont32)/sizeof(typFNT_GB32); //统计汉字数目
for(k=0;k<HZnum;k++)
{
if ((tfont32[k].Index[0]==*(s))&&(tfont32[k].Index[1]==*(s+1)))
{
LCD_Address_Set(x,y,x+sizey-1,y+sizey-1);
for(i=0;i<TypefaceNum;i++)
{
for(j=0;j<8;j++)
{
if(!mode)//非叠加方式
{
if(tfont32[k].Msk[i]&(0x01<<j))LCD_WR_DATA(fc);
else LCD_WR_DATA(bc);
m++;
if(m%sizey==0)
{
m=0;
break;
}
}
else//叠加方式
{
if(tfont32[k].Msk[i]&(0x01<<j)) LCD_DrawPoint(x,y,fc);//画一个点
x++;
if((x-x0)==sizey)
{
x=x0;
y++;
break;
}
}
}
}
}
continue; //查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响
}
}
/******************************************************************************
x,y显示坐标
num
fc
bc
sizey
mode: 0 1
******************************************************************************/
void LCD_ShowChar(uint16_t x,uint16_t y,uint8_t num,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode)
{
uint8_t temp,sizex,t,m=0;
uint16_t i,TypefaceNum;//一个字符所占字节大小
uint16_t x0=x;
sizex=sizey/2;
TypefaceNum=(sizex/8+((sizex%8)?1:0))*sizey;
num=num-' '; //得到偏移后的值
LCD_Address_Set(x,y,x+sizex-1,y+sizey-1); //设置光标位置
for(i=0;i<TypefaceNum;i++)
{
if(sizey==12)temp=ascii_1206[num][i]; //调用6x12字体
else if(sizey==16)temp=ascii_1608[num][i]; //调用8x16字体
else if(sizey==24)temp=ascii_2412[num][i]; //调用12x24字体
else if(sizey==32)temp=ascii_3216[num][i]; //调用16x32字体
else return;
for(t=0;t<8;t++)
{
if(!mode)//非叠加模式
{
if(temp&(0x01<<t))LCD_WR_DATA(fc);
else LCD_WR_DATA(bc);
m++;
if(m%sizex==0)
{
m=0;
break;
}
}
else//叠加模式
{
if(temp&(0x01<<t))LCD_DrawPoint(x,y,fc);//画一个点
x++;
if((x-x0)==sizex)
{
x=x0;
y++;
break;
}
}
}
}
}
/******************************************************************************
x,y显示坐标
*p
fc
bc
sizey
mode: 0 1
******************************************************************************/
void LCD_ShowString(uint16_t x,uint16_t y,const uint8_t *p,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode)
{
while(*p!='\0')
{
LCD_ShowChar(x,y,*p,fc,bc,sizey,mode);
x+=sizey/2;
p++;
}
}
/******************************************************************************
m底数n指数
******************************************************************************/
uint32_t mypow(uint8_t m,uint8_t n)
{
uint32_t result=1;
while(n--)result*=m;
return result;
}
/******************************************************************************
x,y显示坐标
num
len
fc
bc
sizey
******************************************************************************/
void LCD_ShowIntNum(uint16_t x,uint16_t y,uint16_t num,uint8_t len,uint16_t fc,uint16_t bc,uint8_t sizey)
{
uint8_t t,temp;
uint8_t enshow=0;
uint8_t sizex=sizey/2;
for(t=0;t<len;t++)
{
temp=(num/mypow(10,len-t-1))%10;
if(enshow==0&&t<(len-1))
{
if(temp==0)
{
LCD_ShowChar(x+t*sizex,y,' ',fc,bc,sizey,0);
continue;
}else enshow=1;
}
LCD_ShowChar(x+t*sizex,y,temp+48,fc,bc,sizey,0);
}
}
/******************************************************************************
x,y显示坐标
num
len
fc
bc
sizey
******************************************************************************/
void LCD_ShowFloatNum1(uint16_t x,uint16_t y,float num,uint8_t len,uint16_t fc,uint16_t bc,uint8_t sizey)
{
uint8_t t,temp,sizex;
uint16_t num1;
sizex=sizey/2;
num1=num*100;
for(t=0;t<len;t++)
{
temp=(num1/mypow(10,len-t-1))%10;
if(t==(len-2))
{
LCD_ShowChar(x+(len-2)*sizex,y,'.',fc,bc,sizey,0);
t++;
len+=1;
}
LCD_ShowChar(x+t*sizex,y,temp+48,fc,bc,sizey,0);
}
}
/******************************************************************************
x,y起点坐标
length
width
pic[]
******************************************************************************/
void LCD_ShowPicture(uint16_t x,uint16_t y,uint16_t length,uint16_t width,const uint8_t pic[])
{
uint16_t i,j;
uint32_t k=0;
LCD_Address_Set(x,y,x+length-1,y+width-1);
for(i=0;i<length;i++)
{
for(j=0;j<width;j++)
{
LCD_WR_DATA8(pic[k*2]);
LCD_WR_DATA8(pic[k*2+1]);
k++;
}
}
}

View File

@ -1,59 +0,0 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "device.h"
void LCD_Fill(uint16_t xsta,uint16_t ysta,uint16_t xend,uint16_t yend,uint16_t color);//指定区域填充颜色
void LCD_DrawPoint(uint16_t x,uint16_t y,uint16_t color);//在指定位置画一个点
void LCD_DrawLine(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2,uint16_t color);//在指定位置画一条线
void LCD_DrawRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,uint16_t color);//在指定位置画一个矩形
void Draw_Circle(uint16_t x0,uint16_t y0,uint8_t r,uint16_t color);//在指定位置画一个圆
void LCD_ShowChinese(uint16_t x,uint16_t y,uint8_t *s,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode);//显示汉字串
void LCD_ShowChinese12x12(uint16_t x,uint16_t y,uint8_t *s,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode);//显示单个12x12汉字
void LCD_ShowChinese16x16(uint16_t x,uint16_t y,uint8_t *s,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode);//显示单个16x16汉字
void LCD_ShowChinese24x24(uint16_t x,uint16_t y,uint8_t *s,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode);//显示单个24x24汉字
void LCD_ShowChinese32x32(uint16_t x,uint16_t y,uint8_t *s,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode);//显示单个32x32汉字
void LCD_ShowChar(uint16_t x,uint16_t y,uint8_t num,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode);//显示一个字符
void LCD_ShowString(uint16_t x,uint16_t y,const uint8_t *p,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode);//显示字符串
uint32_t mypow(uint8_t m,uint8_t n);//求幂
void LCD_ShowIntNum(uint16_t x,uint16_t y,uint16_t num,uint8_t len,uint16_t fc,uint16_t bc,uint8_t sizey);//显示整数变量
void LCD_ShowFloatNum1(uint16_t x,uint16_t y,float num,uint8_t len,uint16_t fc,uint16_t bc,uint8_t sizey);//显示两位小数变量
void LCD_ShowPicture(uint16_t x,uint16_t y,uint16_t length,uint16_t width,const uint8_t pic[]);//显示图片
//画笔颜色
#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x001F
#define BRED 0XF81F
#define GRED 0XFFE0
#define GBLUE 0X07FF
#define RED 0xF800
#define MAGENTA 0xF81F
#define GREEN 0x07E0
#define CYAN 0x7FFF
#define YELLOW 0xFFE0
#define BROWN 0XBC40 //棕色
#define BRRED 0XFC07 //棕红色
#define GRAY 0X8430 //灰色
#define DARKBLUE 0X01CF //深蓝色
#define LIGHTBLUE 0X7D7C //浅蓝色
#define GRAYBLUE 0X5458 //灰蓝色
#define LIGHTGREEN 0X841F //浅绿色
#define LGRAY 0XC618 //浅灰色(PANNEL),窗体背景色
#define LGRAYBLUE 0XA651 //浅灰蓝色(中间层颜色)
#define LBBLUE 0X2B12 //浅棕蓝色(选择条目的反色)
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,743 @@
/*
LCD驱动
--------使
--------
--------lcd_library.h添加你的自定义点阵库-使LCD_DrawBitmap驱动任意位图
--------LSB与MSB顺序的字表
使
LCD_DrawPoint(0,0,BLUE);
LCD_DrawChar(10, 10, 'A', RED, WHITE);
LCD_DrawLine(10, 10, 100, 50, RED);
LCD_DrawRectangle(10,10,50,100,GREEN);
LCD_DrawHollowCircle(200,50,16,RED);
LCD_DrawSolidCircle(200,100,16,RED);
LCD_DrawString(0,0,"MR16",MEDIUMORCHID,32,LSB);
extern const unsigned char logo_M[];
LCD_DrawBitmap(logo_M,70,70,64,64,MEDIUMORCHID,MSB);
*/
/* Includes ----------------------------------------------------------------- */
#include "device/lcd_driver/lcd.h"
#include "device/device.h"
#include "device/lcd_driver/lcd_lib.h"
#include "bsp/spi.h"
#include <stdlib.h>
#include <stdio.h>
/* USER INCLUDE BEGIN */
/* USER INCLUDE END */
/* Private define ----------------------------------------------------------- */
/* USER DEFINE BEGIN */
/* USER DEFINE END */
/* Private macro ------------------------------------------------------------ */
/* Private typedef ---------------------------------------------------------- */
/* Private variables -------------------------------------------------------- */
static LCD_Orientation_t lcd_orientation = LCD_ORIENTATION_PORTRAIT; // 当前屏幕方向
/* Private function -------------------------------------------------------- */
/**
* LCD
*
* @param cmd
*
* @note LCD发送控制命令/
* SPI接口发送命令
*/
static int8_t LCD_WriteCommand(uint8_t cmd) {
LCD_DC_LOW(); // 设置数据/命令选择引脚为命令模式
LCD_CS_LOW(); // 使能SPI片选
BSP_SPI_Transmit(BSP_SPI_LCD, &cmd, 1, false); // 通过SPI发送命令
LCD_CS_HIGH(); // 禁用SPI片选
return DEVICE_OK;
}
/**
* LCD
*
* @param data
*
* @note LCD发送数据/
* SPI接口发送数据
*/
static int8_t LCD_WriteData(uint8_t data) {
LCD_DC_HIGH(); // 设置数据/命令选择引脚为数据模式
LCD_CS_LOW(); // 使能SPI片选
BSP_SPI_Transmit(BSP_SPI_LCD, &data, 1, false); // 通过SPI发送数据
LCD_CS_HIGH(); // 禁用SPI片选
return DEVICE_OK;
}
/**
* 使 DMA LCD
*
* @param data
* @param size
*
* @note DMA快速发送大量数据到LCD
*
*/
static int8_t LCD_WriteDataBuffer_DMA(uint8_t *data, uint16_t size) {
LCD_DC_HIGH(); // 设置数据/命令选择引脚为数据模式
LCD_CS_LOW(); // 使能SPI片选
BSP_SPI_Transmit(BSP_SPI_LCD, data, size, true); // 通过SPI发送数据
while(BSP_SPI_GetState(BSP_SPI_LCD) != HAL_SPI_STATE_READY); // 等待SPI传输完成
LCD_CS_HIGH(); // 禁用SPI片选
return DEVICE_OK;
}
/**
* LCD_WriteDataBuffer DMA
*
* @param data
* @param size
*
* @note 使DMA或普通SPI传输64
* 使DMA传输使SPI传输
*/
static int8_t LCD_WriteDataBuffer(uint8_t *data, uint16_t size) {
if (size > 64) { // 如果数据量较大,使用 DMA
LCD_WriteDataBuffer_DMA(data, size);
} else { // 否则使用普通传输
LCD_DC_HIGH(); // 设置数据/命令选择引脚为数据模式
LCD_CS_LOW(); // 使能SPI片选
BSP_SPI_Transmit(BSP_SPI_LCD, data, size, false); // 通过SPI发送数据
LCD_CS_HIGH(); // 禁用SPI片选
}
return DEVICE_OK;
}
/**
*
*
* @param x X坐标
* @param y Y坐标
* @param mx X坐标
* @param my Y坐标
*
* @note
*/
static int8_t LCD_MapCoords(uint16_t x, uint16_t y, uint16_t *mx, uint16_t *my) {
switch (lcd_orientation) {
case LCD_ORIENTATION_PORTRAIT: // 0°
*mx = x;
*my = y;
break;
case LCD_ORIENTATION_LANDSCAPE: // 90°顺时针
*mx = y;
*my = LCD_HEIGHT - 1 - x;
break;
case LCD_ORIENTATION_LANDSCAPE_INVERTED: // 90°逆时针
*mx = LCD_WIDTH - 1 - y;
*my = x;
break;
case LCD_ORIENTATION_PORTRAIT_INVERTED: // 180°
*mx = LCD_WIDTH - 1 - x;
*my = LCD_HEIGHT - 1 - y;
break;
default:
*mx = x;
*my = y;
break;
}
return DEVICE_OK;
}
/**
* LCD绘图窗口
*
* @param x X坐标
* @param y Y坐标
* @param w
* @param h
*
* @note LCD的绘图窗口
*/
static int8_t LCD_SetAddressWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
uint16_t x_start = x + X_OFFSET; // 计算窗口起始X坐标
uint16_t x_end = x_start + w - 1; // 计算窗口结束X坐标
uint16_t y_start = y + Y_OFFSET; // 计算窗口起始Y坐标
uint16_t y_end = y_start + h - 1; // 计算窗口结束Y坐标
LCD_WriteCommand(0x2A); // 列地址设置
uint8_t data_x[] = {x_start >> 8, x_start & 0xFF, x_end >> 8, x_end & 0xFF};
LCD_WriteDataBuffer(data_x, sizeof(data_x));
LCD_WriteCommand(0x2B); // 行地址设置
uint8_t data_y[] = {y_start >> 8, y_start & 0xFF, y_end >> 8, y_end & 0xFF};
LCD_WriteDataBuffer(data_y, sizeof(data_y));
LCD_WriteCommand(0x2C); // 内存写入
return DEVICE_OK;
}
/* Exported functions ------------------------------------------------------- */
/**
* LCD
*
* @param orientation
*
* @note LCD显示屏
*
*/
int8_t LCD_Init(LCD_Orientation_t orientation) {
lcd_orientation = orientation; // 设置屏幕方向
LCD_RST_LOW(); // 复位引脚低电平
HAL_Delay(50); // 延时
LCD_RST_HIGH(); // 复位引脚高电平
HAL_Delay(50); // 延时
LCD_WriteCommand(0x36); // 内存数据访问控制
switch (orientation) {
case LCD_ORIENTATION_PORTRAIT: // 竖屏模式
LCD_WriteData(0x08); // MY=1, MX=0, MV=0, ML=0, BGR=0
break;
case LCD_ORIENTATION_LANDSCAPE: // 横屏模式90°顺时针旋转
LCD_WriteData(0x60); // MY=0, MX=1, MV=1, ML=0, BGR=0
break;
case LCD_ORIENTATION_LANDSCAPE_INVERTED: // 横屏模式90°逆时针旋转
LCD_WriteData(0xA0); // MY=1, MX=1, MV=1, ML=0, BGR=0
break;
case LCD_ORIENTATION_PORTRAIT_INVERTED: // 竖屏模式180°旋转
LCD_WriteData(0xC8); // MY=1, MX=1, MV=0, ML=0, BGR=0
break;
default:
// LCD_WriteData(0x08); // 默认竖屏模式
break;
}
LCD_WriteCommand(0x3A); // 接口像素格式
LCD_WriteData(0x05); // 16位色
LCD_WriteCommand(0xB2); // 前廊设置
uint8_t porch[] = {0x0C, 0x0C, 0x00, 0x33, 0x33};
LCD_WriteDataBuffer(porch, sizeof(porch));
LCD_WriteCommand(0xB7); // 门控设置
LCD_WriteData(0x35);
LCD_WriteCommand(0xBB); // VCOM设置
LCD_WriteData(0x19);
LCD_WriteCommand(0xC0); // LCM控制
LCD_WriteData(0x2C);
LCD_WriteCommand(0xC2); // VDV和VRH命令使能
LCD_WriteData(0x01);
LCD_WriteCommand(0xC3); // VRH设置
LCD_WriteData(0x12);
LCD_WriteCommand(0xC4); // VDV设置
LCD_WriteData(0x20);
LCD_WriteCommand(0xC6); // 帧率控制
LCD_WriteData(0x0F);
LCD_WriteCommand(0xD0); // 电源控制1
LCD_WriteData(0xA4);
LCD_WriteData(0xA1);
LCD_WriteCommand(0xE0); // 正电压伽马控制
uint8_t gamma_pos[] = {0xD0, 0x04, 0x0D, 0x11, 0x13, 0x2B, 0x3F, 0x54, 0x4C, 0x18, 0x0D, 0x0B, 0x1F, 0x23};
LCD_WriteDataBuffer(gamma_pos, sizeof(gamma_pos));
LCD_WriteCommand(0xE1); // 负电压伽马控制
uint8_t gamma_neg[] = {0xD0, 0x04, 0x0C, 0x11, 0x13, 0x2C, 0x3F, 0x44, 0x51, 0x2F, 0x1F, 0x1F, 0x20, 0x23};
LCD_WriteDataBuffer(gamma_neg, sizeof(gamma_neg));
LCD_WriteCommand(0x21); // 显示反转开启
LCD_WriteCommand(0x11); // 退出睡眠模式
HAL_Delay(120); // 延时
LCD_WriteCommand(0x29); // 显示开启
return DEVICE_OK;
}
/**
*
*
* @param color RGB565格式
*
* @note LCD屏幕填充为指定颜色
*/
int8_t LCD_Clear(uint16_t color) {
uint8_t color_data[] = {color >> 8, color & 0xFF}; // 将颜色转换为字节数组
LCD_SetAddressWindow(0, 0, LCD_WIDTH, LCD_HEIGHT); // 设置整个屏幕为绘制窗口
// 创建一个缓冲区,用于存储一行的颜色数据
uint32_t row_size = LCD_WIDTH * 2; // 每行像素占用 2 字节
uint8_t *row_buffer = (uint8_t *)malloc(row_size);
if (row_buffer == NULL) return DEVICE_ERR_NULL; // 分配失败,直接返回
// 填充缓冲区为目标颜色
for (uint32_t i = 0; i < row_size; i += 2) {
row_buffer[i] = color_data[0];
row_buffer[i + 1] = color_data[1];
}
// 按行传输数据,覆盖整个屏幕
for (uint32_t y = 0; y < LCD_HEIGHT; y++) {
LCD_WriteDataBuffer_DMA(row_buffer, row_size);
}
free(row_buffer); // 释放缓冲区
return DEVICE_OK;
}
/**
*
*
* @param x X坐标
* @param y Y坐标
* @param color RGB565格式
*
* @note
*/
int8_t LCD_DrawPoint(uint16_t x, uint16_t y, uint16_t color) {
uint16_t mx, my;
LCD_MapCoords(x, y, &mx, &my); // 根据屏幕方向映射坐标
LCD_SetAddressWindow(mx, my, 1, 1); // 设置绘制窗口为单个像素
uint8_t color_data[] = { (uint8_t)(color >> 8), (uint8_t)(color & 0xFF) }; // 将颜色转换为字节数组
LCD_WriteDataBuffer(color_data, 2); // 写入像素数据
return DEVICE_OK;
}
/**
* 线
*
* @param x0 X坐标
* @param y0 Y坐标
* @param x1 X坐标
* @param y1 Y坐标
* @param color 线RGB565格式
*
* @note 使Bresenham算法绘制直线
*/
int8_t LCD_DrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) {
int dx = x1 - x0; // 计算X方向增量
int dy = y1 - y0; // 计算Y方向增量
int sx = (dx >= 0) ? 1 : -1; // X方向步长
int sy = (dy >= 0) ? 1 : -1; // Y方向步长
dx = dx >= 0 ? dx : -dx; // 取绝对值
dy = dy >= 0 ? dy : -dy; // 取绝对值
if (dx == 0 && dy == 0) { // 单点
LCD_DrawPoint((uint16_t)x0, (uint16_t)y0, color);
return DEVICE_OK;
}
if (dx > dy) { // X方向增量大于Y方向增量
int err = dx / 2; // 初始化误差
int x = x0;
int y = y0;
for (int i = 0; i <= dx; i++) {
LCD_DrawPoint((uint16_t)x, (uint16_t)y, color); // 绘制当前点
x += sx; // 更新X坐标
err -= dy; // 更新误差
if (err < 0) {
y += sy; // 更新Y坐标
err += dx; // 更新误差
}
}
} else { // Y方向增量大于X方向增量
int err = dy / 2; // 初始化误差
int x = x0;
int y = y0;
for (int i = 0; i <= dy; i++) {
LCD_DrawPoint((uint16_t)x, (uint16_t)y, color); // 绘制当前点
y += sy; // 更新Y坐标
err -= dx; // 更新误差
if (err < 0) {
x += sx; // 更新X坐标
err += dy; // 更新误差
}
}
}
return DEVICE_OK;
}
/**
*
*
* @param x1 X坐标
* @param y1 Y坐标
* @param x2 X坐标
* @param y2 Y坐标
* @param color RGB565格式
*
* @note
*/
int8_t LCD_DrawRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) {
LCD_DrawLine(x1, y1, x2, y1, color); // 上边
LCD_DrawLine(x1, y1, x1, y2, color); // 左边
LCD_DrawLine(x1, y2, x2, y2, color); // 下边
LCD_DrawLine(x2, y1, x2, y2, color); // 右边
return DEVICE_OK;
}
int8_t LCD_DrawSolidRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) {
int8_t a;
if(y1>y2) a=1;
else a=-1;
while(y1!=y2) {
LCD_DrawLine(x1, y1, x2, y1, color); // 上边
LCD_DrawLine(x1, y2, x2, y2, color); // 下边
y1-=a;y2+=a;
}
return DEVICE_OK;
}
/**
*
*
* @param x0 X坐标
* @param y0 Y坐标
* @param r
* @param color RGB565格式
*
* @note 使
*/
int8_t LCD_DrawHollowCircle(uint16_t x0, uint16_t y0, uint16_t r, uint16_t color) {
int a = 0; // X方向增量
int b = r; // Y方向增量
while (a <= b) {
LCD_DrawPoint(x0 - b, y0 - a, color); // 第3象限
LCD_DrawPoint(x0 + b, y0 - a, color); // 第0象限
LCD_DrawPoint(x0 - a, y0 + b, color); // 第1象限
LCD_DrawPoint(x0 - a, y0 - b, color); // 第2象限
LCD_DrawPoint(x0 + b, y0 + a, color); // 第4象限
LCD_DrawPoint(x0 + a, y0 - b, color); // 第5象限
LCD_DrawPoint(x0 + a, y0 + b, color); // 第6象限
LCD_DrawPoint(x0 - b, y0 + a, color); // 第7象限
a++; // 更新X方向增量
if ((a * a + b * b) > (r * r)) { // 判断是否超出半径范围
b--; // 更新Y方向增量
}
}
return DEVICE_OK;
}
/**
*
*
* @param x0 X坐标
* @param y0 Y坐标
* @param r
* @param color RGB565格式
*
* @note 使线
*/
int8_t LCD_DrawSolidCircle(uint16_t x0, uint16_t y0, uint16_t r, uint16_t color) {
int a = 0; // X方向增量
int b = r; // Y方向增量
int r2 = r * r; // 预计算半径的平方
while (a <= b) {
// 绘制8个对称点并填充水平线段
LCD_DrawLine(x0 - b, y0 - a, x0 + b, y0 - a, color); // 第3象限
LCD_DrawLine(x0 - b, y0 + a, x0 + b, y0 + a, color); // 第4象限
LCD_DrawLine(x0 - a, y0 - b, x0 + a, y0 - b, color); // 第2象限
LCD_DrawLine(x0 - a, y0 + b, x0 + a, y0 + b, color); // 第6象限
a++; // 更新X方向增量
if ((a * a + b * b) > r2) { // 判断是否超出半径范围
b--; // 更新Y方向增量
}
}
return DEVICE_OK;
}
/**
*
*
* @param x X坐标
* @param y Y坐标
* @param ch
* @param color RGB565格式
* @param font_size 1232
* @param bit_order LSB或MSB
*
* @note
*/
int8_t LCD_DrawChar(uint16_t x, uint16_t y, char ch, uint16_t color, uint8_t font_size, LCD_BitOrder_t bit_order) {
if (ch < ' ' || ch > '~') { // 检查字符是否在可打印范围内
return DEVICE_ERR;
}
uint8_t index = ch - ' '; // 计算字符索引
const uint8_t *font_data=NULL;
uint8_t char_width=0;
uint8_t char_height=0;
uint8_t bytesPerRow=0;
switch (font_size) {
case 12:// 12x6 字体ascii_1206特殊位映射 bit5..bit0
#ifdef ASCII_1206
font_data = (const uint8_t *)ascii_1206[index];
char_width = 6;
char_height = 12;
for (uint8_t row = 0; row < char_height; row++) {
for (uint8_t col = 0; col < char_width; col++) {
uint16_t pixel_x = x + col;
uint16_t pixel_y = y + row;
uint8_t bit_value;
if (bit_order == MSB) { // MSB 优先项目约定6 位放在 bit5..bit0
bit_value = (font_data[row] >> (5 - col)) & 0x01;
} else { // LSB 优先
bit_value = (font_data[row] >> col) & 0x01;
}
if (bit_value) {
LCD_DrawPoint(pixel_x, pixel_y, color);
}
}
}
#endif
break;
case 16:// 16x8 字体ascii_1608按行存储每行 1 字节MSB-first 常规映射)
#ifdef ASCII_1608
font_data = (const uint8_t *)ascii_1608[index];
char_width = 8;
char_height = 16;
for (uint8_t row = 0; row < char_height; row++) {
uint8_t row_byte = font_data[row];
for (uint8_t col = 0; col < char_width; col++) {
uint16_t pixel_x = x + col;
uint16_t pixel_y = y + row;
uint8_t bit_value;
if (bit_order == MSB) {
bit_value = (row_byte >> (7 - col)) & 0x01; // MSB-first: bit7 -> col0
} else {
bit_value = (row_byte >> col) & 0x01; // LSB-first
}
if (bit_value) {
LCD_DrawPoint(pixel_x, pixel_y, color);
}
}
}
#endif
break;
case 24:// 24x12 字体ascii_2412按行存储每行 2 字节)
#ifdef ASCII_2412
font_data = (const uint8_t *)ascii_2412[index];
char_width = 12;
char_height = 24;
bytesPerRow = (char_width + 7) / 8; // =2
for (uint8_t row = 0; row < char_height; row++) {
for (uint8_t col = 0; col < char_width; col++) {
uint16_t pixel_x = x + col;
uint16_t pixel_y = y + row;
uint8_t byte_index = col / 8;
uint8_t b = font_data[row * bytesPerRow + byte_index];
uint8_t bit_value;
if (bit_order == MSB) {
bit_value = (b >> (7 - (col % 8))) & 0x01;
} else {
bit_value = (b >> (col % 8)) & 0x01;
}
if (bit_value) {
LCD_DrawPoint(pixel_x, pixel_y, color);
}
}
}
#endif
break;
case 32:// 32x16 字体ascii_3216按行存储每行 2 字节)
#ifdef ASCII_3216
font_data = (const uint8_t *)ascii_3216[index];
char_width = 16;
char_height = 32;
bytesPerRow = (char_width + 7) / 8; // =2
for (uint8_t row = 0; row < char_height; row++) {
for (uint8_t col = 0; col < char_width; col++) {
uint16_t pixel_x = x + col;
uint16_t pixel_y = y + row;
uint8_t byte_index = col / 8;
uint8_t b = font_data[row * bytesPerRow + byte_index];
uint8_t bit_value;
if (bit_order == MSB) {
bit_value = (b >> (7 - (col % 8))) & 0x01;
} else {
bit_value = (b >> (col % 8)) & 0x01;
}
if (bit_value) {
LCD_DrawPoint(pixel_x, pixel_y, color);
}
}
}
#endif
break;
default:
return DEVICE_ERR;
}
return DEVICE_OK;
}
/**
*
*
* @param x X坐标
* @param y Y坐标
* @param str
* @param color RGB565格式
* @param font_size 1232
* @param bit_order LSB或MSB
*
* @note
*/
int8_t LCD_DrawString(uint16_t x, uint16_t y, const char *str, uint16_t color, uint8_t font_size, LCD_BitOrder_t bit_order) {
uint16_t cursor_x = x;
uint16_t cursor_y = y;
uint8_t char_width, char_height, x_spacing, y_spacing;
switch (font_size) {
case 12:
#ifdef ASCII_1206
char_width = 6;
char_height = 12;
x_spacing = 7; // 推荐间距:宽度+1
y_spacing = 13; // 行间距:高度+1
#endif
break;
case 16:
#ifdef ASCII_1608
char_width = 8;
char_height = 16;
x_spacing = 9;
y_spacing = 17;
#endif
break;
case 24:
#ifdef ASCII_2412
char_width = 12;
char_height = 24;
x_spacing = 13;
y_spacing = 25;
#endif
break;
case 32:
#ifdef ASCII_3216
char_width = 16;
char_height = 32;
x_spacing = 17;
y_spacing = 33;
#endif
break;
default:
return DEVICE_ERR;// 不支持的字体大小
}
while (*str) {
if (*str == '\n') {
cursor_x = x;
cursor_y += y_spacing;
str++;
continue;
}
LCD_DrawChar(cursor_x, cursor_y, *str, color, font_size, bit_order);
cursor_x += x_spacing;
str++;
}
}
/**
*
*
* @param x X坐标
* @param y Y坐标
* @param num
* @param color RGB565格式
* @param font_size 1232
* @param bit_order LSB或MSB
*
* @note LCD_DrawString绘制
*/
int8_t LCD_DrawInteger(uint16_t x, uint16_t y, int32_t num, uint16_t color, uint8_t font_size, LCD_BitOrder_t bit_order) {
char buffer[12]; // 缓冲区足够存储32位整数的字符串表示
snprintf(buffer, sizeof(buffer), "%d", num); // 将整数转换为字符串
LCD_DrawString(x, y, buffer, color, font_size, bit_order); // 调用字符串绘制函数
return DEVICE_OK;
}
/**
*
*
* @param x X坐标
* @param y Y坐标
* @param num
* @param decimal_places
* @param color RGB565格式
* @param font_size 1232
* @param bit_order LSB或MSB
*
* @note LCD_DrawString绘制
*/
int8_t LCD_DrawFloat(uint16_t x, uint16_t y, float num, uint8_t decimal_places, uint16_t color, uint8_t font_size, LCD_BitOrder_t bit_order) {
char buffer[20]; // 缓冲区,足够存储浮点数的字符串表示
snprintf(buffer, sizeof(buffer), "%.*f", decimal_places, num); // 将浮点数转换为字符串
LCD_DrawString(x, y, buffer, color, font_size, bit_order); // 调用字符串绘制函数
return DEVICE_OK;
}
/**
*
*
* @param bitmap
* @param x X坐标
* @param y Y坐标
* @param width
* @param height
* @param color RGB565格式
*
* @note
*/
int8_t LCD_DrawBitmap(const uint8_t *bitmap, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color, LCD_BitOrder_t bit_order) {
if (bitmap == NULL) return DEVICE_ERR_NULL; // 检查位图指针是否为空
uint16_t bytesPerRow = (width + 7) / 8; // 每行的字节数
for (uint16_t row = 0; row < height; row++) { // 遍历每一行
const uint8_t *row_ptr = bitmap + (uint32_t)row * bytesPerRow; // 当前行的起始指针
for (uint16_t byte_i = 0; byte_i < bytesPerRow; byte_i++) { // 遍历每一行的字节
uint8_t b = row_ptr[byte_i]; // 当前字节
for (uint8_t bit = 0; bit < 8; bit++) { // 遍历每个字节的位
uint16_t col = (uint16_t)byte_i * 8 + bit; // 计算当前像素的列坐标
if (col >= width) break; // 如果超出宽度范围,跳过
uint8_t pixel_on = 0;
if (bit_order == MSB) {
// MSB-first字节内最高位(0x80)对应当前字节块的最左像素
pixel_on = (b & (0x80 >> bit)) ? 1 : 0;
} else {
// LSB-first字节内最低位(0x01)对应当前字节块的最左像素
pixel_on = (b & (1U << bit)) ? 1 : 0;
}
if (pixel_on) { // 如果当前位为1则绘制像素
LCD_DrawPoint((uint16_t)(x + col), (uint16_t)(y + row), color);
}
}
}
}
return DEVICE_OK;
}

View File

@ -0,0 +1,156 @@
#ifndef __LCD_H
#define __LCD_H
/* Includes ----------------------------------------------------------------- */
#include "device/device.h"
#include "bsp/spi.h"
#include "bsp/gpio.h"
/* USER INCLUDE BEGIN */
/* USER INCLUDE END */
/* USER DEFINE BEGIN */
/* USER DEFINE END */
/* Exported constants ------------------------------------------------------- */
/* Exported macro ----------------------------------------------------------- */
/* Exported types ----------------------------------------------------------- */
/******************************************************************************
******************************************************************************/
/* USER ATTRIBUTE BEGIN */
#define LCD_WIDTH 135
#define LCD_HEIGHT 240
#define X_OFFSET 52
#define Y_OFFSET 40
/* USER ATTRIBUTE END */
/******************************************************************************
******************************************************************************/
/* USER PIN BEGIN */
#define LCD_CS_LOW() HAL_GPIO_WritePin(LCD_CS_GPIO_Port, LCD_CS_Pin, GPIO_PIN_RESET)
#define LCD_CS_HIGH() HAL_GPIO_WritePin(LCD_CS_GPIO_Port, LCD_CS_Pin, GPIO_PIN_SET)
#define LCD_DC_LOW() HAL_GPIO_WritePin(LCD_RS_GPIO_Port, LCD_RS_Pin, GPIO_PIN_RESET)
#define LCD_DC_HIGH() HAL_GPIO_WritePin(LCD_RS_GPIO_Port, LCD_RS_Pin, GPIO_PIN_SET)
#define LCD_RST_LOW() HAL_GPIO_WritePin(LCD_RES_GPIO_Port, LCD_RES_Pin, GPIO_PIN_RESET)
#define LCD_RST_HIGH() HAL_GPIO_WritePin(LCD_RES_GPIO_Port, LCD_RES_Pin, GPIO_PIN_SET)
/* USER PIN END */
/******************************************************************************
(RGB565)
******************************************************************************/
/* USER COLOR BEGIN */
#define ALICEBLUE 0xEFBF // 爱丽丝蓝
#define ANTIQUEWHITE 0xF75A // 古董白
#define AQUA 0x07FF // 水色
#define AQUAMARINE 0x7FFA // 碧绿色
#define AZURE 0xEFFF // 天蓝色
#define BEIGE 0xF7BB // 米色
#define BISQUE 0xFF18 // Bisque色
#define BLACK 0x0000 // 黑色
#define BLANCHEDALMOND 0xFF59 // 漂白的杏仁色
#define BLUE 0x001F // 蓝色
#define BROWN 0xA145 // 棕色
#define BURLYWOOD 0xDDB0 // 木色
#define CADETBLUE 0x64F3 // 军校蓝
#define CHARTreuse 0x7FE0 // 鲜绿色
#define CHOCOLATE 0xD344 // 巧克力色
#define CORAL 0xFBEA // 珊瑚色
#define CORNFLOWERBLUE 0x64BD // 矢车菊蓝
#define CORNSILK 0xFFBB // 玉米丝色
#define CRIMSON 0xD8A7 // 深红
#define CYAN 0x07FF // 青色
#define DARKBLUE 0x0011 // 深蓝色
#define DARKCYAN 0x0451 // 深青色
#define DARKGOLDENROD 0xB421 // 深金菊色
#define DARKGRAY 0xAD55 // 深灰色
#define DARKGREEN 0x0320 // 深绿色
#define DARKGREY 0xAD55 // 深灰色同DARKGRAY
#define DARKOLIVEGREEN 0x5346 // 深橄榄绿
#define DARKORANGE 0xFC60 // 深橙色
#define DARKVIOLET 0x901A // 深紫罗兰色
#define DEEPPINK 0xF8B2 // 深粉红色
#define DEEPSKYBLUE 0x05FF // 深天蓝色
#define DODGERBLUE 0x249F // 闪兰色
#define FIREBRICK 0xB104 // 火砖色
#define FUCHSIA 0xF81F // 紫红色
#define GAINSBORO 0xDEDB // 增白
#define GOLD 0xFEA0 // 金色
#define GOLDENROD 0xDD24 // 金菊色
#define GRAY 0x8410 // 灰色
#define GREEN 0x0400 // 绿色
#define GREENYELLOW 0xAFE6 // 绿黄色
#define GREY 0x8410 // 灰色同GRAY
#define HONEYDEW 0xEFFD // 蜜色
#define HOTPINK 0xFB56 // 热粉红色
#define IVORY 0xFFFD // 象牙色
#define KHAKI 0xEF31 // 卡其色
#define LAVENDER 0xE73E // 淡紫色
#define LIME 0x07E0 // 酸橙绿
#define LIMEGREEN 0x3666 // 酸橙绿
#define LINEN 0xF77C // 亚麻色
#define MAGENTA 0xF81F // 洋红色
#define MAROON 0x8000 // 褐红色
#define MEDIUMAQUAMARINE 0x6675 // 中等碧绿色
#define MEDIUMBLUE 0x0019 // 中等蓝色
#define MEDIUMPURPLE 0x939b // 中等紫色
#define MEDIUMSEAGREEN 0x3d8e // 中等海绿色
#define MEDIUMSLATEBLUE 0x7b5d // 中等石板蓝
#define MEDIUMSPRINGGREEN 0x07d3 // 中等春绿色
#define MEDIUMTURQUOISE 0x4e99 // 中等青绿色
#define MEDIUMVIOLETRED 0xC0B0 // 中等紫红色
#define MIDNIGHTBLUE 0x18CE // 午夜蓝
#define MINTCREAME 0xF7FE // 薄荷奶油色
#define MISTYROSE 0xFF1B // 雾玫瑰色
#define MOCCASIN 0xFF16 // 鹿皮色
#define NAVAJOWHITE 0xFEF5 // Navajo白
#define NAVY 0x0010 // 海军蓝
#define OLDLACE 0xFFBC // 旧蕾丝色
#define OLIVE 0x8400 // 橄榄色
#define OLIVEDRAB 0x6C64 // 橄榄褐色
#define ORANGE 0xFD20 // 橙色
#define ORANGERED 0xFA20 // 橙红色
#define ORCHID 0xDB9A // 兰花色
#define PALE GOLDENROD 0xEF35 // 苍白金菊色
#define PALEGREEN 0x97D2 // 苍白绿色
#define MEDIUMORCHID 0xbaba // 中等紫罗兰色
#define VIOLET 0xEC1D // 紫罗兰色 /--- *I LOVE VIOLET FOREVERT-T* ---/
#define VIOLET_SOFT 0xE31F // 柔和的紫罗兰色
/* USER COLOR END */
/******************************************************************************
end--(RGB565)
******************************************************************************/
typedef enum {
LCD_ORIENTATION_PORTRAIT = 0, // 竖屏模式
LCD_ORIENTATION_LANDSCAPE = 1, // 横屏模式90°顺时针旋转
LCD_ORIENTATION_LANDSCAPE_INVERTED = 2, // 横屏模式90°逆时针旋转
LCD_ORIENTATION_PORTRAIT_INVERTED = 3 // 竖屏模式180°旋转
} LCD_Orientation_t;
typedef enum {
LSB=0,
MSB=1,
}LCD_BitOrder_t;
/* Exported functions prototypes -------------------------------------------- */
int8_t LCD_Init(LCD_Orientation_t orientation);
int8_t LCD_Clear(uint16_t color);
int8_t LCD_DrawPoint(uint16_t x, uint16_t y, uint16_t color);
int8_t LCD_DrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
int8_t LCD_DrawRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,uint16_t color);
int8_t LCD_DrawHollowCircle(uint16_t x0,uint16_t y0,uint16_t r,uint16_t color);
int8_t LCD_DrawSolidCircle(uint16_t x0, uint16_t y0, uint16_t r, uint16_t color);
int8_t LCD_DrawChar(uint16_t x, uint16_t y, char ch, uint16_t color, uint8_t font_size, LCD_BitOrder_t bit_order);
int8_t LCD_DrawString(uint16_t x, uint16_t y, const char *str, uint16_t color, uint8_t font_size, LCD_BitOrder_t bit_order);
int8_t LCD_DrawInteger(uint16_t x, uint16_t y, int32_t num, uint16_t color, uint8_t font_size, LCD_BitOrder_t bit_order);
int8_t LCD_DrawFloat(uint16_t x, uint16_t y, float num, uint8_t decimal_places, uint16_t color, uint8_t font_size, LCD_BitOrder_t bit_order);
int8_t LCD_DrawBitmap(const uint8_t *bitmap, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color, LCD_BitOrder_t bit_order);
/* USER FUNCTION BEGIN */
/* USER FUNCTION END */
#endif // __LCD_H

View File

@ -1,105 +1,117 @@
#ifndef __LCDFONT_H
#define __LCDFONT_H
#pragma once
#include <stdint.h>
// #define ASCII_1206
#define ASCII_1608
#define ASCII_2412
#define ASCII_3216
#define LOGO_M
// #define LOGO_R
// #define HUAJI
#ifdef ASCII_1206
const unsigned char ascii_1206[][12]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x04,0x00,0x00},/*"!",1*/
{0x14,0x14,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
{0x00,0x00,0x0A,0x0A,0x1F,0x0A,0x0A,0x1F,0x0A,0x0A,0x00,0x00},/*"#",3*/
{0x00,0x04,0x0E,0x15,0x05,0x06,0x0C,0x14,0x15,0x0E,0x04,0x00},/*"$",4*/
{0x00,0x00,0x12,0x15,0x0D,0x15,0x2E,0x2C,0x2A,0x12,0x00,0x00},/*"%",5*/
{0x00,0x00,0x04,0x0A,0x0A,0x36,0x15,0x15,0x29,0x16,0x00,0x00},/*"&",6*/
{0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x10,0x08,0x08,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x00},/*"(",8*/
{0x02,0x04,0x04,0x08,0x08,0x08,0x08,0x08,0x04,0x04,0x02,0x00},/*")",9*/
{0x00,0x00,0x00,0x04,0x15,0x0E,0x0E,0x15,0x04,0x00,0x00,0x00},/*"*",10*/
{0x00,0x00,0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00,0x00,0x00},/*"+",11*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x01,0x00},/*",",12*/
{0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00},/*"-",13*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00},/*".",14*/
{0x00,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x00},/*"/",15*/
{0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x11,0x11,0x0E,0x00,0x00},/*"0",16*/
{0x00,0x00,0x04,0x06,0x04,0x04,0x04,0x04,0x04,0x0E,0x00,0x00},/*"1",17*/
{0x00,0x00,0x0E,0x11,0x11,0x08,0x04,0x02,0x01,0x1F,0x00,0x00},/*"2",18*/
{0x00,0x00,0x0E,0x11,0x10,0x0C,0x10,0x10,0x11,0x0E,0x00,0x00},/*"3",19*/
{0x00,0x00,0x08,0x0C,0x0C,0x0A,0x09,0x1F,0x08,0x1C,0x00,0x00},/*"4",20*/
{0x00,0x00,0x1F,0x01,0x01,0x0F,0x11,0x10,0x11,0x0E,0x00,0x00},/*"5",21*/
{0x00,0x00,0x0C,0x12,0x01,0x0D,0x13,0x11,0x11,0x0E,0x00,0x00},/*"6",22*/
{0x00,0x00,0x1E,0x10,0x08,0x08,0x04,0x04,0x04,0x04,0x00,0x00},/*"7",23*/
{0x00,0x00,0x0E,0x11,0x11,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00},/*"8",24*/
{0x00,0x00,0x0E,0x11,0x11,0x19,0x16,0x10,0x09,0x06,0x00,0x00},/*"9",25*/
{0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x04,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x04,0x00},/*";",27*/
{0x00,0x00,0x10,0x08,0x04,0x02,0x02,0x04,0x08,0x10,0x00,0x00},/*"<",28*/
{0x00,0x00,0x00,0x00,0x3F,0x00,0x3F,0x00,0x00,0x00,0x00,0x00},/*"=",29*/
{0x00,0x00,0x02,0x04,0x08,0x10,0x10,0x08,0x04,0x02,0x00,0x00},/*">",30*/
{0x00,0x00,0x0E,0x11,0x11,0x08,0x04,0x04,0x00,0x04,0x00,0x00},/*"?",31*/
{0x00,0x00,0x1C,0x22,0x29,0x2D,0x2D,0x1D,0x22,0x1C,0x00,0x00},/*"@",32*/
{0x00,0x00,0x04,0x04,0x0C,0x0A,0x0A,0x1E,0x12,0x33,0x00,0x00},/*"A",33*/
{0x00,0x00,0x0F,0x12,0x12,0x0E,0x12,0x12,0x12,0x0F,0x00,0x00},/*"B",34*/
{0x00,0x00,0x1E,0x11,0x01,0x01,0x01,0x01,0x11,0x0E,0x00,0x00},/*"C",35*/
{0x00,0x00,0x0F,0x12,0x12,0x12,0x12,0x12,0x12,0x0F,0x00,0x00},/*"D",36*/
{0x00,0x00,0x1F,0x12,0x0A,0x0E,0x0A,0x02,0x12,0x1F,0x00,0x00},/*"E",37*/
{0x00,0x00,0x1F,0x12,0x0A,0x0E,0x0A,0x02,0x02,0x07,0x00,0x00},/*"F",38*/
{0x00,0x00,0x1C,0x12,0x01,0x01,0x39,0x11,0x12,0x0C,0x00,0x00},/*"G",39*/
{0x00,0x00,0x33,0x12,0x12,0x1E,0x12,0x12,0x12,0x33,0x00,0x00},/*"H",40*/
{0x00,0x00,0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x1F,0x00,0x00},/*"I",41*/
{0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x09,0x07},/*"J",42*/
{0x00,0x00,0x37,0x12,0x0A,0x06,0x0A,0x12,0x12,0x37,0x00,0x00},/*"K",43*/
{0x00,0x00,0x07,0x02,0x02,0x02,0x02,0x02,0x22,0x3F,0x00,0x00},/*"L",44*/
{0x00,0x00,0x3B,0x1B,0x1B,0x1B,0x15,0x15,0x15,0x35,0x00,0x00},/*"M",45*/
{0x00,0x00,0x3B,0x12,0x16,0x16,0x1A,0x1A,0x12,0x17,0x00,0x00},/*"N",46*/
{0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x11,0x11,0x0E,0x00,0x00},/*"O",47*/
{0x00,0x00,0x0F,0x12,0x12,0x0E,0x02,0x02,0x02,0x07,0x00,0x00},/*"P",48*/
{0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x17,0x19,0x0E,0x18,0x00},/*"Q",49*/
{0x00,0x00,0x0F,0x12,0x12,0x0E,0x0A,0x12,0x12,0x37,0x00,0x00},/*"R",50*/
{0x00,0x00,0x1E,0x11,0x01,0x06,0x08,0x10,0x11,0x0F,0x00,0x00},/*"S",51*/
{0x00,0x00,0x1F,0x15,0x04,0x04,0x04,0x04,0x04,0x0E,0x00,0x00},/*"T",52*/
{0x00,0x00,0x33,0x12,0x12,0x12,0x12,0x12,0x12,0x0C,0x00,0x00},/*"U",53*/
{0x00,0x00,0x33,0x12,0x12,0x0A,0x0A,0x0C,0x04,0x04,0x00,0x00},/*"V",54*/
{0x00,0x00,0x15,0x15,0x15,0x15,0x0E,0x0A,0x0A,0x0A,0x00,0x00},/*"W",55*/
{0x00,0x00,0x1B,0x0A,0x0A,0x04,0x04,0x0A,0x0A,0x1B,0x00,0x00},/*"X",56*/
{0x00,0x00,0x1B,0x0A,0x0A,0x0A,0x04,0x04,0x04,0x0E,0x00,0x00},/*"Y",57*/
{0x00,0x00,0x1F,0x09,0x08,0x04,0x04,0x02,0x12,0x1F,0x00,0x00},/*"Z",58*/
{0x1C,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x1C,0x00},/*"[",59*/
{0x00,0x02,0x02,0x04,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x00},/*"\",60*/
{0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0E,0x00},/*"]",61*/
{0x04,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F},/*"_",63*/
{0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x00,0x00,0x00,0x00,0x0C,0x12,0x1C,0x12,0x3C,0x00,0x00},/*"a",65*/
{0x00,0x03,0x02,0x02,0x02,0x0E,0x12,0x12,0x12,0x0E,0x00,0x00},/*"b",66*/
{0x00,0x00,0x00,0x00,0x00,0x1C,0x12,0x02,0x12,0x0C,0x00,0x00},/*"c",67*/
{0x00,0x18,0x10,0x10,0x10,0x1C,0x12,0x12,0x12,0x3C,0x00,0x00},/*"d",68*/
{0x00,0x00,0x00,0x00,0x00,0x0C,0x12,0x1E,0x02,0x1C,0x00,0x00},/*"e",69*/
{0x00,0x18,0x24,0x04,0x04,0x1E,0x04,0x04,0x04,0x1E,0x00,0x00},/*"f",70*/
{0x00,0x00,0x00,0x00,0x00,0x3C,0x12,0x0C,0x02,0x1C,0x22,0x1C},/*"g",71*/
{0x00,0x03,0x02,0x02,0x02,0x0E,0x12,0x12,0x12,0x37,0x00,0x00},/*"h",72*/
{0x00,0x04,0x04,0x00,0x00,0x06,0x04,0x04,0x04,0x0E,0x00,0x00},/*"i",73*/
{0x00,0x08,0x08,0x00,0x00,0x0C,0x08,0x08,0x08,0x08,0x08,0x07},/*"j",74*/
{0x00,0x03,0x02,0x02,0x02,0x1A,0x0A,0x06,0x0A,0x13,0x00,0x00},/*"k",75*/
{0x00,0x07,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x1F,0x00,0x00},/*"l",76*/
{0x00,0x00,0x00,0x00,0x00,0x0F,0x15,0x15,0x15,0x15,0x00,0x00},/*"m",77*/
{0x00,0x00,0x00,0x00,0x00,0x0F,0x12,0x12,0x12,0x37,0x00,0x00},/*"n",78*/
{0x00,0x00,0x00,0x00,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00,0x00},/*"o",79*/
{0x00,0x00,0x00,0x00,0x00,0x0F,0x12,0x12,0x12,0x0E,0x02,0x07},/*"p",80*/
{0x00,0x00,0x00,0x00,0x00,0x1C,0x12,0x12,0x12,0x1C,0x10,0x38},/*"q",81*/
{0x00,0x00,0x00,0x00,0x00,0x1B,0x06,0x02,0x02,0x07,0x00,0x00},/*"r",82*/
{0x00,0x00,0x00,0x00,0x00,0x1E,0x02,0x0C,0x10,0x1E,0x00,0x00},/*"s",83*/
{0x00,0x00,0x00,0x04,0x04,0x1E,0x04,0x04,0x04,0x1C,0x00,0x00},/*"t",84*/
{0x00,0x00,0x00,0x00,0x00,0x1B,0x12,0x12,0x12,0x3C,0x00,0x00},/*"u",85*/
{0x00,0x00,0x00,0x00,0x00,0x1B,0x0A,0x0A,0x04,0x04,0x00,0x00},/*"v",86*/
{0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x0E,0x0A,0x0A,0x00,0x00},/*"w",87*/
{0x00,0x00,0x00,0x00,0x00,0x1B,0x0A,0x04,0x0A,0x1B,0x00,0x00},/*"x",88*/
{0x00,0x00,0x00,0x00,0x00,0x33,0x12,0x12,0x0C,0x08,0x04,0x03},/*"y",89*/
{0x00,0x00,0x00,0x00,0x00,0x1E,0x08,0x04,0x04,0x1E,0x00,0x00},/*"z",90*/
{0x18,0x08,0x08,0x08,0x08,0x0C,0x08,0x08,0x08,0x08,0x18,0x00},/*"{",91*/
{0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08},/*"|",92*/
{0x06,0x04,0x04,0x04,0x04,0x08,0x04,0x04,0x04,0x04,0x06,0x00},/*"}",93*/
{0x16,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"~",94*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x04,0x00,0x00},/*"!",1*/
{0x14,0x14,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
{0x00,0x00,0x0A,0x0A,0x1F,0x0A,0x0A,0x1F,0x0A,0x0A,0x00,0x00},/*"#",3*/
{0x00,0x04,0x0E,0x15,0x05,0x06,0x0C,0x14,0x15,0x0E,0x04,0x00},/*"$",4*/
{0x00,0x00,0x12,0x15,0x0D,0x15,0x2E,0x2C,0x2A,0x12,0x00,0x00},/*"%",5*/
{0x00,0x00,0x04,0x0A,0x0A,0x36,0x15,0x15,0x29,0x16,0x00,0x00},/*"&",6*/
{0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x10,0x08,0x08,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x00},/*"(",8*/
{0x02,0x04,0x04,0x08,0x08,0x08,0x08,0x08,0x04,0x04,0x02,0x00},/*")",9*/
{0x00,0x00,0x00,0x04,0x15,0x0E,0x0E,0x15,0x04,0x00,0x00,0x00},/*"*",10*/
{0x00,0x00,0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00,0x00,0x00},/*"+",11*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x01,0x00},/*",",12*/
{0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00},/*"-",13*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00},/*".",14*/
{0x00,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x00},/*"/",15*/
{0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x11,0x11,0x0E,0x00,0x00},/*"0",16*/
{0x00,0x00,0x04,0x06,0x04,0x04,0x04,0x04,0x04,0x0E,0x00,0x00},/*"1",17*/
{0x00,0x00,0x0E,0x11,0x11,0x08,0x04,0x02,0x01,0x1F,0x00,0x00},/*"2",18*/
{0x00,0x00,0x0E,0x11,0x10,0x0C,0x10,0x10,0x11,0x0E,0x00,0x00},/*"3",19*/
{0x00,0x00,0x08,0x0C,0x0C,0x0A,0x09,0x1F,0x08,0x1C,0x00,0x00},/*"4",20*/
{0x00,0x00,0x1F,0x01,0x01,0x0F,0x11,0x10,0x11,0x0E,0x00,0x00},/*"5",21*/
{0x00,0x00,0x0C,0x12,0x01,0x0D,0x13,0x11,0x11,0x0E,0x00,0x00},/*"6",22*/
{0x00,0x00,0x1E,0x10,0x08,0x08,0x04,0x04,0x04,0x04,0x00,0x00},/*"7",23*/
{0x00,0x00,0x0E,0x11,0x11,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00},/*"8",24*/
{0x00,0x00,0x0E,0x11,0x11,0x19,0x16,0x10,0x09,0x06,0x00,0x00},/*"9",25*/
{0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x04,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x04,0x00},/*";",27*/
{0x00,0x00,0x10,0x08,0x04,0x02,0x02,0x04,0x08,0x10,0x00,0x00},/*"<",28*/
{0x00,0x00,0x00,0x00,0x3F,0x00,0x3F,0x00,0x00,0x00,0x00,0x00},/*"=",29*/
{0x00,0x00,0x02,0x04,0x08,0x10,0x10,0x08,0x04,0x02,0x00,0x00},/*">",30*/
{0x00,0x00,0x0E,0x11,0x11,0x08,0x04,0x04,0x00,0x04,0x00,0x00},/*"?",31*/
{0x00,0x00,0x1C,0x22,0x29,0x2D,0x2D,0x1D,0x22,0x1C,0x00,0x00},/*"@",32*/
{0x00,0x00,0x04,0x04,0x0C,0x0A,0x0A,0x1E,0x12,0x33,0x00,0x00},/*"A",33*/
{0x00,0x00,0x0F,0x12,0x12,0x0E,0x12,0x12,0x12,0x0F,0x00,0x00},/*"B",34*/
{0x00,0x00,0x1E,0x11,0x01,0x01,0x01,0x01,0x11,0x0E,0x00,0x00},/*"C",35*/
{0x00,0x00,0x0F,0x12,0x12,0x12,0x12,0x12,0x12,0x0F,0x00,0x00},/*"D",36*/
{0x00,0x00,0x1F,0x12,0x0A,0x0E,0x0A,0x02,0x12,0x1F,0x00,0x00},/*"E",37*/
{0x00,0x00,0x1F,0x12,0x0A,0x0E,0x0A,0x02,0x02,0x07,0x00,0x00},/*"F",38*/
{0x00,0x00,0x1C,0x12,0x01,0x01,0x39,0x11,0x12,0x0C,0x00,0x00},/*"G",39*/
{0x00,0x00,0x33,0x12,0x12,0x1E,0x12,0x12,0x12,0x33,0x00,0x00},/*"H",40*/
{0x00,0x00,0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x1F,0x00,0x00},/*"I",41*/
{0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x09,0x07},/*"J",42*/
{0x00,0x00,0x37,0x12,0x0A,0x06,0x0A,0x12,0x12,0x37,0x00,0x00},/*"K",43*/
{0x00,0x00,0x07,0x02,0x02,0x02,0x02,0x02,0x22,0x3F,0x00,0x00},/*"L",44*/
{0x00,0x00,0x3B,0x1B,0x1B,0x1B,0x15,0x15,0x15,0x35,0x00,0x00},/*"M",45*/
{0x00,0x00,0x3B,0x12,0x16,0x16,0x1A,0x1A,0x12,0x17,0x00,0x00},/*"N",46*/
{0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x11,0x11,0x0E,0x00,0x00},/*"O",47*/
{0x00,0x00,0x0F,0x12,0x12,0x0E,0x02,0x02,0x02,0x07,0x00,0x00},/*"P",48*/
{0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x17,0x19,0x0E,0x18,0x00},/*"Q",49*/
{0x00,0x00,0x0F,0x12,0x12,0x0E,0x0A,0x12,0x12,0x37,0x00,0x00},/*"R",50*/
{0x00,0x00,0x1E,0x11,0x01,0x06,0x08,0x10,0x11,0x0F,0x00,0x00},/*"S",51*/
{0x00,0x00,0x1F,0x15,0x04,0x04,0x04,0x04,0x04,0x0E,0x00,0x00},/*"T",52*/
{0x00,0x00,0x33,0x12,0x12,0x12,0x12,0x12,0x12,0x0C,0x00,0x00},/*"U",53*/
{0x00,0x00,0x33,0x12,0x12,0x0A,0x0A,0x0C,0x04,0x04,0x00,0x00},/*"V",54*/
{0x00,0x00,0x15,0x15,0x15,0x15,0x0E,0x0A,0x0A,0x0A,0x00,0x00},/*"W",55*/
{0x00,0x00,0x1B,0x0A,0x0A,0x04,0x04,0x0A,0x0A,0x1B,0x00,0x00},/*"X",56*/
{0x00,0x00,0x1B,0x0A,0x0A,0x0A,0x04,0x04,0x04,0x0E,0x00,0x00},/*"Y",57*/
{0x00,0x00,0x1F,0x09,0x08,0x04,0x04,0x02,0x12,0x1F,0x00,0x00},/*"Z",58*/
{0x1C,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x1C,0x00},/*"[",59*/
{0x00,0x02,0x02,0x04,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x00},/*"\",60*/
{0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0E,0x00},/*"]",61*/
{0x04,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F},/*"_",63*/
{0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x00,0x00,0x00,0x00,0x0C,0x12,0x1C,0x12,0x3C,0x00,0x00},/*"a",65*/
{0x00,0x03,0x02,0x02,0x02,0x0E,0x12,0x12,0x12,0x0E,0x00,0x00},/*"b",66*/
{0x00,0x00,0x00,0x00,0x00,0x1C,0x12,0x02,0x12,0x0C,0x00,0x00},/*"c",67*/
{0x00,0x18,0x10,0x10,0x10,0x1C,0x12,0x12,0x12,0x3C,0x00,0x00},/*"d",68*/
{0x00,0x00,0x00,0x00,0x00,0x0C,0x12,0x1E,0x02,0x1C,0x00,0x00},/*"e",69*/
{0x00,0x18,0x24,0x04,0x04,0x1E,0x04,0x04,0x04,0x1E,0x00,0x00},/*"f",70*/
{0x00,0x00,0x00,0x00,0x00,0x3C,0x12,0x0C,0x02,0x1C,0x22,0x1C},/*"g",71*/
{0x00,0x03,0x02,0x02,0x02,0x0E,0x12,0x12,0x12,0x37,0x00,0x00},/*"h",72*/
{0x00,0x04,0x04,0x00,0x00,0x06,0x04,0x04,0x04,0x0E,0x00,0x00},/*"i",73*/
{0x00,0x08,0x08,0x00,0x00,0x0C,0x08,0x08,0x08,0x08,0x08,0x07},/*"j",74*/
{0x00,0x03,0x02,0x02,0x02,0x1A,0x0A,0x06,0x0A,0x13,0x00,0x00},/*"k",75*/
{0x00,0x07,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x1F,0x00,0x00},/*"l",76*/
{0x00,0x00,0x00,0x00,0x00,0x0F,0x15,0x15,0x15,0x15,0x00,0x00},/*"m",77*/
{0x00,0x00,0x00,0x00,0x00,0x0F,0x12,0x12,0x12,0x37,0x00,0x00},/*"n",78*/
{0x00,0x00,0x00,0x00,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00,0x00},/*"o",79*/
{0x00,0x00,0x00,0x00,0x00,0x0F,0x12,0x12,0x12,0x0E,0x02,0x07},/*"p",80*/
{0x00,0x00,0x00,0x00,0x00,0x1C,0x12,0x12,0x12,0x1C,0x10,0x38},/*"q",81*/
{0x00,0x00,0x00,0x00,0x00,0x1B,0x06,0x02,0x02,0x07,0x00,0x00},/*"r",82*/
{0x00,0x00,0x00,0x00,0x00,0x1E,0x02,0x0C,0x10,0x1E,0x00,0x00},/*"s",83*/
{0x00,0x00,0x00,0x04,0x04,0x1E,0x04,0x04,0x04,0x1C,0x00,0x00},/*"t",84*/
{0x00,0x00,0x00,0x00,0x00,0x1B,0x12,0x12,0x12,0x3C,0x00,0x00},/*"u",85*/
{0x00,0x00,0x00,0x00,0x00,0x1B,0x0A,0x0A,0x04,0x04,0x00,0x00},/*"v",86*/
{0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x0E,0x0A,0x0A,0x00,0x00},/*"w",87*/
{0x00,0x00,0x00,0x00,0x00,0x1B,0x0A,0x04,0x0A,0x1B,0x00,0x00},/*"x",88*/
{0x00,0x00,0x00,0x00,0x00,0x33,0x12,0x12,0x0C,0x08,0x04,0x03},/*"y",89*/
{0x00,0x00,0x00,0x00,0x00,0x1E,0x08,0x04,0x04,0x1E,0x00,0x00},/*"z",90*/
{0x18,0x08,0x08,0x08,0x08,0x0C,0x08,0x08,0x08,0x08,0x18,0x00},/*"{",91*/
{0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08},/*"|",92*/
{0x06,0x04,0x04,0x04,0x04,0x08,0x04,0x04,0x04,0x04,0x06,0x00},/*"}",93*/
{0x16,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"~",94*/
};
#endif // ASCII_1206
#ifdef ASCII_1608
const unsigned char ascii_1608[][16]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x18,0x18,0x00,0x00},/*"!",1*/
@ -197,6 +209,9 @@ const unsigned char ascii_1608[][16]={
{0x00,0x06,0x08,0x08,0x08,0x08,0x08,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x06,0x00},/*"}",93*/
{0x0C,0x32,0xC2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"~",94*/
};
#endif
#ifdef ASCII_2412
const unsigned char ascii_2412[][48]={
{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},/*" ",0*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
@ -293,9 +308,10 @@ const unsigned char ascii_2412[][48]={
{0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00},/*"|",92*/
{0x00,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x20,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x0C,0x00,0x00,0x00},/*"}",93*/
{0x00,0x00,0x1C,0x00,0x22,0x04,0xC2,0x04,0x80,0x03,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},/*"~",94*/
};
#endif
#ifdef ASCII_3216
const unsigned char ascii_3216[][64]={
{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},/*" ",0*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0xC0,0x03,0xC0,0x03,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
@ -393,163 +409,213 @@ const unsigned char ascii_3216[][64]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x40,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x0C,0x00,0x00,0x00},/*"}",93*/
{0x00,0x00,0x38,0x00,0xC4,0x00,0x86,0x40,0x02,0x61,0x00,0x22,0x00,0x1C,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},/*"~",94*/
};
typedef struct
{
unsigned char Index[2];
unsigned char Msk[24];
}typFNT_GB12;
const typFNT_GB12 tfont12[]={
//"中",
0x20,0x00,0x20,0x00,0x20,0x00,0xFE,0x03,0x22,0x02,0x22,0x02,0x22,0x02,0xFE,0x03,
0x22,0x02,0x20,0x00,0x20,0x00,0x20,0x00,/*"中",0*/
//"景",
0xFC,0x01,0x04,0x01,0xFC,0x01,0x04,0x01,0xFC,0x01,0x20,0x00,0xFF,0x07,0x04,0x01,
0xFC,0x01,0x20,0x00,0x24,0x01,0x32,0x02,/*"景",1*/
//"园",
0xFE,0x07,0x02,0x04,0xFA,0x04,0x02,0x04,0x02,0x04,0xFE,0x05,0x52,0x04,0x52,0x04,
0x4A,0x05,0x86,0x05,0x02,0x04,0xFE,0x07,/*"园",2*/
//"电",
0x10,0x00,0x10,0x00,0xFF,0x01,0x11,0x01,0x11,0x01,0xFF,0x01,0x11,0x01,0x11,0x01,
0xFF,0x01,0x11,0x04,0x10,0x04,0xE0,0x07,/*"电",3*/
//"子",
0x00,0x00,0xFC,0x01,0x80,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0xFF,0x07,0x20,0x00,
0x20,0x00,0x20,0x00,0x20,0x00,0x38,0x00,/*"子",4*/
};
typedef struct
{
unsigned char Index[2];
unsigned char Msk[32];
}typFNT_GB16;
const typFNT_GB16 tfont16[]={
//"中",
0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xFC,0x1F,0x84,0x10,0x84,0x10,0x84,0x10,
0x84,0x10,0x84,0x10,0xFC,0x1F,0x84,0x10,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,/*"中",0*/
//"景",
0xF8,0x0F,0x08,0x08,0xF8,0x0F,0x08,0x08,0xF8,0x0F,0x80,0x00,0xFF,0x7F,0x00,0x00,
0xF8,0x0F,0x08,0x08,0x08,0x08,0xF8,0x0F,0x80,0x00,0x84,0x10,0xA2,0x20,0x40,0x00,/*"景",1*/
//"园",
0x00,0x00,0xFE,0x3F,0x02,0x20,0xF2,0x27,0x02,0x20,0x02,0x20,0xFA,0x2F,0x22,0x21,
0x22,0x21,0x22,0x21,0x12,0x29,0x12,0x29,0x0A,0x2E,0x02,0x20,0xFE,0x3F,0x02,0x20,/*"园",2*/
//"电",
0x80,0x00,0x80,0x00,0x80,0x00,0xFC,0x1F,0x84,0x10,0x84,0x10,0x84,0x10,0xFC,0x1F,
0x84,0x10,0x84,0x10,0x84,0x10,0xFC,0x1F,0x84,0x50,0x80,0x40,0x80,0x40,0x00,0x7F,/*"电",3*/
//"子",
0x00,0x00,0xFE,0x1F,0x00,0x08,0x00,0x04,0x00,0x02,0x80,0x01,0x80,0x00,0xFF,0x7F,
0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xA0,0x00,0x40,0x00,/*"子",4*/
};
typedef struct
{
unsigned char Index[2];
unsigned char Msk[72];
}typFNT_GB24;
const typFNT_GB24 tfont24[]={
//"中",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,
0x08,0x00,0x08,0x08,0x18,0xF8,0xFF,0x1F,0x18,0x08,0x18,0x18,0x08,0x18,0x18,0x08,
0x18,0x18,0x08,0x18,0x18,0x08,0x18,0x18,0x08,0x18,0xF8,0xFF,0x1F,0x08,0x08,0x08,
0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x18,0x00,0x00,
0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,/*"中",0*/
//"景",
0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x06,0xC0,0xFF,0x07,0x40,0x00,0x06,0xC0,
0xFF,0x07,0x40,0x00,0x06,0xC0,0xFF,0x07,0x40,0x08,0x02,0x00,0x30,0x00,0xFE,0xFF,
0x3F,0x00,0x00,0x00,0xC0,0xFF,0x07,0xC0,0x00,0x02,0xC0,0x00,0x02,0xC0,0x00,0x02,
0xC0,0xFF,0x03,0x80,0x10,0x00,0x80,0x11,0x01,0x60,0x10,0x0E,0x30,0x10,0x18,0x0C,
0x1E,0x30,0x00,0x1C,0x00,0x00,0x00,0x00,/*"景",1*/
//"园",
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x30,0xF8,0xFF,0x1F,0x08,0x00,0x10,0x08,
0xC0,0x10,0x08,0x3F,0x10,0x08,0x00,0x10,0x08,0x00,0x10,0x08,0x00,0x13,0xC8,0xFF,
0x10,0x08,0x22,0x10,0x08,0x22,0x10,0x08,0x22,0x10,0x08,0x22,0x10,0x08,0x21,0x12,
0x08,0x21,0x14,0x88,0x60,0x16,0x48,0xC0,0x13,0x28,0x00,0x10,0x08,0x00,0x10,0xF8,
0xFF,0x1F,0x08,0x00,0x10,0x00,0x00,0x00,/*"园",2*/
//"电",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,
0x08,0x00,0xF0,0xFF,0x0F,0x10,0x08,0x04,0x10,0x08,0x04,0x10,0x08,0x04,0x10,0x08,
0x04,0xF0,0xFF,0x07,0x10,0x08,0x04,0x10,0x08,0x04,0x10,0x08,0x04,0x10,0x08,0x04,
0xF0,0xFF,0x07,0x10,0x08,0x00,0x00,0x08,0x10,0x00,0x08,0x10,0x00,0x08,0x20,0x00,
0x18,0x30,0x00,0xF0,0x1F,0x00,0x00,0x00,/*"电",3*/
//"子",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xF0,0xFF,0x0F,0x00,0x00,0x06,0x00,
0x00,0x01,0x00,0xC0,0x00,0x00,0x28,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,
0x30,0xFE,0xFF,0x7F,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,
0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,
0x1F,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,/*"子",4*/
};
typedef struct
{
unsigned char Index[2];
unsigned char Msk[128];
}typFNT_GB32;
const typFNT_GB32 tfont32[]={
//"中",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x01,0x00,
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
0x10,0x80,0x01,0x0C,0xF0,0xFF,0xFF,0x0F,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,
0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,
0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0xF0,0xFF,0xFF,0x07,0x30,0x80,0x01,0x04,
0x30,0x80,0x01,0x04,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,/*"中",0*/
//"景",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,
0x00,0xFF,0xFF,0x01,0x00,0x03,0x80,0x01,0x00,0x03,0x80,0x01,0x00,0xFF,0xFF,0x01,
0x00,0x03,0x80,0x01,0x00,0x03,0x80,0x01,0x00,0xFF,0xFF,0x01,0x00,0x81,0x81,0x00,
0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x1C,0xFC,0xFF,0xFF,0x3F,0x00,0x00,0x40,0x00,
0x00,0x03,0xC0,0x01,0x00,0xFF,0xFF,0x01,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0xFF,0xFF,0x00,0x00,0x01,0x41,0x00,0x00,0x04,0x01,0x00,
0x00,0x0E,0x71,0x00,0x00,0x07,0x81,0x01,0x80,0x01,0x01,0x07,0x60,0x00,0x01,0x0E,
0x18,0x98,0x01,0x1C,0x04,0xE0,0x01,0x18,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,/*"景",1*/
//"园",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xF0,0xFF,0xFF,0x1F,
0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x10,0x0C,0x30,0xFE,0x3F,0x0C,
0x30,0x04,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,
0x30,0x00,0xC0,0x0C,0xF0,0xFF,0xFF,0x0D,0x30,0x30,0x06,0x0E,0x30,0x30,0x06,0x0C,
0x30,0x10,0x06,0x0C,0x30,0x10,0x06,0x0C,0x30,0x10,0x06,0x0C,0x30,0x18,0x86,0x0C,
0x30,0x18,0x86,0x0C,0x30,0x08,0x06,0x0D,0x30,0x0C,0x86,0x0D,0x30,0x06,0xEE,0x0F,
0x30,0x02,0xFC,0x0D,0x30,0x01,0x00,0x0C,0xF0,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,
0xF0,0xFF,0xFF,0x0F,0x30,0x00,0x00,0x0C,0x10,0x00,0x00,0x04,0x00,0x00,0x00,0x00,/*"园",2*/
//"电",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0xC0,0x01,0x00,
0x00,0xC0,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0xC0,0x00,0x00,
0xE0,0xFF,0xFF,0x03,0x60,0xC0,0x00,0x03,0x60,0xC0,0x00,0x03,0x60,0xC0,0x00,0x03,
0x60,0xC0,0x00,0x03,0x60,0xC0,0x00,0x03,0x60,0xC0,0x00,0x03,0xE0,0xFF,0xFF,0x03,
0x60,0xC0,0x00,0x03,0x60,0xC0,0x00,0x03,0x60,0xC0,0x00,0x03,0x60,0xC0,0x00,0x03,
0x60,0xC0,0x00,0x03,0xE0,0xFF,0xFF,0x03,0x60,0xC0,0x00,0x01,0x60,0xC0,0x00,0x00,
0x00,0xC0,0x00,0x08,0x00,0xC0,0x00,0x10,0x00,0xC0,0x00,0x10,0x00,0xC0,0x00,0x18,
0x00,0xC0,0x01,0x38,0x00,0x80,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"电",3*/
//"子",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0xFF,0xFF,0x07,0x00,0x00,0x80,0x07,0x00,0x00,0xC0,0x00,0x00,0x00,0x60,0x00,
0x00,0x00,0x18,0x00,0x00,0x00,0x0C,0x00,0x00,0x80,0x03,0x00,0x00,0x80,0x03,0x00,
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x08,0x00,0x80,0x01,0x1C,0xFC,0xFF,0xFF,0x3F,
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
0x00,0xFC,0x01,0x00,0x00,0xE0,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,/*"子",4*/
};
#endif
#ifdef LOGO_M
const unsigned char logo_M[] = {
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, 0x01, 0xf8, 0x00, 0x00, 0xff, 0xc0, 0x00,
0x00, 0x07, 0xfc, 0x00, 0x01, 0xff, 0xe0, 0x00,
0x00, 0x0f, 0xff, 0x00, 0x07, 0xff, 0xf0, 0x00,
0x00, 0x1f, 0xff, 0x80, 0x0f, 0xff, 0xf0, 0x00,
0x00, 0x3f, 0xff, 0xc0, 0x1f, 0xff, 0xf8, 0x00,
0x00, 0x3f, 0xff, 0xe0, 0x7f, 0xff, 0xf8, 0x00,
0x00, 0x3f, 0xff, 0xf0, 0xff, 0xff, 0xf8, 0x00,
0x00, 0x3f, 0xff, 0xfb, 0xff, 0xff, 0xf8, 0x00,
0x00, 0x3f, 0xff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 0x00, 0x7e, 0x0f, 0xf8, 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
};
#endif
#ifdef LOGO_R
const unsigned char logo_R[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0xff, 0xff, 0xff, 0xf8, 0x00,
0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0x00,
0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xc0,
0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf8,
0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf8,
0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xfc,
0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfc,
0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfe,
0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfe,
0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfe,
0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfe,
0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfe,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xfe,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xfe,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xfe,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xf0,
0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf0,
0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0,
0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80,
0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80,
0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
0x03, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00,
0x03, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00,
0x03, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00,
0x03, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00,
0x07, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x07, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x07, 0xff, 0xf8, 0xff, 0xff, 0x80, 0x00,
0x07, 0xff, 0xf0, 0xff, 0xff, 0x80, 0x00,
0x07, 0xff, 0xf0, 0x7f, 0xff, 0x80, 0x00,
0x0f, 0xff, 0xf0, 0x7f, 0xff, 0xc0, 0x00,
0x0f, 0xff, 0xf0, 0x7f, 0xff, 0xc0, 0x00,
0x0f, 0xff, 0xf0, 0x3f, 0xff, 0xe0, 0x00,
0x0f, 0xff, 0xf0, 0x3f, 0xff, 0xe0, 0x00,
0x0f, 0xff, 0xe0, 0x1f, 0xff, 0xf0, 0x00,
0x1f, 0xff, 0xe0, 0x1f, 0xff, 0xf0, 0x00,
0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xf8, 0x00,
0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xf8, 0x00,
0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xf8, 0x00,
0x1f, 0xff, 0xc0, 0x07, 0xff, 0xfc, 0x00,
0x1f, 0xff, 0xc0, 0x07, 0xff, 0xfc, 0x00,
0x3f, 0xff, 0xc0, 0x03, 0xff, 0xfe, 0x00,
0x3f, 0xff, 0xc0, 0x03, 0xff, 0xfe, 0x00,
0x3f, 0xff, 0xc0, 0x01, 0xff, 0xff, 0x00,
0x3f, 0xff, 0x80, 0x01, 0xff, 0xff, 0x00,
0x3f, 0xff, 0x80, 0x01, 0xff, 0xff, 0x80,
0x7f, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80,
0x7f, 0xff, 0x80, 0x00, 0xff, 0xff, 0xc0,
0x3f, 0xff, 0x00, 0x00, 0x7f, 0xff, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#endif
#ifdef HUAJI
const unsigned char huaji[] = {
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, 0x07, 0xe0, 0x00, 0x1f, 0xc0, 0x00,
0x00, 0x0f, 0xf0, 0x00, 0x1f, 0xe0, 0x00,
0x00, 0x0c, 0x70, 0x00, 0x38, 0x70, 0x00,
0x00, 0x18, 0x18, 0x00, 0x30, 0x70, 0x00,
0x00, 0x18, 0x00, 0x00, 0x20, 0x30, 0x00,
0x00, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0f, 0xc0, 0x00, 0x01, 0xfe, 0x00,
0x00, 0xff, 0xfc, 0x00, 0x0f, 0xff, 0x00,
0x01, 0xe0, 0x0f, 0x00, 0x38, 0x01, 0xc0,
0x03, 0x00, 0x03, 0x80, 0xe0, 0x00, 0x60,
0x06, 0x00, 0x00, 0xc1, 0xc0, 0x00, 0x30,
0x0c, 0xc0, 0x00, 0xc1, 0xb0, 0x00, 0x18,
0x0d, 0xc0, 0x00, 0x63, 0x78, 0x00, 0x18,
0x0d, 0xff, 0xf8, 0x43, 0x7f, 0xfe, 0x18,
0x0f, 0xff, 0x7f, 0xc1, 0xff, 0xcf, 0xf0,
0x07, 0xe0, 0x07, 0x81, 0xf8, 0x01, 0xf0,
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, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x60, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x60, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x60, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x30, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x30, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x30, 0x00, 0x00, 0x00, 0x0c, 0x00,
0x00, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00,
0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00,
0x00, 0x0c, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0x0e, 0x00, 0x00, 0x00, 0x30, 0x00,
0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0x00,
0x00, 0x03, 0x80, 0x00, 0x00, 0xe0, 0x00,
0x00, 0x01, 0xc0, 0x00, 0x01, 0xc0, 0x00,
0x00, 0x00, 0xe0, 0x00, 0x07, 0x80, 0x00,
0x00, 0x00, 0x78, 0x00, 0x0f, 0x00, 0x00,
0x00, 0x00, 0x3f, 0x00, 0xfc, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xff, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x01, 0xff, 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, 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
};
#endif

View File

@ -1,229 +0,0 @@
#include "lcd_init.h"
#
#include <gpio.h>
#include <main.h>
void LCD_GPIO_Init(void)
{
// GPIO_InitTypeDef GPIO_InitStructure;
// RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); //使能A端口时钟
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5;
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽输出
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//速度50MHz
// GPIO_Init(GPIOA, &GPIO_InitStructure); //初始化GPIOA
// GPIO_SetBits(GPIOA,GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5);
}
/******************************************************************************
LCD串行数据写入函数
dat
******************************************************************************/
void LCD_Writ_Bus(uint8_t dat)
{
uint8_t i;
LCD_CS_Clr();
for(i=0;i<8;i++)
{
LCD_SCLK_Clr();
if(dat&0x80)
{
LCD_MOSI_Set();
}
else
{
LCD_MOSI_Clr();
}
LCD_SCLK_Set();
dat<<=1;
}
LCD_CS_Set();
}
/******************************************************************************
LCD写入数据
dat
******************************************************************************/
void LCD_WR_DATA8(uint8_t dat)
{
LCD_Writ_Bus(dat);
}
/******************************************************************************
LCD写入数据
dat
******************************************************************************/
void LCD_WR_DATA(uint16_t dat)
{
LCD_Writ_Bus(dat>>8);
LCD_Writ_Bus(dat);
}
/******************************************************************************
LCD写入命令
dat
******************************************************************************/
void LCD_WR_REG(uint8_t dat)
{
LCD_DC_Clr();//写命令
LCD_Writ_Bus(dat);
LCD_DC_Set();//写数据
}
/******************************************************************************
x1,x2
y1,y2
******************************************************************************/
void LCD_Address_Set(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2)
{
if(USE_HORIZONTAL==0)
{
LCD_WR_REG(0x2a);//列地址设置
LCD_WR_DATA(x1+52);
LCD_WR_DATA(x2+52);
LCD_WR_REG(0x2b);//行地址设置
LCD_WR_DATA(y1+40);
LCD_WR_DATA(y2+40);
LCD_WR_REG(0x2c);//储存器写
}
else if(USE_HORIZONTAL==1)
{
LCD_WR_REG(0x2a);//列地址设置
LCD_WR_DATA(x1+53);
LCD_WR_DATA(x2+53);
LCD_WR_REG(0x2b);//行地址设置
LCD_WR_DATA(y1+40);
LCD_WR_DATA(y2+40);
LCD_WR_REG(0x2c);//储存器写
}
else if(USE_HORIZONTAL==2)
{
LCD_WR_REG(0x2a);//列地址设置
LCD_WR_DATA(x1+40);
LCD_WR_DATA(x2+40);
LCD_WR_REG(0x2b);//行地址设置
LCD_WR_DATA(y1+53);
LCD_WR_DATA(y2+53);
LCD_WR_REG(0x2c);//储存器写
}
else
{
LCD_WR_REG(0x2a);//列地址设置
LCD_WR_DATA(x1+40);
LCD_WR_DATA(x2+40);
LCD_WR_REG(0x2b);//行地址设置
LCD_WR_DATA(y1+52);
LCD_WR_DATA(y2+52);
LCD_WR_REG(0x2c);//储存器写
}
}
void LCD_Init(void)
{
LCD_GPIO_Init();//初始化GPIO
LCD_RES_Clr();//复位
HAL_Delay(100);
LCD_RES_Set();
HAL_Delay(100);
LCD_BLK_Set();//打开背光
HAL_Delay(100);
LCD_WR_REG(0x11);
HAL_Delay(120);
LCD_WR_REG(0x36);
if(USE_HORIZONTAL==0)LCD_WR_DATA8(0x00);
else if(USE_HORIZONTAL==1)LCD_WR_DATA8(0xC0);
else if(USE_HORIZONTAL==2)LCD_WR_DATA8(0x70);
else LCD_WR_DATA8(0xA0);
LCD_WR_REG(0x3A);
LCD_WR_DATA8(0x05);
LCD_WR_REG(0xB2);
LCD_WR_DATA8(0x0C);
LCD_WR_DATA8(0x0C);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x33);
LCD_WR_DATA8(0x33);
LCD_WR_REG(0xB7);
LCD_WR_DATA8(0x35);
LCD_WR_REG(0xBB);
LCD_WR_DATA8(0x19);
LCD_WR_REG(0xC0);
LCD_WR_DATA8(0x2C);
LCD_WR_REG(0xC2);
LCD_WR_DATA8(0x01);
LCD_WR_REG(0xC3);
LCD_WR_DATA8(0x12);
LCD_WR_REG(0xC4);
LCD_WR_DATA8(0x20);
LCD_WR_REG(0xC6);
LCD_WR_DATA8(0x0F);
LCD_WR_REG(0xD0);
LCD_WR_DATA8(0xA4);
LCD_WR_DATA8(0xA1);
LCD_WR_REG(0xE0);
LCD_WR_DATA8(0xD0);
LCD_WR_DATA8(0x04);
LCD_WR_DATA8(0x0D);
LCD_WR_DATA8(0x11);
LCD_WR_DATA8(0x13);
LCD_WR_DATA8(0x2B);
LCD_WR_DATA8(0x3F);
LCD_WR_DATA8(0x54);
LCD_WR_DATA8(0x4C);
LCD_WR_DATA8(0x18);
LCD_WR_DATA8(0x0D);
LCD_WR_DATA8(0x0B);
LCD_WR_DATA8(0x1F);
LCD_WR_DATA8(0x23);
LCD_WR_REG(0xE1);
LCD_WR_DATA8(0xD0);
LCD_WR_DATA8(0x04);
LCD_WR_DATA8(0x0C);
LCD_WR_DATA8(0x11);
LCD_WR_DATA8(0x13);
LCD_WR_DATA8(0x2C);
LCD_WR_DATA8(0x3F);
LCD_WR_DATA8(0x44);
LCD_WR_DATA8(0x51);
LCD_WR_DATA8(0x2F);
LCD_WR_DATA8(0x1F);
LCD_WR_DATA8(0x1F);
LCD_WR_DATA8(0x20);
LCD_WR_DATA8(0x23);
LCD_WR_REG(0x21);
LCD_WR_REG(0x29);
}

View File

@ -1,77 +0,0 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "device.h"
#include "main.h"
#define USE_HORIZONTAL 2 //设置横屏或者竖屏显示 0或1为竖屏 2或3为横屏
#if USE_HORIZONTAL==0||USE_HORIZONTAL==1
#define LCD_W 135
#define LCD_H 240
#else
#define LCD_W 240
#define LCD_H 135
#endif
//-----------------LCD端口定义----------------
//#define LCD_SCLK_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_13)//SCL=SCLK
//#define LCD_SCLK_Set() GPIO_SetBits(GPIOB,GPIO_Pin_13)
//#define LCD_MOSI_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_15)//SDA=MOSI
//#define LCD_MOSI_Set() GPIO_SetBits(GPIOB,GPIO_Pin_15)
//#define LCD_RES_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_14)//RES
//#define LCD_RES_Set() GPIO_SetBits(GPIOB,GPIO_Pin_14)
//#define LCD_DC_Clr() GPIO_ResetBits(GPIOA,GPIO_Pin_8)//DC
//#define LCD_DC_Set() GPIO_SetBits(GPIOA,GPIO_Pin_8)
//
//#define LCD_CS_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_12)//CS
//#define LCD_CS_Set() GPIO_SetBits(GPIOB,GPIO_Pin_12)
//#define LCD_BLK_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_9)//BLK
//#define LCD_BLK_Set() GPIO_SetBits(GPIOB,GPIO_Pin_9)
#define LCD_SCLK_Clr() HAL_GPIO_WritePin(LCD_CLK_GPIO_Port,LCD_CLK_Pin,GPIO_PIN_RESET)
#define LCD_SCLK_Set() HAL_GPIO_WritePin(LCD_CLK_GPIO_Port,LCD_CLK_Pin,GPIO_PIN_SET)
#define LCD_MOSI_Clr() HAL_GPIO_WritePin(LCD_MOSI_GPIO_Port,LCD_MOSI_Pin,GPIO_PIN_RESET)
#define LCD_MOSI_Set() HAL_GPIO_WritePin(LCD_MOSI_GPIO_Port,LCD_MOSI_Pin,GPIO_PIN_SET)
#define LCD_RES_Clr() HAL_GPIO_WritePin(LCD_RES_GPIO_Port,LCD_RES_Pin,GPIO_PIN_RESET)
#define LCD_RES_Set() HAL_GPIO_WritePin(LCD_RES_GPIO_Port,LCD_RES_Pin,GPIO_PIN_SET)
#define LCD_DC_Clr() HAL_GPIO_WritePin(LCD_RS_GPIO_Port,LCD_RS_Pin,GPIO_PIN_RESET)
#define LCD_DC_Set() HAL_GPIO_WritePin(LCD_RS_GPIO_Port,LCD_RS_Pin,GPIO_PIN_SET)
#define LCD_CS_Clr() HAL_GPIO_WritePin(LCD_CS_GPIO_Port,LCD_CS_Pin,GPIO_PIN_RESET)
#define LCD_CS_Set() HAL_GPIO_WritePin(LCD_CS_GPIO_Port,LCD_CS_Pin,GPIO_PIN_SET)
#define LCD_BLK_Clr() HAL_GPIO_WritePin(LCD_BLK_GPIO_Port,LCD_BLK_Pin,GPIO_PIN_SET)
#define LCD_BLK_Set() HAL_GPIO_WritePin(LCD_BLK_GPIO_Port,LCD_BLK_Pin,GPIO_PIN_RESET)
void LCD_GPIO_Init(void);//初始化GPIO
void LCD_Writ_Bus(uint8_t dat);//模拟SPI时序
void LCD_WR_DATA8(uint8_t dat);//写入一个字节
void LCD_WR_DATA(uint16_t dat);//写入两个字节
void LCD_WR_REG(uint8_t dat);//写入一个指令
void LCD_Address_Set(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2);//设置坐标函数
void LCD_Init(void);//LCD初始化
#ifdef __cplusplus
}
#endif

View File

@ -1,209 +0,0 @@
#ifndef __PIC_H
#define __PIC_H
const unsigned char gImage_1[3200] = { /* 0X10,0X10,0X00,0X28,0X00,0X28,0X01,0X1B, */
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF7,0X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F,0XFF,0XDF,
0X31,0XE8,0X08,0XA3,0X11,0X04,0X11,0X04,0X11,0X04,0X11,0X04,0X08,0XA3,0X42,0X49,
0XF7,0XFF,0XF7,0XFF,0XFF,0XFF,0XFF,0XFF,0X4A,0X6A,0X00,0X01,0X84,0X72,0XFF,0XFF,
0XFF,0XFF,0XF7,0XFF,0XEF,0XDF,0X3A,0X09,0X08,0XA3,0X11,0X04,0X11,0X04,0X11,0X04,
0X11,0X04,0X11,0X05,0XBE,0X18,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0X7B,0XF0,0X00,0X62,0X31,0XE8,0X31,0XC7,0X00,0X41,0XA5,0X35,0XFF,0XFF,0XEF,0X5D,
0X21,0X46,0X10,0XC4,0X11,0X04,0X11,0X04,0X11,0X04,0X11,0X04,0X10,0XE4,0X08,0XA3,
0X9D,0X76,0XF7,0XFF,0XFF,0XFF,0XAD,0XB7,0X08,0XA3,0X08,0XA3,0X31,0XC7,0XE7,0X9E,
0XF7,0XFF,0XF7,0XFF,0XA5,0X76,0X08,0XA3,0X10,0XE4,0X11,0X04,0X11,0X04,0X11,0X04,
0X11,0X05,0X11,0X05,0XA5,0X35,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XDE,0XDB,0X29,0XA7,0X00,0X83,0X10,0XC4,0X10,0XC4,0X10,0XC4,0XE7,0X1C,0XEF,0X9E,
0X11,0X05,0X10,0XE4,0X11,0X04,0X11,0X04,0X11,0X04,0X11,0X04,0X19,0X04,0X08,0XC4,
0X10,0XE5,0X6B,0XD1,0X6B,0XD1,0X08,0XC5,0X00,0X64,0X08,0XA5,0X00,0X43,0X32,0X2B,
0X9D,0X77,0X84,0XB3,0X19,0X25,0X10,0XC4,0X11,0X04,0X11,0X04,0X11,0X04,0X11,0X04,
0X19,0X25,0X09,0X26,0X9D,0X35,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0X73,0XAF,0X00,0X62,0X19,0X04,0X19,0X05,0X00,0X82,0X5B,0X0D,0X9B,0X8E,
0X10,0X62,0X11,0X05,0X11,0X04,0X11,0X04,0X19,0X04,0X10,0XE4,0X00,0X85,0X11,0X05,
0X39,0XC4,0X5A,0X81,0X7B,0X40,0X9C,0X22,0XAC,0X43,0XA4,0X03,0X9B,0X83,0X72,0X82,
0X49,0X82,0X18,0XC2,0X00,0XA4,0X00,0XC5,0X10,0XE4,0X19,0X04,0X11,0X04,0X19,0X05,
0X19,0X47,0X11,0X67,0X5A,0XEC,0XFF,0XBE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XDF,0XDE,0XDB,0X10,0XC4,0X10,0XE4,0X11,0X04,0X11,0X05,0X18,0XA4,0XC0,0X01,
0X88,0X83,0X00,0XE4,0X19,0X05,0X19,0X04,0X08,0XC5,0X21,0X44,0X83,0X43,0XD5,0X23,
0XFE,0X42,0XFE,0XE4,0XFF,0X27,0XFF,0X07,0XFE,0XA4,0XFE,0X64,0XFE,0X03,0XFD,0XA3,
0XFC,0XE2,0XEC,0X42,0XB3,0X83,0X62,0X24,0X10,0XE5,0X08,0XC4,0X19,0X04,0X19,0X26,
0X19,0XA8,0X21,0X87,0X90,0X00,0XBC,0XD3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XDF,0XFF,0XFF,0X7C,0X10,0X00,0X42,0X19,0X05,0X11,0X05,0X28,0X83,0XD0,0X01,
0XF8,0X44,0X48,0XA3,0X00,0XE4,0X08,0XC5,0X5A,0X44,0XED,0X02,0XFD,0XE2,0XFE,0X02,
0XFE,0X66,0XFF,0X74,0XFF,0XB8,0XFF,0X73,0XF6,0XE7,0XF6,0XA6,0XF6,0X45,0XF5,0XA4,
0XFC,0XC3,0XFC,0X62,0XFC,0XC2,0XFC,0XC2,0XCB,0XE3,0X49,0XC4,0X11,0X06,0X19,0X88,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
0XD2,0X81,0XF3,0XC0,0XFC,0XC1,0XFD,0X02,0XFD,0X02,0XFC,0XE2,0XFC,0XC2,0XFC,0XC2,
0XFC,0X81,0XFB,0X80,0XC9,0XC0,0X81,0XA4,0XAD,0X35,0XCE,0X59,0X9C,0X71,0X81,0X21,
0XDA,0X00,0XFB,0XA1,0XFC,0X82,0XFC,0XA2,0XFC,0X82,0XFC,0XA2,0XFD,0X02,0XFD,0X22,
0XFC,0XE2,0XFC,0X00,0XDA,0X60,0XCC,0X90,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XDE,0X59,0XC4,0X0D,0XCB,0X06,0XD2,0XE4,0XDB,0X03,0XDB,0X03,0XDA,0XE3,0XD2,0XC3,
0XC2,0XA4,0XB3,0X09,0XBC,0XD2,0XF7,0X9E,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE6,0XFB,
0XB4,0X0E,0XBA,0XA6,0XD2,0X83,0XE2,0XE3,0XEB,0X02,0XEB,0X22,0XE3,0X22,0XDB,0X03,
0XD2,0XE4,0XC3,0X6A,0XD5,0XB6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
};
#endif

View File

@ -1,9 +0,0 @@
#include "usart.h"
int fputc(int ch,FILE *f)
{
//采用轮询方式发送1字节数据超时时间设置为无限等待
HAL_UART_Transmit(&huart2,(uint8_t *)&ch,1,HAL_MAX_DELAY);
return ch;
}

View File

@ -370,27 +370,99 @@ int8_t SX1281_Init(SX1281_t *radio, SX1281_Mode_t mode) {
#endif
/* 还没搞懂这里是干啥的 */
// if (radio->mode==MODE_BLE) {
// // only used in GENERIC and BLE mode
// Radio.SetSyncWord( 1, ( uint8_t[] ){ 0xDD, 0xA0, 0x96, 0x69, 0xDD } );
// Radio.WriteRegister(0x9c7, 0x55 );
// Radio.WriteRegister(0x9c8, 0x55 );
// Radio.WriteRegister(0x9c9, 0x55 );
// //Radio.WriteRegister( 0x9c5, 0x33 );
// Radio.SetBleAdvertizerAccessAddress( );
// Radio.SetWhiteningSeed( 0x33 );
// ble_header_adv.Fields.length = PINGPONGSIZE + 2;
// ble_header_adv.Fields.pduType = 2;
// }
if (radio->mode==MODE_BLE) {
// only used in GENERIC and BLE mode
Radio.SetSyncWord( 1, ( uint8_t[] ){ 0xDD, 0xA0, 0x96, 0x69, 0xDD } );
Radio.WriteRegister(0x9c7, 0x55 );
Radio.WriteRegister(0x9c8, 0x55 );
Radio.WriteRegister(0x9c9, 0x55 );
//Radio.WriteRegister( 0x9c5, 0x33 );
Radio.SetBleAdvertizerAccessAddress( );
Radio.SetWhiteningSeed( 0x33 );
ble_header_adv.Fields.length = 2;
ble_header_adv.Fields.pduType = 2;
}
return DEVICE_OK;
}
/////蓝牙还没研究明白
void SetBLEAdvertisingPacket(SX1281_t *radio, uint8_t *data, uint8_t length) {
if (radio->mode != MODE_BLE) {
printf("Error: Not in BLE mode\n");
return;
}
// 检查数据长度是否符合BLE规范
if (length > 37) { // BLE广告PDU最大有效载荷为37字节
printf("Error: BLE advertising data too long: %d bytes (max 37)\n", length);
return;
}
// 根据BLE规范构建PDU报头
uint8_t pduHeader[2] = {0};
// 第一字节: PDU类型(4位) + RFU(2位) + TxAdd(1位) + RxAdd(1位)
// ADV_IND类型 = 0x0, TxAdd=1(随机地址), RxAdd=0
pduHeader[0] = (0x0 << 4) | (0x0 << 2) | (0x1 << 1) | (0x0 << 0);
// 第二字节: 长度(6位) + RFU(2位)
// 长度不包括报头本身,只包括有效载荷
pduHeader[1] = (length & 0x3F) | (0x0 << 6);
printf("PDU Header: 0x%02X 0x%02X\n", pduHeader[0], pduHeader[1]);
printf("Payload length: %d\n", length);
// 组合完整的PDU: 报头(2字节) + 有效载荷
uint8_t completePdu[2 + length];
completePdu[0] = pduHeader[0];
completePdu[1] = pduHeader[1];
memcpy(&completePdu[2], data, length);
// 设置BLE模式
Radio.SetStandby(STDBY_RC);
Radio.SetPacketType(PACKET_TYPE_BLE);
// 设置调制参数
ModulationParams_t modulationParams;
modulationParams.PacketType = PACKET_TYPE_BLE;
modulationParams.Params.Ble.BitrateBandwidth = GFS_BLE_BR_1_000_BW_1_2;
modulationParams.Params.Ble.ModulationIndex = GFS_BLE_MOD_IND_0_50;
modulationParams.Params.Ble.ModulationShaping = RADIO_MOD_SHAPING_BT_0_5;
Radio.SetModulationParams(&modulationParams);
// 设置包参数 - BLE模式下没有PayloadLength字段
PacketParams_t packetParams;
packetParams.PacketType = PACKET_TYPE_BLE;
packetParams.Params.Ble.BlePacketType = BLE_EYELONG_1_0;
packetParams.Params.Ble.ConnectionState = BLE_ADVERTISER;
packetParams.Params.Ble.CrcField = BLE_CRC_3B;
packetParams.Params.Ble.Whitening = RADIO_WHITENING_ON;
Radio.SetPacketParams(&packetParams);
// 设置频率 - BLE广告信道38: 2426000000 Hz
Radio.SetRfFrequency(RF_FREQUENCY);
// 设置BLE特定参数
Radio.SetSyncWord(1, (uint8_t[]){0xDD, 0xA0, 0x96, 0x69, 0xDD});
Radio.SetBleAdvertizerAccessAddress();
Radio.SetWhiteningSeed(0x33);
// 写入寄存器配置
Radio.WriteRegister(0x9C7, 0x55);
Radio.WriteRegister(0x9C8, 0x55);
Radio.WriteRegister(0x9C9, 0x55);
// 设置中断参数并发送完整的PDU
uint16_t TxIrqMask = IRQ_TX_DONE | IRQ_RX_TX_TIMEOUT;
Radio.SetDioIrqParams(TxIrqMask, TxIrqMask, IRQ_RADIO_NONE, IRQ_RADIO_NONE);
// 发送完整的PDU报头+有效载荷)
Radio.SendPayload(completePdu, length + 2, (TickTime_t){RX_TIMEOUT_TICK_SIZE, TX_TIMEOUT_VALUE});
printf("BLE Advertising packet sent, total PDU length: %d\n", length + 2);
}
int8_t SX1281_SetRXSingle(void) {
Radio.SetDioIrqParams( RxIrqMask, RxIrqMask, IRQ_RADIO_NONE, IRQ_RADIO_NONE );
Radio.SetRx( ( TickTime_t ) { RX_TIMEOUT_TICK_SIZE, RX_TIMEOUT_VALUE } );

View File

@ -101,6 +101,8 @@ int8_t SX1281_SetRXSingle(void);
int8_t SX1281_SetRXSuccessive(void);
int8_t SX1281_SetTX (void);
int8_t SX1281_Running(void);
void SetBLEAdvertisingPacket(SX1281_t *radio, uint8_t *data, uint8_t length);
/* USER FUNCTION END */
#ifdef __cplusplus