125 lines
4.5 KiB
C
125 lines
4.5 KiB
C
/*
|
|
* ili9341.h
|
|
*
|
|
* Created on: 2019/12/26
|
|
* Author: Kotetsu Yamamoto
|
|
* Copyright [Kotetsu Yamamoto]
|
|
|
|
MIT License
|
|
|
|
Copyright (c) 2020 Kotestu Yamamoto
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
|
|
*/
|
|
|
|
#ifndef INC_ILI9341_H_
|
|
#define INC_ILI9341_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "main.h" // For STM32F4
|
|
|
|
|
|
#define ILI9341_TFTWIDTH 240 ///< ILI9341 max TFT width
|
|
#define ILI9341_TFTHEIGHT 320 ///< ILI9341 max TFT height
|
|
|
|
#define ILI9341_NOP 0x00 ///< No-op register
|
|
#define ILI9341_SWRESET 0x01 ///< Software reset register
|
|
#define ILI9341_RDDID 0x04 ///< Read display identification information
|
|
#define ILI9341_RDDST 0x09 ///< Read Display Status
|
|
|
|
#define ILI9341_SLPIN 0x10 ///< Enter Sleep Mode
|
|
#define ILI9341_SLPOUT 0x11 ///< Sleep Out
|
|
#define ILI9341_PTLON 0x12 ///< Partial Mode ON
|
|
#define ILI9341_NORON 0x13 ///< Normal Display Mode ON
|
|
|
|
#define ILI9341_RDMODE 0x0A ///< Read Display Power Mode
|
|
#define ILI9341_RDMADCTL 0x0B ///< Read Display MADCTL
|
|
#define ILI9341_RDPIXFMT 0x0C ///< Read Display Pixel Format
|
|
#define ILI9341_RDIMGFMT 0x0D ///< Read Display Image Format
|
|
#define ILI9341_RDSELFDIAG 0x0F ///< Read Display Self-Diagnostic Result
|
|
|
|
#define ILI9341_INVOFF 0x20 ///< Display Inversion OFF
|
|
#define ILI9341_INVON 0x21 ///< Display Inversion ON
|
|
#define ILI9341_GAMMASET 0x26 ///< Gamma Set
|
|
#define ILI9341_DISPOFF 0x28 ///< Display OFF
|
|
#define ILI9341_DISPON 0x29 ///< Display ON
|
|
|
|
#define ILI9341_CASET 0x2A ///< Column Address Set
|
|
#define ILI9341_PASET 0x2B ///< Page Address Set
|
|
#define ILI9341_RAMWR 0x2C ///< Memory Write
|
|
#define ILI9341_RAMRD 0x2E ///< Memory Read
|
|
|
|
#define ILI9341_PTLAR 0x30 ///< Partial Area
|
|
#define ILI9341_VSCRDEF 0x33 ///< Vertical Scrolling Definition
|
|
#define ILI9341_MADCTL 0x36 ///< Memory Access Control
|
|
#define ILI9341_VSCRSADD 0x37 ///< Vertical Scrolling Start Address
|
|
#define ILI9341_PIXFMT 0x3A ///< COLMOD: Pixel Format Set
|
|
|
|
#define ILI9341_FRMCTR1 \
|
|
0xB1 ///< Frame Rate Control (In Normal Mode/Full Colors)
|
|
#define ILI9341_FRMCTR2 0xB2 ///< Frame Rate Control (In Idle Mode/8 colors)
|
|
#define ILI9341_FRMCTR3 \
|
|
0xB3 ///< Frame Rate control (In Partial Mode/Full Colors)
|
|
#define ILI9341_INVCTR 0xB4 ///< Display Inversion Control
|
|
#define ILI9341_DFUNCTR 0xB6 ///< Display Function Control
|
|
|
|
#define ILI9341_PWCTR1 0xC0 ///< Power Control 1
|
|
#define ILI9341_PWCTR2 0xC1 ///< Power Control 2
|
|
#define ILI9341_PWCTR3 0xC2 ///< Power Control 3
|
|
#define ILI9341_PWCTR4 0xC3 ///< Power Control 4
|
|
#define ILI9341_PWCTR5 0xC4 ///< Power Control 5
|
|
#define ILI9341_VMCTR1 0xC5 ///< VCOM Control 1
|
|
#define ILI9341_VMCTR2 0xC7 ///< VCOM Control 2
|
|
|
|
#define ILI9341_RDID1 0xDA ///< Read ID 1
|
|
#define ILI9341_RDID2 0xDB ///< Read ID 2
|
|
#define ILI9341_RDID3 0xDC ///< Read ID 3
|
|
#define ILI9341_RDID4 0xDD ///< Read ID 4
|
|
|
|
#define ILI9341_GMCTRP1 0xE0 ///< Positive Gamma Correction
|
|
#define ILI9341_GMCTRN1 0xE1 ///< Negative Gamma Correction
|
|
|
|
|
|
|
|
|
|
#define GUI_WIDTH 320
|
|
#define GUI_HEIGHT 240
|
|
|
|
void ILI9341_Init(void);
|
|
void ILI9341_SetWindow(uint16_t start_x, uint16_t start_y, uint16_t end_x, uint16_t end_y);
|
|
void ILI9341_DrawBitmap(uint16_t w, uint16_t h, uint8_t *s);
|
|
void ILI9341_WritePixel(uint16_t x, uint16_t y, uint16_t color);
|
|
void ILI9341_EndOfDrawBitmap(void);
|
|
|
|
void LCD_WR_REG(uint8_t data);
|
|
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size);
|
|
|
|
void TFT_clear(void);
|
|
void TFT_full(unsigned int color);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* INC_ILI9341_H_ */
|