-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathotm8009a.h
229 lines (190 loc) · 8.28 KB
/
otm8009a.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/**
******************************************************************************
* @file otm8009a.h
* @author MCD Application Team
* @brief This file contains all the constants parameters for the OTM8009A
* which is the LCD Driver for KoD KM-040TMP-02-0621 (WVGA)
* DSI LCD Display.
******************************************************************************
* @attention
*
* Copyright (c) 2015 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef OTM8009A_H
#define OTM8009A_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "otm8009a_reg.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup otm8009a
* @{
*/
/** @addtogroup OTM8009A_Exported_Variables
* @{
*/
typedef int32_t (*OTM8009A_GetTick_Func) (void);
typedef int32_t (*OTM8009A_Delay_Func) (uint32_t);
typedef int32_t (*OTM8009A_WriteReg_Func)(uint16_t, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*OTM8009A_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
/** @addtogroup OTM8009A_Exported_Types
* @{
*/
typedef struct
{
uint32_t Orientation;
uint32_t ColorCode;
uint32_t Brightness;
} OTM8009A_LCD_Ctx_t;
typedef struct
{
uint16_t Address;
OTM8009A_WriteReg_Func WriteReg;
OTM8009A_ReadReg_Func ReadReg;
OTM8009A_GetTick_Func GetTick;
} OTM8009A_IO_t;
typedef struct
{
OTM8009A_IO_t IO;
otm8009a_ctx_t Ctx;
uint8_t IsInitialized;
} OTM8009A_Object_t;
typedef struct
{
/* Control functions */
int32_t (*Init )(OTM8009A_Object_t*, uint32_t, uint32_t);
int32_t (*DeInit )(OTM8009A_Object_t*);
int32_t (*ReadID )(OTM8009A_Object_t*, uint32_t*);
int32_t (*DisplayOn )(OTM8009A_Object_t*);
int32_t (*DisplayOff )(OTM8009A_Object_t*);
int32_t (*SetBrightness )(OTM8009A_Object_t*, uint32_t);
int32_t (*GetBrightness )(OTM8009A_Object_t*, uint32_t*);
int32_t (*SetOrientation )(OTM8009A_Object_t*, uint32_t);
int32_t (*GetOrientation )(OTM8009A_Object_t*, uint32_t*);
/* Drawing functions*/
int32_t ( *SetCursor ) (OTM8009A_Object_t*, uint32_t, uint32_t);
int32_t ( *DrawBitmap ) (OTM8009A_Object_t*, uint32_t, uint32_t, uint8_t *);
int32_t ( *FillRGBRect ) (OTM8009A_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height);
int32_t ( *DrawHLine ) (OTM8009A_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *DrawVLine ) (OTM8009A_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *FillRect ) (OTM8009A_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *GetPixel ) (OTM8009A_Object_t*, uint32_t, uint32_t, uint32_t*);
int32_t ( *SetPixel ) (OTM8009A_Object_t*, uint32_t, uint32_t, uint32_t);
int32_t ( *GetXSize ) (OTM8009A_Object_t*, uint32_t *);
int32_t ( *GetYSize ) (OTM8009A_Object_t*, uint32_t *);
}OTM8009A_LCD_Drv_t;
/**
* @}
*/
#define OTM8009A_OK (0)
#define OTM8009A_ERROR (-1)
/* OTM8009A ID */
#define OTM8009A_ID 0x40U
/**
* Possible values of Display Orientation
*/
#define OTM8009A_ORIENTATION_PORTRAIT 0U /* Portrait orientation choice of LCD screen */
#define OTM8009A_ORIENTATION_LANDSCAPE 1U /* Landscape orientation choice of LCD screen */
/**
* @brief Possible values of
* pixel data format (ie color coding) transmitted on DSI Data lane in DSI packets
*/
#define OTM8009A_FORMAT_RGB888 ((uint32_t)0x00) /* Pixel format chosen is RGB888 : 24 bpp */
#define OTM8009A_FORMAT_RBG565 ((uint32_t)0x02) /* Pixel format chosen is RGB565 : 16 bpp */
/**
* @brief otm8009a_480x800 Size
*/
/* Width and Height in Portrait mode */
#define OTM8009A_480X800_WIDTH ((uint16_t)480) /* LCD PIXEL WIDTH */
#define OTM8009A_480X800_HEIGHT ((uint16_t)800) /* LCD PIXEL HEIGHT */
/* Width and Height in Landscape mode */
#define OTM8009A_800X480_WIDTH ((uint16_t)800) /* LCD PIXEL WIDTH */
#define OTM8009A_800X480_HEIGHT ((uint16_t)480) /* LCD PIXEL HEIGHT */
/**
* @brief OTM8009A_480X800 Timing parameters for Portrait orientation mode
*/
#define OTM8009A_480X800_HSYNC ((uint16_t)2) /* Horizontal synchronization */
#define OTM8009A_480X800_HBP ((uint16_t)34) /* Horizontal back porch */
#define OTM8009A_480X800_HFP ((uint16_t)34) /* Horizontal front porch */
#define OTM8009A_480X800_VSYNC ((uint16_t)1) /* Vertical synchronization */
#define OTM8009A_480X800_VBP ((uint16_t)15) /* Vertical back porch */
#define OTM8009A_480X800_VFP ((uint16_t)16) /* Vertical front porch */
/**
* @brief OTM8009A_800X480 Timing parameters for Landscape orientation mode
* Same values as for Portrait mode in fact.
*/
#define OTM8009A_800X480_HSYNC OTM8009A_480X800_HSYNC /* Horizontal synchronization */
#define OTM8009A_800X480_HBP OTM8009A_480X800_HBP /* Horizontal back porch */
#define OTM8009A_800X480_HFP OTM8009A_480X800_HFP /* Horizontal front porch */
#define OTM8009A_800X480_VSYNC OTM8009A_480X800_VSYNC /* Vertical synchronization */
#define OTM8009A_800X480_VBP OTM8009A_480X800_VBP /* Vertical back porch */
#define OTM8009A_800X480_VFP OTM8009A_480X800_VFP /* Vertical front porch */
/**
* @brief OTM8009A_480X800 frequency divider
*/
#define OTM8009A_480X800_FREQUENCY_DIVIDER 2 /* LCD Frequency divider */
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/** @defgroup OTM8009A_Exported_Macros OTM8009A Exported Macros
* @{
*/
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup OTM8009A_Exported_Functions
* @{
*/
int32_t OTM8009A_RegisterBusIO (OTM8009A_Object_t *pObj, OTM8009A_IO_t *pIO);
int32_t OTM8009A_Init(OTM8009A_Object_t *pObj, uint32_t ColorCoding, uint32_t Orientation);
int32_t OTM8009A_DeInit(OTM8009A_Object_t *pObj);
int32_t OTM8009A_ReadID(OTM8009A_Object_t *pObj, uint32_t *Id);
int32_t OTM8009A_DisplayOn(OTM8009A_Object_t *pObj);
int32_t OTM8009A_DisplayOff(OTM8009A_Object_t *pObj);
int32_t OTM8009A_SetBrightness(OTM8009A_Object_t *pObj, uint32_t Brightness);
int32_t OTM8009A_GetBrightness(OTM8009A_Object_t *pObj, uint32_t *Brightness);
int32_t OTM8009A_SetOrientation(OTM8009A_Object_t *pObj, uint32_t Orientation);
int32_t OTM8009A_GetOrientation(OTM8009A_Object_t *pObj, uint32_t *Orientation);
int32_t OTM8009A_SetCursor(OTM8009A_Object_t *pObj, uint32_t Xpos, uint32_t Ypos);
int32_t OTM8009A_DrawBitmap(OTM8009A_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint8_t *pBmp);
int32_t OTM8009A_FillRGBRect(OTM8009A_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height);
int32_t OTM8009A_DrawHLine(OTM8009A_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t OTM8009A_DrawVLine(OTM8009A_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t OTM8009A_FillRect(OTM8009A_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Width, uint32_t Height, uint32_t Color);
int32_t OTM8009A_SetPixel(OTM8009A_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Color);
int32_t OTM8009A_GetPixel(OTM8009A_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t *Color);
int32_t OTM8009A_GetXSize(OTM8009A_Object_t *pObj, uint32_t *XSize);
int32_t OTM8009A_GetYSize(OTM8009A_Object_t *pObj, uint32_t *YSize);
extern OTM8009A_LCD_Drv_t OTM8009A_LCD_Driver;
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* OTM8009A_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/