source: azure_iot_hub_riscv/trunk/asp_baseplatform/gdic/stlcd_rk043fn48h/stlcd_rk043fn48h.h@ 453

Last change on this file since 453 was 453, 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: 10.8 KB
Line 
1/*
2 * TOPPERS BASE PLATFORM MIDDLEWARE
3 *
4 * Copyright (C) 2017-2018 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 * @attention
41 *
42 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
43 *
44 * Redistribution and use in source and binary forms, with or without modification,
45 * are permitted provided that the following conditions are met:
46 * 1. Redistributions of source code must retain the above copyright notice,
47 * this list of conditions and the following disclaimer.
48 * 2. Redistributions in binary form must reproduce the above copyright notice,
49 * this list of conditions and the following disclaimer in the documentation
50 * and/or other materials provided with the distribution.
51 * 3. Neither the name of STMicroelectronics nor the names of its contributors
52 * may be used to endorse or promote products derived from this software
53 * without specific prior written permission.
54 *
55 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
56 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
58 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
59 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
61 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
62 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
63 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 *
66 ******************************************************************************
67 */
68
69#ifndef _STLCD_RK043FN48H_H_
70#define _STLCD_RK043FN48H_H_
71
72#ifdef __cplusplus
73 extern "C" {
74#endif
75
76#include <kernel.h>
77#include <t_syslog.h>
78#include <t_stdlib.h>
79#include "syssvc/serial.h"
80#include "syssvc/syslog.h"
81#include "device.h"
82#include "ltdc.h"
83
84
85
86/* Include LCD component Driver */
87/* LCD RK043FN48H-CT672B 4,3" 480x272 pixels */
88/**
89 * @brief RK043FN48H Size
90 */
91#define RK043FN48H_WIDTH ((uint16_t)480) /* LCD PIXEL WIDTH */
92#define RK043FN48H_HEIGHT ((uint16_t)272) /* LCD PIXEL HEIGHT */
93
94/**
95 * @brief RK043FN48H Timing
96 */
97#define RK043FN48H_HSYNC ((uint16_t)41) /* Horizontal synchronization */
98#define RK043FN48H_HBP ((uint16_t)13) /* Horizontal back porch */
99#define RK043FN48H_HFP ((uint16_t)32) /* Horizontal front porch */
100#define RK043FN48H_VSYNC ((uint16_t)10) /* Vertical synchronization */
101#define RK043FN48H_VBP ((uint16_t)2) /* Vertical back porch */
102#define RK043FN48H_VFP ((uint16_t)2) /* Vertical front porch */
103
104/**
105 * @brief RK043FN48H frequency divider
106 */
107#define RK043FN48H_FREQUENCY_DIVIDER 5 /* LCD Frequency divider */
108
109#define MAX_LAYER_NUMBER 2
110
111#define LTDC_ACTIVE_LAYER ((uint32_t)1) /* Layer 1 */
112
113/**
114 * @brief LCD FB_StartAddress
115 */
116#define LCD_FB_START_ADDRESS ((uint32_t)0xC0000000)
117
118/**
119 * @brief LCD color
120 */
121#define LCD_COLOR_BLUE ((uint32_t)0xFF0000FF)
122#define LCD_COLOR_GREEN ((uint32_t)0xFF00FF00)
123#define LCD_COLOR_RED ((uint32_t)0xFFFF0000)
124#define LCD_COLOR_CYAN ((uint32_t)0xFF00FFFF)
125#define LCD_COLOR_MAGENTA ((uint32_t)0xFFFF00FF)
126#define LCD_COLOR_YELLOW ((uint32_t)0xFFFFFF00)
127#define LCD_COLOR_LIGHTBLUE ((uint32_t)0xFF8080FF)
128#define LCD_COLOR_LIGHTGREEN ((uint32_t)0xFF80FF80)
129#define LCD_COLOR_LIGHTRED ((uint32_t)0xFFFF8080)
130#define LCD_COLOR_LIGHTCYAN ((uint32_t)0xFF80FFFF)
131#define LCD_COLOR_LIGHTMAGENTA ((uint32_t)0xFFFF80FF)
132#define LCD_COLOR_LIGHTYELLOW ((uint32_t)0xFFFFFF80)
133#define LCD_COLOR_DARKBLUE ((uint32_t)0xFF000080)
134#define LCD_COLOR_DARKGREEN ((uint32_t)0xFF008000)
135#define LCD_COLOR_DARKRED ((uint32_t)0xFF800000)
136#define LCD_COLOR_DARKCYAN ((uint32_t)0xFF008080)
137#define LCD_COLOR_DARKMAGENTA ((uint32_t)0xFF800080)
138#define LCD_COLOR_DARKYELLOW ((uint32_t)0xFF808000)
139#define LCD_COLOR_WHITE ((uint32_t)0xFFFFFFFF)
140#define LCD_COLOR_LIGHTGRAY ((uint32_t)0xFFD3D3D3)
141#define LCD_COLOR_GRAY ((uint32_t)0xFF808080)
142#define LCD_COLOR_DARKGRAY ((uint32_t)0xFF404040)
143#define LCD_COLOR_BLACK ((uint32_t)0xFF000000)
144#define LCD_COLOR_BROWN ((uint32_t)0xFFA52A2A)
145#define LCD_COLOR_ORANGE ((uint32_t)0xFFFFA500)
146#define LCD_COLOR_TRANSPARENT ((uint32_t)0xFF000000)
147
148
149/*
150 * LCDハンドラ構造体定義
151 */
152typedef struct
153{
154 LTDC_Handle_t *hltdc; /* LTDCハンドラ */
155 uint32_t layer;
156 uint16_t _width; /* 幅ピクセル数 */
157 uint16_t _height; /* 高さピクセル数 */
158} LCD_Handler_t;
159
160/** @defgroup STM32746G_DISCOVERY_LCD_Exported_Types STM32746G_DISCOVERY_LCD Exported Types
161 * @{
162 */
163typedef struct
164{
165 LCD_Handler_t *hlcd;
166 uint32_t TextColor; /* Specifies the color of text */
167 uint32_t BackColor; /* Specifies the background color below the text */
168 void *pFont; /* Specifies the font used for the text */
169
170} LCD_DrawProp_t;
171
172/**
173 * @brief LCD Drawing point (pixel) geometric definition
174 */
175typedef struct
176{
177 int16_t X; /*!< geometric X position of drawing */
178 int16_t Y; /*!< geometric Y position of drawing */
179
180} Point;
181
182/**
183 * @brief Pointer on LCD Drawing point (pixel) geometric definition
184 */
185typedef Point * pPoint;
186
187
188/**
189 * @brief LCD_OrientationTypeDef
190 * Possible values of Display Orientation
191 */
192typedef enum
193{
194 LCD_ORIENTATION_PORTRAIT = 0x00, /*!< Portrait orientation choice of LCD screen */
195 LCD_ORIENTATION_LANDSCAPE = 0x01, /*!< Landscape orientation choice of LCD screen */
196 LCD_ORIENTATION_INVALID = 0x02 /*!< Invalid orientation choice of LCD screen */
197} LCD_OrientationTypeDef;
198
199/** @addtogroup STM32746G_DISCOVERY_LCD_Exported_Functions
200 * @{
201 */
202extern ER lcd_init(LCD_Handler_t *hlcd, LCD_OrientationTypeDef orientation);
203extern ER lcd_layerdefaultinit(LCD_Handler_t *hlcd, LCD_DrawProp_t *pDrawProp, uint16_t LayerIndex, uint32_t FB_Address);
204extern ER lcd_layerRgb565init(LCD_Handler_t *hlcd, LCD_DrawProp_t *pDrawProp, uint16_t LayerIndex, uint32_t FB_Address);
205extern void lcd_setlayervisible(LCD_Handler_t *hlcd, uint32_t LayerIndex, uint8_t State);
206extern void lcd_settransparency(LCD_Handler_t *hlcd, uint32_t LayerIndex, uint8_t Transparency);
207extern void lcd_setlayeraddress(LCD_Handler_t *hlcd, uint32_t LayerIndex, uint32_t Address);
208extern void lcd_setcolorkeying(LCD_Handler_t *hlcd, uint32_t LayerIndex, uint32_t RGBValue);
209extern void lcd_resetcolorkeying(LCD_Handler_t *hlcd, uint32_t LayerIndex);
210
211extern void lcd_setAddrWindow(LCD_Handler_t *hlcd, uint16_t LayerIndex, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
212extern void lcd_clear(LCD_Handler_t *hlcd, uint32_t Color);
213extern uint32_t lcd_readPixel(LCD_Handler_t *hlcd, uint16_t Xpos, uint16_t Ypos);
214extern void lcd_drawPixel(LCD_Handler_t *hlcd, uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code);
215extern void lcd_drawFastHLine(LCD_Handler_t *hlcd, uint16_t Xpos, uint16_t Ypos, uint16_t Length, uint32_t color);
216extern void lcd_drawFastVLine(LCD_Handler_t *hlcd, uint16_t Xpos, uint16_t Ypos, uint16_t Length, uint32_t color);
217extern void lcd_drawBitmap(LCD_Handler_t *hlcd, uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp);
218extern void lcd_fillRect(LCD_Handler_t *hlcd, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height, uint32_t color);
219
220extern void lcd_drawLine(LCD_DrawProp_t *pDrawProp, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
221extern void lcd_drawRect(LCD_DrawProp_t *pDrawProp, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
222extern void lcd_DrawCircle(LCD_DrawProp_t *pDrawProp, uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
223extern void lcd_DrawEllipse(LCD_DrawProp_t *pDrawProp, int Xpos, int Ypos, int XRadius, int YRadius);
224extern void lcd_drawPolygon(LCD_DrawProp_t *pDrawProp, pPoint Points, uint16_t PointCount);
225extern void lcd_fillCircle(LCD_DrawProp_t *pDrawProp, uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
226extern void lcd_fillEllipse(LCD_DrawProp_t *pDrawProp, int Xpos, int Ypos, int XRadius, int YRadius);
227extern void lcd_fillPolygon(LCD_DrawProp_t *pDrawProp, pPoint Points, uint16_t PointCount);
228
229
230#ifdef __cplusplus
231}
232#endif
233
234#endif /* _STLCD_RK043FN48H_H_ */
235
Note: See TracBrowser for help on using the repository browser.