1 | /*
|
---|
2 | * TOPPERS BASE PLATFORM MIDDLEWARE
|
---|
3 | *
|
---|
4 | * Copyright (C) 2017-2019 by TOPPERS PROJECT
|
---|
5 | * Educational Working Group.
|
---|
6 | *
|
---|
7 | * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
|
---|
8 | * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
---|
9 | * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
---|
10 | * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
---|
11 | * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
---|
12 | * スコード中に含まれていること.
|
---|
13 | * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
---|
14 | * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
---|
15 | * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
---|
16 | * の無保証規定を掲載すること.
|
---|
17 | * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
---|
18 | * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
---|
19 | * と.
|
---|
20 | * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
---|
21 | * 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
---|
22 | * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
---|
23 | * 報告すること.
|
---|
24 | * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
---|
25 | * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
---|
26 | * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
---|
27 | * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
---|
28 | * 免責すること.
|
---|
29 | *
|
---|
30 | * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
---|
31 | * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
---|
32 | * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
---|
33 | * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
---|
34 | * の責任を負わない.
|
---|
35 | *
|
---|
36 | * $Id$
|
---|
37 | */
|
---|
38 |
|
---|
39 | /*
|
---|
40 | * AQM1248 ST7565 LCD制御プログラムのヘッダファイル
|
---|
41 | */
|
---|
42 |
|
---|
43 | #ifndef _AQM1248_ST7565_H_
|
---|
44 | #define _AQM1248_ST7565_H_
|
---|
45 |
|
---|
46 | #ifdef __cplusplus
|
---|
47 | extern "C" {
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | #include "device.h"
|
---|
51 | #include "pinmode.h"
|
---|
52 | #include "spi.h"
|
---|
53 |
|
---|
54 | /*
|
---|
55 | * LCDカラーモード定義
|
---|
56 | */
|
---|
57 | #define CM_ARGB8888 0x00000000 /* ARGB8888 color mode */
|
---|
58 | #define CM_RGB888 0x00000001 /* RGB888 color mode */
|
---|
59 | #define CM_RGB565 0x00000002 /* RGB565 color mode */
|
---|
60 |
|
---|
61 | #define AQM1248_WIDTH 128
|
---|
62 | #define AQM1248_HEIGHT 48
|
---|
63 | #define AQM1248_PLINE 8
|
---|
64 |
|
---|
65 | #define ST7565_COLADR 0x10
|
---|
66 | #define ST7565_RATSEL 0x20
|
---|
67 | #define ST7565_PWRSEL 0x28
|
---|
68 | #define ST7565_STRLINE 0x40
|
---|
69 | #define ST7565_SETEVOL 0x81
|
---|
70 |
|
---|
71 | #define ST7565_ADCSELN 0xA0
|
---|
72 | #define ST7565_ADCSELR 0xA1
|
---|
73 | #define ST7565_BIAS19 0xA2
|
---|
74 | #define ST7565_BIAS17 0xA3
|
---|
75 | #define ST7565_ALLPNL 0xA4
|
---|
76 | #define ST7565_ALLPON 0xA5
|
---|
77 | #define ST7565_DISPNOR 0xA6
|
---|
78 | #define ST7565_DISPREV 0xA7
|
---|
79 | #define ST7565_DISPOFF 0xAE
|
---|
80 | #define ST7565_DISPON 0xAF
|
---|
81 | #define ST7565_PAGEADR 0xB0
|
---|
82 |
|
---|
83 | #define ST7565_COMOUTN 0xC0
|
---|
84 | #define ST7565_COMOUTR 0xC8
|
---|
85 | #define ST7565_NOP 0xE3
|
---|
86 |
|
---|
87 | // Color definitions
|
---|
88 | #define ST7565_BLACK 0x00
|
---|
89 | #define ST7565_BLUE 0x01
|
---|
90 | #define ST7565_GREEN 0x02
|
---|
91 | #define ST7565_CYAN 0x03
|
---|
92 | #define ST7565_RED 0x04
|
---|
93 | #define ST7565_MAGENTA 0x05
|
---|
94 | #define ST7565_YELLOW 0x06
|
---|
95 | #define ST7565_WHITE 0x07
|
---|
96 |
|
---|
97 | #ifndef TOPPERS_MACRO_ONLY
|
---|
98 |
|
---|
99 | /*
|
---|
100 | * カラーの属性を定義
|
---|
101 | */
|
---|
102 | typedef uint16_t color_t;
|
---|
103 |
|
---|
104 |
|
---|
105 | /*
|
---|
106 | * LCDハンドラ構造体定義
|
---|
107 | */
|
---|
108 | typedef struct
|
---|
109 | {
|
---|
110 | SPI_Handle_t *hspi; /* spiハンドラ */
|
---|
111 | uint16_t _width; /* 幅ピクセル数 */
|
---|
112 | uint16_t _height; /* 高さピクセル数 */
|
---|
113 | uint16_t _winx1;
|
---|
114 | uint16_t _winy1;
|
---|
115 | uint16_t _winx2;
|
---|
116 | uint16_t _winy2;
|
---|
117 | ID spi_lock;
|
---|
118 | uint8_t cs_pin;
|
---|
119 | uint8_t rs_pin;
|
---|
120 | uint8_t rst_pin;
|
---|
121 | uint8_t lmask;
|
---|
122 | uint8_t rmask;
|
---|
123 | uint8_t stride;
|
---|
124 | uint8_t dummy[2];
|
---|
125 | uint8_t buffer[AQM1248_HEIGHT][AQM1248_WIDTH/8];
|
---|
126 | }LCD_Handler_t;
|
---|
127 |
|
---|
128 | /*
|
---|
129 | * 描画構造体
|
---|
130 | */
|
---|
131 | typedef struct
|
---|
132 | {
|
---|
133 | LCD_Handler_t *hlcd;
|
---|
134 | color_t TextColor;
|
---|
135 | color_t BackColor;
|
---|
136 | void *pFont;
|
---|
137 | }LCD_DrawProp_t;
|
---|
138 |
|
---|
139 | typedef struct
|
---|
140 | {
|
---|
141 | int16_t X;
|
---|
142 | int16_t Y;
|
---|
143 | }Point, * pPoint;
|
---|
144 |
|
---|
145 | /*
|
---|
146 | * 関数のプロトタイプ宣言
|
---|
147 | */
|
---|
148 | extern ER lcd_writecommand(LCD_Handler_t *hlcd, uint8_t c);
|
---|
149 | extern ER lcd_writedata(LCD_Handler_t *hlcd, uint8_t c);
|
---|
150 |
|
---|
151 | extern void lcd_init(LCD_Handler_t *hlcd);
|
---|
152 | extern void lcd_setAddrWindow(LCD_Handler_t *hlcd, uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1);
|
---|
153 | extern void lcd_fillRect(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t w, int16_t h, color_t color);
|
---|
154 | extern void lcd_pushColor(LCD_Handler_t *hlcd, color_t color);
|
---|
155 | extern void lcd_drawPixel(LCD_Handler_t *hlcd, int16_t x, int16_t y, color_t color);
|
---|
156 | extern void lcd_drawFastVLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t h, color_t color);
|
---|
157 | extern void lcd_drawFastHLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t w, color_t color);
|
---|
158 | extern void lcd_drawImageHLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, uint16_t w, color_t *pcolor);
|
---|
159 | extern void lcd_drawBitmap(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, uint8_t *pbmp);
|
---|
160 | extern void lcd_invertDisplay(LCD_Handler_t *hlcd, bool_t i);
|
---|
161 |
|
---|
162 | extern void lcd_fillScreen(LCD_DrawProp_t *pDrawProp);
|
---|
163 | extern void lcd_drawRect(LCD_DrawProp_t *pDrawProp, int16_t x, int16_t y, int16_t w, int16_t h);
|
---|
164 | extern void lcd_DrawCircle(LCD_DrawProp_t *pDrawProp, uint16_t x0, uint16_t y0, uint16_t Radius);
|
---|
165 | extern void lcd_drawLine(LCD_DrawProp_t *pDrawProp, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
|
---|
166 | extern void lcd_drawPolygon(LCD_DrawProp_t *pDrawProp, pPoint Points, uint16_t PointCount);
|
---|
167 |
|
---|
168 | #endif /* TOPPERS_MACRO_ONLY */
|
---|
169 |
|
---|
170 | #ifdef __cplusplus
|
---|
171 | }
|
---|
172 | #endif
|
---|
173 |
|
---|
174 | #endif /* _AQM1248_ST7565_H_ */
|
---|
175 |
|
---|