资源简介
使用STM32的FSMC驱动的ILI9341屏幕,能够实现画点、画线、画矩形、画圆、填充矩形、ASCII显示、汉字显示、图片显示等功能
代码片段和文件信息
#include
#include “lcddriver.h“
#if !USE_uC_GUI
#include
#include “ASCII24X12.h“
#include “HZ24X24.h“
#endif
/* select BANK1-NORSRAM1 to connect LCD the address range: 0x60000000~0x63FFFFFF
* FSMC_A16 connect to LCD DC(data/register) pin
* data bandth: 16bits => FSMC[24:0]== HADDR[25:1]
* register base address: 0x60000000
* RAM base address: 0x60020000 = 0x60000000 + 2^16 * 2
* the address need to calculate again when select different address pin
*/
#define Bank1_LCD_DATA ((uint32_t)0x60020000) /* display data address */
#define Bank1_LCD_REG ((uint32_t)0x60000000) /* display register address */
/* LCD write data and register */
#define LCD_WR_DATA(value) ((*(__IO uint16_t*)(Bank1_LCD_DATA)) = ((uint16_t)(value)))
#define LCD_WR_REG(index) ((*(__IO uint16_t*)(Bank1_LCD_REG)) = ((uint16_t)index))
#if !USE_uC_GUI
#define ASCII_CHARACTER 0
#define HZ_CHARACTER 1
#endif
static void delayms(uint32_t n_ms);
static void LCD_GPIO_Config(void);
static void LCD_FSMC_Config(void);
static void ILI9341_Init(void);
static void LCD_OpenWindow(uint16_t x uint16_t y uint16_t width uint16_t height);
#if !USE_uC_GUI
static uint16_t GetFontWidth(uint8_t font uint8_t type);
static uint16_t GetFontHeight(uint8_t font uint8_t type);
#endif
void delayms(uint32_t n_ms)
{
uint32_t i = 0 j = 0;
for(i = n_ms; i > 0; --i)
{
for(j = 7900; j > 0; --j)
{
}
}
}
/*
*FuncName: LCD_GPIO_Config
*Parameter: void
*Function: configure GPIO used by LCD
*/
static void LCD_GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* enable FSMC clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC ENABLE);
/* enable GPIOD/GPIOE clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE ENABLE);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
/* LCD backlight control pin -- PB0(TIM3-CH3) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_Init(GPIOB &GPIO_InitStructure);
/* LCD reset control pin -- PE1(FSMC_NBL1) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_Init(GPIOE &GPIO_InitStructure);
/* FSMC data pins FSMC-D0~D15:
* PD14-PD15-PD0 -PD1 -PE7 -PE8 -PE9 -PE10
* PE11-PE12-PE13-PE14-PE15-PD8 -PD9 -PD10
*/
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 |
GPIO_Pin_1 |
GPIO_Pin_8 |
GPIO_Pin_9 |
GPIO_Pin_10 |
GPIO_Pin_14 |
GPIO_Pin_15;
GPIO_Init(GPIOD &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 |
GPIO_Pin_8 |
GPIO_Pin_9 |
GPIO_Pin_10 |
GPIO_Pin_11 |
GPIO_Pin_12 |
GPIO_Pin_13 |
GPIO_Pin_
- 上一篇:NeteaseMusicTrans.rar
- 下一篇:汇编语言排序实验程序
相关资源
- stm32f407上的两个can发送和接收例程
- STM32 led 时钟
- STM32 2.4G通信例程
- 直流无刷电机方波驱动 stm32 例程代码
- STM32中文资料
- STM32蓝牙和串口程序
- STM32f103超声波模块例程
- stm32f103c8t6 4 oled.rar
- stm32f030 IAP Demo(原创)
- STM32基于rt_thread操作系统的SDHC卡文件
- NRF24L01实现51与STM32双向通讯
- STM32F103 串口程序(完整版)
- stm32 ds18b20 温度传感器 测试通过
- stm32官方例程
- STM32F103定时器中断程序
- [免费]基于stm32f103ze 的OLED驱动代码
- STM32F103RBT6驱动UC1698控制芯片的160160黑
- STM32F103 DS18B20 V3.5.0固件库驱动程序工
- STM32定时器使用入门。看了这个程序会
- SIM908 SDIO FSMC STM32 FIFO
- STM32F103 CC2500完整驱动(模拟SPI)
- AD7606采集程序
- stm32 用SPI 方式读写 SDHC
- stm32通过DMA方式采集ADC数据
- 意法半导体STM全系列微控制器STM32ST
- 基于STM32芯片的SX1278 驱动 LORA.rar
- STM32的PCB封装库,以及原理图库,48
- SX1280.rar
- STM32 DS3231驱动.zip
- STM32F103C8T6+NRF24l01无线通信
评论
共有 条评论