#include "gd32e50x.h"
#if 0 //RS~A23 16根数据线
#define BANK0_LCD_D ((uint32_t)0x61000000) //LCD data address,RS~A23 16线 2^23*2=0x1000000
#define BANK0_LCD_C ((uint32_t)0x60000000) //LCD register address Alternate2: EXMC_NE0=PD7~LCD_CS
#define LCD_WR_DATA(value) ((*(__IO uint16_t*)(BANK0_LCD_D)) = ((uint16_t)(value))) //写数据寄存器 16根数据线
#define LCD_WR_REG(index) ((*(__IO uint16_t*)(BANK0_LCD_C)) = ((uint16_t)index)) //写命令寄存器
#else //RS~A23 8根数据线
#define BANK0_LCD_D ((uint32_t)0x60800000) // LCD data address,RS~A23 8线 2^23=0x800000
#define BANK0_LCD_C ((uint32_t)0x60000000) // LCD register address,Alternate2: EXMC_NE0=PD7~LCD_CS
#define LCD_WR_DATA(value) ((*(__IO uint8_t*)(BANK0_LCD_D)) = ((uint8_t)(value))) //写数据寄存器 8根数据线
#define LCD_WR_REG(index) ((*(__IO uint8_t*)(BANK0_LCD_C)) = ((uint8_t)index)) //写命令寄存器
#endif
void lcd_open_window(uint16_t start_x,uint16_t start_y,uint16_t width,uint16_t heigth)
{
LCD_WR_REG(0x2A); //设置X范围坐标
LCD_WR_DATA(start_x>>8); //起始点高8位
LCD_WR_DATA(start_x&0x00FF); //起始点低8位
LCD_WR_DATA((start_x+width-1)>>8); //结束点高8位
LCD_WR_DATA((start_x+width-1)&0x00FF); //结束点低8位
LCD_WR_REG(0X2B); //设置Y范围坐标
LCD_WR_DATA(start_y>>8); //起始点高8位
LCD_WR_DATA(start_y&0x00FF); //起始点低8位
/* pate end */
LCD_WR_DATA((start_y+heigth-1)>>8); //结束点高8位
LCD_WR_DATA((start_y+heigth-1)&0x00FF); //结束点低8位
LCD_WR_REG(0x2C); //开始写入GRAM lcd_gram_write_prepare();
}文章来源:https://www.toymoban.com/news/detail-795715.html
#define LCD_RST GPIO_PIN_15
#define LCD_RST_PORT GPIOE
void LCD_Init_st7789(void)
{
int i;
#define LCD_Write_Cmd LCD_WR_REG
#define LCD_Write_Data LCD_WR_DATA
#define WHITE 0xffff// LCD_COLOR_WHITE
#define BALCK 0// LCD_COLOR_BLACK
/* 初始化和LCD通信的引脚 */
// LCD_GPIO_Init();
// HAL_Delay(120);
gpio_init(GPIOE,GPIO_MODE_OUT_PP,GPIO_OSPEED_2MHZ,LCD_RST);
gpio_bit_write(GPIOE, LCD_RST,(bit_status)1);
gpio_bit_write(GPIOE, LCD_RST,(bit_status)0);delay_1ms(20)文章来源地址https://www.toymoban.com/news/detail-795715.html
到了这里,关于gd32 exmc 连接 mcu 8080TFT 驱动(8pin/16pin)ST7789,40帧每秒240*320;的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!