-
Notifications
You must be signed in to change notification settings - Fork 0
/
nt35510.h
231 lines (191 loc) · 8.17 KB
/
nt35510.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
230
231
/**
******************************************************************************
* @file nt35510.h
* @author MCD Application Team
* @brief This file contains all the constants parameters for the NT35510
* which is the LCD Driver for Frida Techshine 3K138 (WVGA)
* DSI LCD Display.
******************************************************************************
* @attention
*
* Copyright (c) 2023 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 __NT35510_H
#define __NT35510_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "nt35510_reg.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup NT35510
* @{
*/
/** @addtogroup NT35510_Exported_Variables
* @{
*/
typedef int32_t (*NT35510_GetTick_Func) (void);
typedef int32_t (*NT35510_Delay_Func) (uint32_t);
typedef int32_t (*NT35510_WriteReg_Func)(uint16_t, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*NT35510_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
/** @addtogroup NT35510_Exported_Types
* @{
*/
typedef struct
{
uint32_t Orientation;
uint32_t ColorCode;
uint32_t Brightness;
} NT35510_LCD_Ctx_t;
typedef struct
{
uint16_t Address;
NT35510_WriteReg_Func WriteReg;
NT35510_ReadReg_Func ReadReg;
NT35510_GetTick_Func GetTick;
} NT35510_IO_t;
typedef struct
{
NT35510_IO_t IO;
nt35510_ctx_t Ctx;
uint8_t IsInitialized;
} NT35510_Object_t;
typedef struct
{
/* Control functions */
int32_t (*Init )(NT35510_Object_t*, uint32_t, uint32_t);
int32_t (*DeInit )(NT35510_Object_t*);
int32_t (*ReadID )(NT35510_Object_t*, uint32_t*);
int32_t (*DisplayOn )(NT35510_Object_t*);
int32_t (*DisplayOff )(NT35510_Object_t*);
int32_t (*SetBrightness )(NT35510_Object_t*, uint32_t);
int32_t (*GetBrightness )(NT35510_Object_t*, uint32_t*);
int32_t (*SetOrientation )(NT35510_Object_t*, uint32_t);
int32_t (*GetOrientation )(NT35510_Object_t*, uint32_t*);
/* Drawing functions*/
int32_t (*SetCursor )(NT35510_Object_t*, uint32_t, uint32_t);
int32_t (*DrawBitmap )(NT35510_Object_t*, uint32_t, uint32_t, uint8_t*);
int32_t (*FillRGBRect )(NT35510_Object_t*, uint32_t, uint32_t, uint8_t*, uint32_t, uint32_t);
int32_t (*DrawHLine )(NT35510_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t (*DrawVLine )(NT35510_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t (*FillRect )(NT35510_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t (*GetPixel )(NT35510_Object_t*, uint32_t, uint32_t, uint32_t*);
int32_t (*SetPixel )(NT35510_Object_t*, uint32_t, uint32_t, uint32_t);
int32_t (*GetXSize )(NT35510_Object_t*, uint32_t *);
int32_t (*GetYSize )(NT35510_Object_t*, uint32_t *);
}NT35510_LCD_Drv_t;
/**
* @}
*/
#define NT35510_OK (0)
#define NT35510_ERROR (-1)
/* NT35510 ID */
#define NT35510_ID 0x80U
/**
* @brief LCD_OrientationTypeDef
* Possible values of Display Orientation
*/
#define NT35510_ORIENTATION_PORTRAIT ((uint32_t)0x00) /* Portrait orientation choice of LCD screen */
#define NT35510_ORIENTATION_LANDSCAPE ((uint32_t)0x01) /* 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 NT35510_FORMAT_RGB888 ((uint32_t)0x00) /* Pixel format chosen is RGB888 : 24 bpp */
#define NT35510_FORMAT_RBG565 ((uint32_t)0x02) /* Pixel format chosen is RGB565 : 16 bpp */
/**
* @brief nt35510_480x800 Size
*/
/* Width and Height in Portrait mode */
#define NT35510_480X800_WIDTH ((uint16_t)480) /* LCD PIXEL WIDTH */
#define NT35510_480X800_HEIGHT ((uint16_t)800) /* LCD PIXEL HEIGHT */
/* Width and Height in Landscape mode */
#define NT35510_800X480_WIDTH ((uint16_t)800) /* LCD PIXEL WIDTH */
#define NT35510_800X480_HEIGHT ((uint16_t)480) /* LCD PIXEL HEIGHT */
/**
* @brief NT35510_480X800 Timing parameters for Portrait orientation mode
*/
#define NT35510_480X800_HSYNC ((uint16_t)2) /* Horizontal synchronization */
#define NT35510_480X800_HBP ((uint16_t)34) /* Horizontal back porch */
#define NT35510_480X800_HFP ((uint16_t)34) /* Horizontal front porch */
#define NT35510_480X800_VSYNC ((uint16_t)120) /* Vertical synchronization */
#define NT35510_480X800_VBP ((uint16_t)150) /* Vertical back porch */
#define NT35510_480X800_VFP ((uint16_t)150) /* Vertical front porch */
/**
* @brief NT35510_800X480 Timing parameters for Landscape orientation mode
* Same values as for Portrait mode in fact.
*/
#define NT35510_800X480_HSYNC NT35510_480X800_VSYNC /* Horizontal synchronization */
#define NT35510_800X480_HBP NT35510_480X800_VBP /* Horizontal back porch */
#define NT35510_800X480_HFP NT35510_480X800_VFP /* Horizontal front porch */
#define NT35510_800X480_VSYNC NT35510_480X800_HSYNC /* Vertical synchronization */
#define NT35510_800X480_VBP NT35510_480X800_HBP /* Vertical back porch */
#define NT35510_800X480_VFP NT35510_480X800_HFP /* Vertical front porch */
/**
* @brief NT35510_480X800 frequency divider
*/
#define NT35510_480X800_FREQUENCY_DIVIDER 2 /* LCD Frequency divider */
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/** @defgroup NT35510_Exported_Macros NT35510 Exported Macros
* @{
*/
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup NT35510_Exported_Functions
* @{
*/
int32_t NT35510_RegisterBusIO (NT35510_Object_t *pObj, NT35510_IO_t *pIO);
int32_t NT35510_Init(NT35510_Object_t *pObj, uint32_t ColorCoding, uint32_t Orientation);
int32_t NT35510_DeInit(NT35510_Object_t *pObj);
int32_t NT35510_ReadID(NT35510_Object_t *pObj, uint32_t *Id);
int32_t NT35510_DisplayOn(NT35510_Object_t *pObj);
int32_t NT35510_DisplayOff(NT35510_Object_t *pObj);
int32_t NT35510_SetBrightness(NT35510_Object_t *pObj, uint32_t Brightness);
int32_t NT35510_GetBrightness(NT35510_Object_t *pObj, uint32_t *Brightness);
int32_t NT35510_SetOrientation(NT35510_Object_t *pObj, uint32_t Orientation);
int32_t NT35510_GetOrientation(NT35510_Object_t *pObj, uint32_t *Orientation);
int32_t NT35510_SetCursor(NT35510_Object_t *pObj, uint32_t Xpos, uint32_t Ypos);
int32_t NT35510_DrawBitmap(NT35510_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint8_t *pBmp);
int32_t NT35510_FillRGBRect(NT35510_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height);
int32_t NT35510_DrawHLine(NT35510_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t NT35510_DrawVLine(NT35510_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t NT35510_FillRect(NT35510_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Width, uint32_t Height, uint32_t Color);
int32_t NT35510_SetPixel(NT35510_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Color);
int32_t NT35510_GetPixel(NT35510_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t *Color);
int32_t NT35510_GetXSize(NT35510_Object_t *pObj, uint32_t *XSize);
int32_t NT35510_GetYSize(NT35510_Object_t *pObj, uint32_t *YSize);
extern NT35510_LCD_Drv_t NT35510_LCD_Driver;
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __NT35510_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/