-----------------------------------------------------------------------------------H-----------------------------------------------------------------------------------
#ifndef __MY_OLED__
#define __MY_OLED__
#include "gd32f20x_gpio.h"
#include "my_systick.h"
#include "stdint.h"
#include "string.h"
#include "lcdfont.h"
#define LCD_LED(x) gpio_bit_write(GPIOC,GPIO_PIN_13,x);
#define LCD_RS_CLR gpio_bit_reset(GPIOC,GPIO_PIN_7)
#define LCD_RST_CLR gpio_bit_reset(GPIOA,GPIO_PIN_11)
#define LCD_CS_CLR gpio_bit_reset(GPIOC,GPIO_PIN_6)
#define LCD_WR_CLR gpio_bit_reset(GPIOA,GPIO_PIN_8)
#define LCD_RD_CLR gpio_bit_reset(GPIOA,GPIO_PIN_12)
#define LCD_RST_SET gpio_bit_set(GPIOA, GPIO_PIN_11)
#define LCD_WR_SET gpio_bit_set(GPIOA, GPIO_PIN_8)
#define LCD_CS_SET gpio_bit_set(GPIOC, GPIO_PIN_6)
#define LCD_RS_SET gpio_bit_set(GPIOC, GPIO_PIN_7)
#define LCD_RD_SET gpio_bit_set(GPIOA, GPIO_PIN_12)
#define DATAOUT(x) gpio_port_write(GPIOB,x&0xFFFF) //数据输出
#define LCD_DATA_OUT() {gpio_init(GPIOB,GPIO_MODE_OUT_PP,GPIO_OSPEED_50MHZ,0xFFFF);}
#define LCD_DATA_IN() {gpio_init(GPIOB,GPIO_MODE_IPU,GPIO_OSPEED_50MHZ,0xFFFF);}
#define DATAIN gpio_input_port_get(GPIOB) //数据输入
//扫描方向定义
#define L2R_U2D 0x00 //从左到右,从上到下(正向,0度)
#define L2R_D2U 0x80 //从左到右,从下到上
#define R2L_U2D 0x40 //从右到左,从上到下
#define R2L_D2U 0xc0 //从右到左,从下到上(旋转180度)
#define U2D_L2R 0x20 //从上到下,从左到右
#define U2D_R2L 0x60 //从上到下,从右到左(旋转90度)
#define D2U_L2R 0xa0 //从下到上,从左到右(旋转270度)
#define D2U_R2L 0xe0 //从下到上,从右到左
#define DFT_SCAN_DIR D2U_L2R //默认的扫描方
#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 //灰色
//LCD重要参数集
typedef struct
{
uint16_t width; //LCD 宽度
uint16_t height; //LCD 高度
uint16_t id; //LCD ID
}_lcd_dev;
void my_oled_init(void);
void LCD_Clear(uint16_t color);
void LCD_DrawPoint(uint16_t x,uint16_t y,uint16_t color);
uint16_t LCD_ReadPoint(uint16_t x,uint16_t y);
void LCD_SetCursor(uint16_t x,uint16_t y);
void LCD_ShowPicture(uint16_t x,uint16_t y,uint16_t length,uint16_t width,const uint8_t pic[]);
void LCD_ShowChar(uint16_t x,uint16_t y,uint8_t num,uint16_t fc,uint16_t bc,uint8_t sizey,uint8_t mode);
#endif
|
|