正点原子STM32F103RCT6mini板子的NRST接口与NT35310的RST连接
时间: 2024-05-25 17:12:29 浏览: 166
不建议将正点原子STM32F103RCT6mini板子的NRST接口与NT35310的RST连接。因为NRST接口是STM32的复位引脚,连接到其他设备的复位引脚可能会导致STM32的复位信号被触发,从而影响系统的正常运行。另外,NT35310的RST引脚也是复位引脚,连接到其他设备的复位引脚也可能导致NT35310被复位,从而影响显示器的正常工作。建议将两个引脚分别连接到各自的复位电路中。
相关问题
正点原子stm32F103RCT6mini板子驱动NT35310的代码
以下是正点原子stm32F103RCT6mini板子驱动NT35310液晶屏的代码:
```
#include "NT35310.h"
#include "lcd.h"
//初始化NT35310液晶屏
void NT35310_Init(void)
{
LCD_WR_REG(0x00,0x0001);
delay_ms(50);
LCD_WR_REG(0xE5,0x8000);
LCD_WR_REG(0x00,0x0000);
LCD_WR_REG(0x01,0x0100);
LCD_WR_REG(0x02,0x0700);
LCD_WR_REG(0x03,0x1030);
LCD_WR_REG(0x04,0x0000);
LCD_WR_REG(0x08,0x0202);
LCD_WR_REG(0x09,0x0000);
LCD_WR_REG(0x0A,0x0000);
LCD_WR_REG(0x0C,0x0000);
LCD_WR_REG(0x0D,0x0000);
LCD_WR_REG(0x0F,0x0000);
LCD_WR_REG(0x50,0x0000);
LCD_WR_REG(0x51,0xEF00);
LCD_WR_REG(0x52,0x0000);
LCD_WR_REG(0x53,0x013F);
LCD_WR_REG(0x60,0xA700);
LCD_WR_REG(0x61,0x0001);
LCD_WR_REG(0x6A,0x0000);
LCD_WR_REG(0x80,0x0000);
LCD_WR_REG(0x81,0x0000);
LCD_WR_REG(0x82,0x0000);
LCD_WR_REG(0x83,0x0000);
LCD_WR_REG(0x84,0x0000);
LCD_WR_REG(0x85,0x0000);
LCD_WR_REG(0x90,0x0010);
LCD_WR_REG(0x92,0x0600);
LCD_WR_REG(0x93,0x0003);
LCD_WR_REG(0x95,0x0101);
LCD_WR_REG(0x97,0x0000);
LCD_WR_REG(0x98,0x0000);
LCD_WR_REG(0x07,0x0133);
}
//设置NT35310液晶屏的显示区域
void NT35310_SetWindow(uint16_t sx,uint16_t sy,uint16_t ex,uint16_t ey)
{
LCD_WR_REG(0x50,sx);
LCD_WR_REG(0x51,ex);
LCD_WR_REG(0x52,sy);
LCD_WR_REG(0x53,ey);
LCD_WR_REG(0x20,sx);
LCD_WR_REG(0x21,sy);
}
//在NT35310液晶屏上指定位置画点
void NT35310_DrawPoint(uint16_t x,uint16_t y,uint16_t color)
{
NT35310_SetWindow(x,y,x,y);
LCD_WR_REG(0x22,color);
}
//在NT35310液晶屏上指定位置画水平线
void NT35310_DrawHLine(uint16_t x,uint16_t y,uint16_t length,uint16_t color)
{
uint16_t i;
NT35310_SetWindow(x,y,x+length-1,y);
for(i=0;i<length;i++)
{
LCD_WR_REG(0x22,color);
}
}
//在NT35310液晶屏上指定位置画垂直线
void NT35310_DrawVLine(uint16_t x,uint16_t y,uint16_t length,uint16_t color)
{
uint16_t i;
NT35310_SetWindow(x,y,x,y+length-1);
for(i=0;i<length;i++)
{
LCD_WR_REG(0x22,color);
}
}
//在NT35310液晶屏上指定位置画矩形
void NT35310_DrawRectangle(uint16_t sx,uint16_t sy,uint16_t ex,uint16_t ey,uint16_t color)
{
uint16_t i;
NT35310_SetWindow(sx,sy,ex,ey);
for(i=sx;i<=ex;i++)
{
LCD_WR_REG(0x22,color);
}
}
//在NT35310液晶屏上指定位置填充矩形
void NT35310_FillRectangle(uint16_t sx,uint16_t sy,uint16_t ex,uint16_t ey,uint16_t color)
{
uint16_t i,j;
NT35310_SetWindow(sx,sy,ex,ey);
for(i=sy;i<=ey;i++)
{
for(j=sx;j<=ex;j++)
{
LCD_WR_REG(0x22,color);
}
}
}
//在NT35310液晶屏上指定位置显示一张图片
void NT35310_ShowPicture(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint8_t *p)
{
uint16_t i,j;
NT35310_SetWindow(x,y,x+width-1,y+height-1);
for(i=0;i<height;i++)
{
for(j=0;j<width;j++)
{
LCD_WR_REG(0x22,*p++);
LCD_WR_REG(0x22,*p++);
}
}
}
```
需要注意的是,以上代码中的 `LCD_WR_REG()` 函数是用于向NT35310液晶屏写入指令或数据的函数,具体实现在 `lcd.h` 文件中。此外,还需要根据自己的具体情况修改引脚定义和延时函数。
正点原子stm32F103RCT6mini板子驱动NT35310的寄存器代码
以下是正点原子STM32F103RCT6mini板子驱动NT35310的寄存器代码,供您参考:
```c
#include "NT35310.h"
void NT35310_Init(void)
{
/* 内部时钟PLL设置 */
NT35310_WriteCommand(0xE0); //Positive voltage Gamma control
NT35310_WriteData(0x00);
NT35310_WriteData(0x03);
NT35310_WriteData(0x09);
NT35310_WriteCommand(0xE1); //Negative voltage Gamma control
NT35310_WriteData(0x20);
NT35310_WriteData(0x20);
NT35310_WriteData(0x20);
NT35310_WriteCommand(0xE2); //Power control
NT35310_WriteData(0x0D);
NT35310_WriteData(0x0D);
NT35310_WriteData(0x0D);
NT35310_WriteData(0x0D);
NT35310_WriteData(0x0D);
NT35310_WriteData(0x0D);
NT35310_WriteData(0x0D);
NT35310_WriteData(0x0D);
NT35310_WriteData(0x0F);
NT35310_WriteCommand(0xE3); //Driver timing control A
NT35310_WriteData(0x10);
NT35310_WriteData(0x0B);
NT35310_WriteData(0x00);
NT35310_WriteData(0x00);
NT35310_WriteData(0x00);
NT35310_WriteData(0x01);
NT35310_WriteData(0x00);
NT35310_WriteData(0x44);
NT35310_WriteCommand(0xE4); //Driver timing control B
NT35310_WriteData(0x03);
NT35310_WriteData(0x18);
NT35310_WriteData(0x18);
NT35310_WriteData(0x04);
NT35310_WriteData(0x04);
NT35310_WriteData(0x08);
NT35310_WriteData(0x00);
NT35310_WriteCommand(0xE5); //Power-on sequence control
NT35310_WriteData(0x11);
NT35310_WriteData(0x06);
NT35310_WriteData(0x12);
NT35310_WriteData(0x12);
NT35310_WriteData(0x13);
NT35310_WriteData(0x14);
NT35310_WriteData(0x15);
NT35310_WriteData(0x10);
NT35310_WriteData(0x00);
NT35310_WriteData(0x00);
NT35310_WriteData(0x00);
NT35310_WriteCommand(0xE6); //Internal timing control
NT35310_WriteData(0x01);
NT35310_WriteData(0xFF);
NT35310_WriteData(0xFF);
NT35310_WriteData(0x00);
NT35310_WriteCommand(0xE7); //???Gamma control
NT35310_WriteData(0x40);
NT35310_WriteData(0x8A);
NT35310_WriteData(0x00);
NT35310_WriteData(0x00);
NT35310_WriteData(0x14);
NT35310_WriteCommand(0xF0); //Set pixel data format
NT35310_WriteData(0x03);
NT35310_WriteCommand(0x3A); //Set pixel format
NT35310_WriteData(0x55);
NT35310_WriteCommand(0x36); //Set address mode
NT35310_WriteData(0xC0);
NT35310_WriteCommand(0x11); //Exit sleep
HAL_Delay(120);
NT35310_WriteCommand(0x29); //Display on
}
void NT35310_WriteCommand(uint8_t command)
{
NT35310_DC_RESET; //DC引脚低电平,表示写入的是命令
HAL_SPI_Transmit(&hspi1, &command, 1, 100);
}
void NT35310_WriteData(uint8_t data)
{
NT35310_DC_SET; //DC引脚高电平,表示写入的是数据
HAL_SPI_Transmit(&hspi1, &data, 1, 100);
}
```
其中,`NT35310_Init()`函数用于初始化NT35310驱动器,配置各种控制寄存器,使得液晶屏能够正常工作。`NT35310_WriteCommand()`函数用于向寄存器写入命令,`NT35310_WriteData()`函数用于向寄存器写入数据。在这些函数中,通过SPI接口与STM32F103RCT6mini板子进行通信,实现对NT35310驱动器的控制。
阅读全文