source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.h@ 364

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

TINETとSocket APIなどを更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 8.0 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-2017 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 ST7735 1.8"LCD制御プログラムのヘッダファイル
52 */
53
54#ifndef _ADAFRUIT_ST7735_H_
55#define _ADAFRUIT_ST7735_H_
56
57#ifdef __cplusplus
58 extern "C" {
59#endif
60
61#include <stdbool.h>
62#include "device.h"
63#include "pinmap.h"
64#include "spi_api.h"
65
66/*
67 * LCDカラーモード定義
68 */
69#define CM_ARGB8888 0x00000000 /* ARGB8888 color mode */
70#define CM_RGB888 0x00000001 /* RGB888 color mode */
71#define CM_RGB565 0x00000002 /* RGB565 color mode */
72
73// some flags for initR() :(
74#define INITR_GREENTAB 0x0
75#define INITR_REDTAB 0x1
76#define INITR_BLACKTAB 0x2
77
78#define INITR_18GREENTAB INITR_GREENTAB
79#define INITR_18REDTAB INITR_REDTAB
80#define INITR_18BLACKTAB INITR_BLACKTAB
81#define INITR_144GREENTAB 0x1
82
83#define ST7735_TFTWIDTH 128
84// for 1.44" display
85#define ST7735_TFTHEIGHT_144 128
86// for 1.8" display
87#define ST7735_TFTHEIGHT_18 160
88
89#define ST7735_NOP 0x00
90#define ST7735_SWRESET 0x01
91#define ST7735_RDDID 0x04
92#define ST7735_RDDST 0x09
93
94#define ST7735_SLPIN 0x10
95#define ST7735_SLPOUT 0x11
96#define ST7735_PTLON 0x12
97#define ST7735_NORON 0x13
98
99#define ST7735_INVOFF 0x20
100#define ST7735_INVON 0x21
101#define ST7735_DISPOFF 0x28
102#define ST7735_DISPON 0x29
103#define ST7735_CASET 0x2A
104#define ST7735_RASET 0x2B
105#define ST7735_RAMWR 0x2C
106#define ST7735_RAMRD 0x2E
107
108#define ST7735_PTLAR 0x30
109#define ST7735_COLMOD 0x3A
110#define ST7735_MADCTL 0x36
111
112#define ST7735_FRMCTR1 0xB1
113#define ST7735_FRMCTR2 0xB2
114#define ST7735_FRMCTR3 0xB3
115#define ST7735_INVCTR 0xB4
116#define ST7735_DISSET5 0xB6
117
118#define ST7735_PWCTR1 0xC0
119#define ST7735_PWCTR2 0xC1
120#define ST7735_PWCTR3 0xC2
121#define ST7735_PWCTR4 0xC3
122#define ST7735_PWCTR5 0xC4
123#define ST7735_VMCTR1 0xC5
124
125#define ST7735_RDID1 0xDA
126#define ST7735_RDID2 0xDB
127#define ST7735_RDID3 0xDC
128#define ST7735_RDID4 0xDD
129
130#define ST7735_PWCTR6 0xFC
131
132#define ST7735_GMCTRP1 0xE0
133#define ST7735_GMCTRN1 0xE1
134
135// Color definitions
136#define ST7735_BLACK 0x0000
137#define ST7735_BLUE 0x001F
138#define ST7735_RED 0xF800
139#define ST7735_GREEN 0x07E0
140#define ST7735_CYAN 0x07FF
141#define ST7735_MAGENTA 0xF81F
142#define ST7735_YELLOW 0xFFE0
143#define ST7735_WHITE 0xFFFF
144
145
146#ifndef TOPPERS_MACRO_ONLY
147
148typedef struct GFXfont GFXfont;
149
150/*
151 * LCDハンドラ構造体定義
152 */
153typedef struct
154{
155 spi_t hspi; /* spiハンドラ */
156 uint16_t _width; /* 幅ピクセル数 */
157 uint16_t _height; /* 高さピクセル数 */
158 int16_t cursor_x, cursor_y;
159 uint16_t textcolor, textbgcolor;
160 uint8_t textsize, rotation;
161 bool wrap;
162 GFXfont *gfxFont;
163 uint8_t colstart;
164 uint8_t rowstart;
165 uint8_t tabcolor; /* some displays need this changed */
166 uint8_t dummy;
167 ID spi_lock;
168 gpio_t cs_pin;
169 gpio_t rs_pin;
170 gpio_t rst_pin;
171 gpio_t cs2_pin;
172}LCD_Handler_t;
173
174/*
175 * 描画構造体
176 */
177typedef struct
178{
179 LCD_Handler_t *hlcd;
180 uint16_t TextColor;
181 uint16_t BackColor;
182 void *pFont;
183}LCD_DrawProp_t;
184
185typedef struct
186{
187 int16_t X;
188 int16_t Y;
189}Point, * pPoint;
190
191/*
192 * 関数のプロトタイプ宣言
193 */
194extern ER lcd_writecommand(LCD_Handler_t *hlcd, uint8_t c);
195extern ER lcd_writedata(LCD_Handler_t *hlcd, uint8_t c);
196extern ER lcd_writedata2(LCD_Handler_t *hlcd, uint16_t c, int cnt);
197extern ER lcd_writedata3(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height);
198extern ER lcd_writedata4(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height);
199
200extern void lcd_initB(LCD_Handler_t *hlcd);
201extern void lcd_initR(LCD_Handler_t *hlcd, uint8_t options);
202extern void lcd_setAddrWindow(LCD_Handler_t *hlcd, uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1);
203extern void lcd_fillRect(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
204extern void lcd_pushColor(LCD_Handler_t *hlcd, uint16_t color);
205extern void lcd_drawPixel(LCD_Handler_t *hlcd, int16_t x, int16_t y, uint16_t color);
206extern void lcd_drawFastVLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t h, uint16_t color);
207extern void lcd_drawFastHLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t w, uint16_t color);
208extern void lcd_drawBitmap(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, uint8_t *pbmp);
209extern void lcd_drawImage(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, int16_t w, int16_t h, uint8_t *pbmp);
210extern void lcd_invertDisplay(LCD_Handler_t *hlcd, bool_t i);
211
212extern void lcd_fillScreen(LCD_DrawProp_t *pDrawProp);
213extern void lcd_drawRect(LCD_DrawProp_t *pDrawProp, int16_t x, int16_t y, int16_t w, int16_t h);
214extern void lcd_DrawCircle(LCD_DrawProp_t *pDrawProp, uint16_t x0, uint16_t y0, uint16_t Radius);
215extern void lcd_drawLine(LCD_DrawProp_t *pDrawProp, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
216extern void lcd_drawPolygon(LCD_DrawProp_t *pDrawProp, pPoint Points, uint16_t PointCount);
217
218#endif /* TOPPERS_MACRO_ONLY */
219
220#ifdef __cplusplus
221}
222#endif
223
224#endif /* _ADAFRUIT_ST7735_H_ */
225
Note: See TracBrowser for help on using the repository browser.