2021-10-01 00:21:50 +08:00

86 lines
3.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __LCD_H
#define __LCD_H
#include "common.h"
#include "stdlib.h"
//////////////////////////////////////////////////////////////////////////////////
extern SRAM_HandleTypeDef LCDSRAM_Handler; //SRAM<41><4D><EFBFBD><EFBFBD>(<28><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>LCD)
//LCD<43><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
extern u16 lcd_id; //LCD ID
extern u8 dir_flag; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
extern u16 lcd_width; //LCD <20><><EFBFBD><EFBFBD>
extern u16 lcd_height; //LCD <20>߶<EFBFBD>
extern u16 write_gramcmd; //дgramָ<6D><D6B8>
extern u16 setxcmd; //<2F><><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
extern u16 setycmd; //<2F><><EFBFBD><EFBFBD>y<EFBFBD><79><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
//LCD<43>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD>ɫ
extern u16 BRUSH_COLOR; //Ĭ<>Ϻ<EFBFBD>ɫ
extern u16 BACK_COLOR; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ.Ĭ<><C4AC>Ϊ<EFBFBD><CEAA>ɫ
//////////////////////////////////////////////////////////////////////////////////
//-----------------LCD<43><44><EFBFBD><EFBFBD><EFBFBD>˿ڶ<CBBF><DAB6><EFBFBD>----------------
#define LCD_BACK PFout(10) //LCD<43><44><EFBFBD><EFBFBD> PF10
//A12<31><32>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ʱSTM32<33>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һλ<D2BB><CEBB><EFBFBD><EFBFBD>
#define CMD_BASE ((u32)(0x6C000000 | 0x00001FFE))
#define DATA_BASE ((u32)(0x6C000000 | 0x00002000))
#define LCD_CMD (*(u16 *)CMD_BASE)
#define LCD_DATA (*(u16 *)DATA_BASE)
//ɨ<><EFBFBD><E8B7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define L2R_U2D 0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>
#define L2R_D2U 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>
#define R2L_U2D 2 //<2F><><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>,<2C><><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>
#define R2L_D2U 3 //<2F><><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>,<2C><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>
#define U2D_L2R 4 //<2F><><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define U2D_R2L 5 //<2F><><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>,<2C><><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>
#define D2U_L2R 6 //<2F><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define D2U_R2L 7 //<2F><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>,<2C><><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>
//<2F><>ɫֵ<C9AB><D6B5><EFBFBD><EFBFBD>
#define WHITE 0xFFFF
#define BLACK 0x0000
#define RED 0xF800
#define GREEN 0x07E0
#define BLUE 0x001F
#define BRED 0XF81F
#define GRED 0XFFE0
#define GBLUE 0X07FF
#define BROWN 0XBC40
#define BRRED 0XFC07
#define GRAY 0X8430
#define MAGENTA 0xF81F
#define CYAN 0x7FFF
#define YELLOW 0xFFE0
void LCD_WriteReg(u16 LCD_Reg, u16 LCD_Value);
u16 LCD_ReadReg(u16 LCD_Reg);
void LCD_WriteGRAM(void);
void LCD_Init(void); //<2F><>ʼ<EFBFBD><CABC>
void LCD_DisplayOn(void); //<2F><><EFBFBD><EFBFBD>ʾ
void LCD_DisplayOff(void); //<2F><><EFBFBD><EFBFBD>ʾ
void LCD_Clear(u16 Color); //<2F><><EFBFBD><EFBFBD>
void LCD_SetCursor(u16 Xpos, u16 Ypos); //<2F><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>
void LCD_DrawPoint(u16 x, u16 y); //<2F><><EFBFBD><EFBFBD>
void LCD_Color_DrawPoint(u16 x, u16 y, u16 color); //<2F><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
u16 LCD_GetPoint(u16 x, u16 y); //<2F><><EFBFBD><EFBFBD>
void LCD_Open_Window(u16 X0, u16 Y0, u16 width, u16 height);
void Set_Scan_Direction(u8 direction);
void Set_Display_Mode(u8 mode);
void LCD_Fill_onecolor(u16 sx, u16 sy, u16 ex, u16 ey, u16 color); //<2F><><EFBFBD><EFBFBD><E4B5A5><EFBFBD><EFBFBD>ɫ
void LCD_Draw_Picture(u16 sx, u16 sy, u16 ex, u16 ey, u16 *color); //<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ɫ
void LCD_DisplayChar(u16 x, u16 y, u8 word, u8 size); //<2F><>ʾһ<CABE><D2BB><EFBFBD>ַ<EFBFBD>
void LCD_DisplayString(u16 x, u16 y, u8 size, u8 *p); //<2F><>ʾһ<CABE><D2BB>12/16/24<32><34><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
void LCD_DisplayString_color(u16 x, u16 y, u8 size, u8 *p, u16 brushcolor, u16 backcolor); //<2F><>ʾһ<CABE><D2BB>12/16/24<32><34><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
void LCD_DisplayNum(u16 x, u16 y, u32 num, u8 len, u8 size, u8 mode); //<2F><>ʾ <20><><EFBFBD><EFBFBD>
void LCD_DisplayNum_color(u16 x, u16 y, u32 num, u8 len, u8 size, u8 mode, u16 brushcolor, u16 backcolor); //<2F><>ʾ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
#endif