source: azure_iot_hub_f767zi/trunk/asp_baseplatform/gdic/adafruit_st7789/adafruit_st7789.h@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 7.5 KB
Line 
1/*
2 * TOPPERS/ASP Kernel
3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Advanced Standard Profile Kernel
5 *
6 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
7 * Toyohashi Univ. of Technology, JAPAN
8 * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory
9 * Graduate School of Information Science, Nagoya Univ., JAPAN
10 * Copyright (C) 2015-2019 by TOPPERS PROJECT Educational Working Group.
11 *
12 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
13 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
14 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
15 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
16 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
17 * スコード中に含まれていること.
18 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
19 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
20 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
21 * の無保証規定を掲載すること.
22 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
23 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
24 * と.
25 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
26 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
27 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
28 * 報告すること.
29 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
30 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
31 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
32 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
33 * 免責すること.
34 *
35 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
36 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
37 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
38 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
39 * の責任を負わない.
40 *
41 * $Id$
42 */
43
44/*
45 * Written by Limor Fried/Ladyada for Adafruit Industries.
46 * MIT license, all text above must be included in any redistribution
47 * http://opensource.org/licenses/mit-license.php
48 */
49
50/*
51 * ADAFRUIT ST7789 LCD制御プログラムのヘッダファイル
52 */
53
54#ifndef _ADAFRUIT_ST7789_H_
55#define _ADAFRUIT_ST7789_H_
56
57#ifdef __cplusplus
58 extern "C" {
59#endif
60
61#include "device.h"
62#include "pinmode.h"
63#include "spi.h"
64
65/*
66 * LCDカラーモード定義
67 */
68#define CM_ARGB8888 0x00000000 /* ARGB8888 color mode */
69#define CM_RGB888 0x00000001 /* RGB888 color mode */
70#define CM_RGB565 0x00000002 /* RGB565 color mode */
71
72#define ST7789_NOP 0x00
73#define ST7789_SWRESET 0x01
74#define ST7789_RDDID 0x04
75#define ST7789_RDDST 0x09
76
77#define ST7789_SLPIN 0x10
78#define ST7789_SLPOUT 0x11
79#define ST7789_PTLON 0x12
80#define ST7789_NORON 0x13
81
82#define ST7789_INVOFF 0x20
83#define ST7789_INVON 0x21
84#define ST7789_DISPOFF 0x28
85#define ST7789_DISPON 0x29
86#define ST7789_CASET 0x2A
87#define ST7789_RASET 0x2B
88#define ST7789_RAMWR 0x2C
89#define ST7789_RAMRD 0x2E
90
91#define ST7789_PTLAR 0x30
92#define ST7789_TEOFF 0x34
93#define ST7789_TEON 0x35
94#define ST7789_COLMOD 0x3A
95#define ST7789_MADCTL 0x36
96
97#define ST7789_MADCTL_MY 0x80
98#define ST7789_MADCTL_MX 0x40
99#define ST7789_MADCTL_MV 0x20
100#define ST7789_MADCTL_ML 0x10
101#define ST7789_MADCTL_RGB 0x00
102
103#define ST7789_RDID1 0xDA
104#define ST7789_RDID2 0xDB
105#define ST7789_RDID3 0xDC
106#define ST7789_RDID4 0xDD
107
108// Color definitions
109#define ST7789_BLACK 0x0000
110#define ST7789_BLUE 0x001F
111#define ST7789_RED 0xF800
112#define ST7789_GREEN 0x07E0
113#define ST7789_CYAN 0x07FF
114#define ST7789_MAGENTA 0xF81F
115#define ST7789_YELLOW 0xFFE0
116#define ST7789_WHITE 0xFFFF
117
118
119#ifndef TOPPERS_MACRO_ONLY
120
121/*
122 * カラーの属性を定義
123 */
124typedef uint16_t color_t;
125
126/*
127 * LCDハンドラ構造体定義
128 */
129typedef struct
130{
131 SPI_Handle_t *hspi; /* spiハンドラ */
132 uint16_t _width; /* 幅ピクセル数 */
133 uint16_t _height; /* 高さピクセル数 */
134 uint16_t colstart;
135 uint16_t rowstart;
136 uint16_t lcd_width;
137 uint16_t lcd_height;
138 uint16_t lcd_colstart;
139 uint16_t lcd_rowstart;
140 uint8_t rotation;
141 uint8_t dummy[3];
142 ID spi_lock;
143 int8_t cs_pin;
144 int8_t rs_pin;
145 int8_t rst_pin;
146 int8_t cs2_pin;
147}LCD_Handler_t;
148
149/*
150 * 描画構造体
151 */
152typedef struct
153{
154 LCD_Handler_t *hlcd;
155 color_t TextColor;
156 color_t BackColor;
157 void *pFont;
158}LCD_DrawProp_t;
159
160typedef struct
161{
162 int16_t X;
163 int16_t Y;
164}Point, * pPoint;
165
166/*
167 * 関数のプロトタイプ宣言
168 */
169extern ER lcd_writecommand(LCD_Handler_t *hlcd, uint8_t c);
170extern ER lcd_writedata(LCD_Handler_t *hlcd, uint8_t *p, uint32_t len);
171extern ER lcd_writedata2(LCD_Handler_t *hlcd, uint16_t c, int cnt);
172extern ER lcd_writedata3(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height);
173
174extern void lcd_init(LCD_Handler_t *hlcd, uint16_t width, uint16_t height);
175extern void lcd_setAddrWindow(LCD_Handler_t *hlcd, uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1);
176extern void lcd_setRotation(LCD_Handler_t *hlcd, uint8_t m);
177extern void lcd_fillRect(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t w, int16_t h, color_t color);
178extern void lcd_pushColor(LCD_Handler_t *hlcd, color_t color);
179extern void lcd_drawPixel(LCD_Handler_t *hlcd, int16_t x, int16_t y, color_t color);
180extern void lcd_drawFastVLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t h, color_t color);
181extern void lcd_drawFastHLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t w, color_t color);
182extern void lcd_drawImageHLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, uint16_t w, color_t *pcolor);
183extern void lcd_drawBitmap(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, uint8_t *pbmp);
184extern void lcd_invertDisplay(LCD_Handler_t *hlcd, bool_t i);
185
186extern void lcd_fillScreen(LCD_DrawProp_t *pDrawProp);
187extern void lcd_drawRect(LCD_DrawProp_t *pDrawProp, int16_t x, int16_t y, int16_t w, int16_t h);
188extern void lcd_DrawCircle(LCD_DrawProp_t *pDrawProp, uint16_t x0, uint16_t y0, uint16_t Radius);
189extern void lcd_drawLine(LCD_DrawProp_t *pDrawProp, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
190extern void lcd_drawPolygon(LCD_DrawProp_t *pDrawProp, pPoint Points, uint16_t PointCount);
191
192#endif /* TOPPERS_MACRO_ONLY */
193
194#ifdef __cplusplus
195}
196#endif
197
198#endif /* _ADAFRUIT_ST7789_H_ */
199
Note: See TracBrowser for help on using the repository browser.