ipsdisplay2  2.1.0.0
ipsdisplay2.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2020 MikroElektronika d.o.o.
3 ** Contact: https://www.mikroe.com/contact
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 ** of this software and associated documentation files (the "Software"), to deal
7 ** in the Software without restriction, including without limitation the rights
8 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 ** copies of the Software, and to permit persons to whom the Software is
10 ** furnished to do so, subject to the following conditions:
11 ** The above copyright notice and this permission notice shall be
12 ** included in all copies or substantial portions of the Software.
13 **
14 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 ** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 ** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19 ** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 ** USE OR OTHER DEALINGS IN THE SOFTWARE.
21 ****************************************************************************/
22 
28 #ifndef IPSDISPLAY2_H
29 #define IPSDISPLAY2_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
35 #include "mikrosdk_version.h"
36 
37 #ifdef __GNUC__
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
40 #else
41 #include "delays.h"
42 #endif
43 #endif
44 
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_spi_master.h"
48 #include "spi_specifics.h"
49 
70 #define IPSDISPLAY2_CMD_NOP 0x00
71 #define IPSDISPLAY2_CMD_SWRESET 0x01
72 #define IPSDISPLAY2_CMD_RDDID 0x04
73 #define IPSDISPLAY2_CMD_RDDST 0x09
74 #define IPSDISPLAY2_CMD_RDDPM 0x0A
75 #define IPSDISPLAY2_CMD_RDDMADCTL 0x0B
76 #define IPSDISPLAY2_CMD_RDDCOLMOD 0x0C
77 #define IPSDISPLAY2_CMD_RDDIM 0x0D
78 #define IPSDISPLAY2_CMD_RDDSM 0x0E
79 #define IPSDISPLAY2_CMD_RDDSDR 0x0F
80 #define IPSDISPLAY2_CMD_SLPIN 0x10
81 #define IPSDISPLAY2_CMD_SLPOUT 0x11
82 #define IPSDISPLAY2_CMD_PTLON 0x12
83 #define IPSDISPLAY2_CMD_NORON 0x13
84 #define IPSDISPLAY2_CMD_INVOFF 0x20
85 #define IPSDISPLAY2_CMD_INVON 0x21
86 #define IPSDISPLAY2_CMD_GAMSET 0x26
87 #define IPSDISPLAY2_CMD_DISPOFF 0x28
88 #define IPSDISPLAY2_CMD_DISPON 0x29
89 #define IPSDISPLAY2_CMD_CASET 0x2A
90 #define IPSDISPLAY2_CMD_RASET 0x2B
91 #define IPSDISPLAY2_CMD_RAMWR 0x2C
92 #define IPSDISPLAY2_CMD_RAMRD 0x2E
93 #define IPSDISPLAY2_CMD_PTLAR 0x30
94 #define IPSDISPLAY2_CMD_VSCRDEF 0x33
95 #define IPSDISPLAY2_CMD_TEOFF 0x34
96 #define IPSDISPLAY2_CMD_TEON 0x35
97 #define IPSDISPLAY2_CMD_MADCTL 0x36
98 #define IPSDISPLAY2_CMD_VSCRSADD 0x37
99 #define IPSDISPLAY2_CMD_IDMOFF 0x38
100 #define IPSDISPLAY2_CMD_IDMON 0x39
101 #define IPSDISPLAY2_CMD_COLMOD 0x3A
102 #define IPSDISPLAY2_CMD_RAMWRC 0x3C
103 #define IPSDISPLAY2_CMD_RAMRDC 0x3E
104 #define IPSDISPLAY2_CMD_TESCAN 0x44
105 #define IPSDISPLAY2_CMD_RDTESCAN 0x45
106 #define IPSDISPLAY2_CMD_WRDISBV 0x51
107 #define IPSDISPLAY2_CMD_RDDISBV 0x52
108 #define IPSDISPLAY2_CMD_WRCTRLD 0x53
109 #define IPSDISPLAY2_CMD_RDCTRLD 0x54
110 #define IPSDISPLAY2_CMD_WRCACE 0x55
111 #define IPSDISPLAY2_CMD_RDCABC 0x56
112 #define IPSDISPLAY2_CMD_WRCABCMB 0x5E
113 #define IPSDISPLAY2_CMD_RDCABCMB 0x5F
114 #define IPSDISPLAY2_CMD_RDABCSDR 0x68
115 #define IPSDISPLAY2_CMD_RDID1 0xDA
116 #define IPSDISPLAY2_CMD_RDID2 0xDB
117 #define IPSDISPLAY2_CMD_RDID3 0xDC
118 
123 #define IPSDISPLAY2_CMD_RAMCTRL 0xB0
124 #define IPSDISPLAY2_CMD_RGBCTRL 0xB1
125 #define IPSDISPLAY2_CMD_PORCTRL 0xB2
126 #define IPSDISPLAY2_CMD_FRCTRL1 0xB3
127 #define IPSDISPLAY2_CMD_PARCTRL 0xB5
128 #define IPSDISPLAY2_CMD_GCTRL 0xB7
129 #define IPSDISPLAY2_CMD_GTADJ 0xB8
130 #define IPSDISPLAY2_CMD_DGMEN 0xBA
131 #define IPSDISPLAY2_CMD_VCOMS 0xBB
132 #define IPSDISPLAY2_CMD_POWSAVE 0xBC
133 #define IPSDISPLAY2_CMD_DLPOFFSAVE 0xBD
134 #define IPSDISPLAY2_CMD_LCMCTRL 0xC0
135 #define IPSDISPLAY2_CMD_IDSET 0xC1
136 #define IPSDISPLAY2_CMD_VDVVRHEN 0xC2
137 #define IPSDISPLAY2_CMD_VRHS 0xC3
138 #define IPSDISPLAY2_CMD_VDVSET 0xC4
139 #define IPSDISPLAY2_CMD_VCMOFSET 0xC5
140 #define IPSDISPLAY2_CMD_FRCTR2 0xC6
141 #define IPSDISPLAY2_CMD_CABCCTRL 0xC7
142 #define IPSDISPLAY2_CMD_REGSEL1 0xC8
143 #define IPSDISPLAY2_CMD_REGSEL2 0xCA
144 #define IPSDISPLAY2_CMD_PWMFRSEL 0xCC
145 #define IPSDISPLAY2_CMD_PWCTRL1 0xD0
146 #define IPSDISPLAY2_CMD_VAPVANEN 0xD2
147 #define IPSDISPLAY2_CMD_CMD2EN0 0xDF
148 #define IPSDISPLAY2_CMD_CMD2EN1 0x5A
149 #define IPSDISPLAY2_CMD_CMD2EN2 0x69
150 #define IPSDISPLAY2_CMD_CMD2EN3 0x02
151 #define IPSDISPLAY2_CMD_PVGAMCTRL 0xE0
152 #define IPSDISPLAY2_CMD_NVGAMCTRL 0xE1
153 #define IPSDISPLAY2_CMD_DGMLUTR 0xE2
154 #define IPSDISPLAY2_CMD_DGMLUTB 0xE3
155 #define IPSDISPLAY2_CMD_GATECTRL 0xE4
156 #define IPSDISPLAY2_CMD_SPI2EN 0xE7
157 #define IPSDISPLAY2_CMD_PWCTRL2 0xE8
158 #define IPSDISPLAY2_CMD_EQCTRL 0xE9
159 #define IPSDISPLAY2_CMD_PROMCTRL 0xEC
160 #define IPSDISPLAY2_CMD_PROMEN 0xFA
161 #define IPSDISPLAY2_CMD_NVMSET 0xFC
162 #define IPSDISPLAY2_CMD_PROMACT 0xFE
163  // ipsdisplay2_cmd
165 
180 #define IPSDISPLAY2_MADCTL_DEFAULT 0x00
181 #define IPSDISPLAY2_MADCTL_MY 0x80
182 #define IPSDISPLAY2_MADCTL_MX 0x40
183 #define IPSDISPLAY2_MADCTL_MV 0x20
184 #define IPSDISPLAY2_MADCTL_ML 0x10
185 #define IPSDISPLAY2_MADCTL_RGB 0x08
186 #define IPSDISPLAY2_MADCTL_MH 0x04
187 
192 #define IPSDISPLAY2_COLMOD_RGB_65K 0x50
193 #define IPSDISPLAY2_COLMOD_RGB_262K 0x60
194 #define IPSDISPLAY2_COLMOD_RGB_MASK 0x70
195 #define IPSDISPLAY2_COLMOD_CTRL_12BIT_PIXEL 0x03
196 #define IPSDISPLAY2_COLMOD_CTRL_16BIT_PIXEL 0x05
197 #define IPSDISPLAY2_COLMOD_CTRL_18BIT_PIXEL 0x06
198 #define IPSDISPLAY2_COLMOD_CTRL_16M_TRUNCATED 0x07
199 #define IPSDISPLAY2_COLMOD_CTRL_MASK 0x07
200 
205 #define IPSDISPLAY2_PORCTRL_0_BPA_DEFAULT 0x0C
206 #define IPSDISPLAY2_PORCTRL_0_BPA_MASK 0x7F
207 #define IPSDISPLAY2_PORCTRL_1_FPA_DEFAULT 0x0C
208 #define IPSDISPLAY2_PORCTRL_1_FPA_MASK 0x7F
209 #define IPSDISPLAY2_PORCTRL_2_PSEN_DISABLE 0x00
210 #define IPSDISPLAY2_PORCTRL_2_PSEN_ENABLE 0x01
211 #define IPSDISPLAY2_PORCTRL_3_BPB_DEFAULT 0x30
212 #define IPSDISPLAY2_PORCTRL_3_BPB_MASK 0xF0
213 #define IPSDISPLAY2_PORCTRL_3_FPB_DEFAULT 0x03
214 #define IPSDISPLAY2_PORCTRL_3_FPB_MASK 0x0F
215 #define IPSDISPLAY2_PORCTRL_4_BPC_DEFAULT 0x30
216 #define IPSDISPLAY2_PORCTRL_4_BPC_MASK 0xF0
217 #define IPSDISPLAY2_PORCTRL_4_FPC_DEFAULT 0x03
218 #define IPSDISPLAY2_PORCTRL_4_FPC_MASK 0x0F
219 
224 #define IPSDISPLAY2_GCTRL_VGHS_DEFAULT 0x30
225 #define IPSDISPLAY2_GCTRL_VGHS_MASK 0x70
226 #define IPSDISPLAY2_GCTRL_VGLS_DEFAULT 0x05
227 #define IPSDISPLAY2_GCTRL_VGLS_MASK 0x07
228 
233 #define IPSDISPLAY2_VCOMS_VCOM_DEFAULT 0x3A
234 #define IPSDISPLAY2_VCOMS_VCOM_MASK 0x3F
235 
240 #define IPSDISPLAY2_LCMCTRL_XMY 0x40
241 #define IPSDISPLAY2_LCMCTRL_XBGR 0x20
242 #define IPSDISPLAY2_LCMCTRL_XINV 0x10
243 #define IPSDISPLAY2_LCMCTRL_XMX 0x08
244 #define IPSDISPLAY2_LCMCTRL_XMH 0x04
245 #define IPSDISPLAY2_LCMCTRL_XMV 0x02
246 #define IPSDISPLAY2_LCMCTRL_XGS 0x01
247 
252 #define IPSDISPLAY2_VDVVRHEN_CMDEN_DISABLE 0x00
253 #define IPSDISPLAY2_VDVVRHEN_CMDEN_ENABLE 0x01
254 
259 #define IPSDISPLAY2_VRHS_DEFAULT 0x19
260 #define IPSDISPLAY2_VRHS_MASK 0x3F
261 
266 #define IPSDISPLAY2_VDVSET_DEFAULT 0x20
267 #define IPSDISPLAY2_VDVSET_MASK 0x3F
268 
273 #define IPSDISPLAY2_FRCTR2_NLA_DEFAULT 0x00
274 #define IPSDISPLAY2_FRCTR2_NLA_MASK 0xE0
275 #define IPSDISPLAY2_FRCTR2_RTNA_DEFAULT 0x0F
276 #define IPSDISPLAY2_FRCTR2_RTNA_MASK 0x1F
277 
282 #define IPSDISPLAY2_PWCTRL1_0_DEFAULT 0xA4
283 #define IPSDISPLAY2_PWCTRL1_1_AVDD_DEFAULT 0x80
284 #define IPSDISPLAY2_PWCTRL1_1_AVDD_MASK 0xC0
285 #define IPSDISPLAY2_PWCTRL1_1_AVCL_DEFAULT 0x20
286 #define IPSDISPLAY2_PWCTRL1_1_AVCL_MASK 0x30
287 #define IPSDISPLAY2_PWCTRL1_1_VDS_DEFAULT 0x01
288 #define IPSDISPLAY2_PWCTRL1_1_VDS_MASK 0x03
289 
294 #define IPSDISPLAY2_PVGAMCTRL_0_V63P_DEFAULT 0xD0
295 #define IPSDISPLAY2_PVGAMCTRL_0_V63P_MASK 0xF0
296 #define IPSDISPLAY2_PVGAMCTRL_0_V0P_DEFAULT 0x00
297 #define IPSDISPLAY2_PVGAMCTRL_0_V0P_MASK 0x0F
298 #define IPSDISPLAY2_PVGAMCTRL_1_V1P_DEFAULT 0x08
299 #define IPSDISPLAY2_PVGAMCTRL_1_V1P_MASK 0x3F
300 #define IPSDISPLAY2_PVGAMCTRL_2_V2P_DEFAULT 0x0E
301 #define IPSDISPLAY2_PVGAMCTRL_2_V2P_MASK 0x3F
302 #define IPSDISPLAY2_PVGAMCTRL_3_V4P_DEFAULT 0x09
303 #define IPSDISPLAY2_PVGAMCTRL_3_V4P_MASK 0x1F
304 #define IPSDISPLAY2_PVGAMCTRL_4_V6P_DEFAULT 0x09
305 #define IPSDISPLAY2_PVGAMCTRL_4_V6P_MASK 0x1F
306 #define IPSDISPLAY2_PVGAMCTRL_5_J0P_DEFAULT 0x00
307 #define IPSDISPLAY2_PVGAMCTRL_5_J0P_MASK 0x30
308 #define IPSDISPLAY2_PVGAMCTRL_5_J13P_DEFAULT 0x05
309 #define IPSDISPLAY2_PVGAMCTRL_5_J13P_MASK 0x0F
310 #define IPSDISPLAY2_PVGAMCTRL_6_V20P_DEFAULT 0x31
311 #define IPSDISPLAY2_PVGAMCTRL_6_V20P_MASK 0x7F
312 #define IPSDISPLAY2_PVGAMCTRL_7_V36P_DEFAULT 0x30
313 #define IPSDISPLAY2_PVGAMCTRL_7_V36P_MASK 0x70
314 #define IPSDISPLAY2_PVGAMCTRL_7_V27P_DEFAULT 0x03
315 #define IPSDISPLAY2_PVGAMCTRL_7_V27P_MASK 0x07
316 #define IPSDISPLAY2_PVGAMCTRL_8_V43P_DEFAULT 0x48
317 #define IPSDISPLAY2_PVGAMCTRL_8_V43P_MASK 0x7F
318 #define IPSDISPLAY2_PVGAMCTRL_9_J1P_DEFAULT 0x10
319 #define IPSDISPLAY2_PVGAMCTRL_9_11P_MASK 0x30
320 #define IPSDISPLAY2_PVGAMCTRL_9_V50P_DEFAULT 0x07
321 #define IPSDISPLAY2_PVGAMCTRL_9_V50P_MASK 0x0F
322 #define IPSDISPLAY2_PVGAMCTRL_10_V57P_DEFAULT 0x14
323 #define IPSDISPLAY2_PVGAMCTRL_10_V57P_MASK 0x1F
324 #define IPSDISPLAY2_PVGAMCTRL_11_V59P_DEFAULT 0x15
325 #define IPSDISPLAY2_PVGAMCTRL_11_V59P_MASK 0x1F
326 #define IPSDISPLAY2_PVGAMCTRL_12_V61P_DEFAULT 0x31
327 #define IPSDISPLAY2_PVGAMCTRL_12_V61P_MASK 0x3F
328 #define IPSDISPLAY2_PVGAMCTRL_13_V62P_DEFAULT 0x34
329 #define IPSDISPLAY2_PVGAMCTRL_13_V62P_MASK 0x3F
330 
335 #define IPSDISPLAY2_NVGAMCTRL_0_V63N_DEFAULT 0xD0
336 #define IPSDISPLAY2_NVGAMCTRL_0_V63N_MASK 0xF0
337 #define IPSDISPLAY2_NVGAMCTRL_0_V0N_DEFAULT 0x00
338 #define IPSDISPLAY2_NVGAMCTRL_0_V0N_MASK 0x0F
339 #define IPSDISPLAY2_NVGAMCTRL_1_V1N_DEFAULT 0x08
340 #define IPSDISPLAY2_NVGAMCTRL_1_V1N_MASK 0x3F
341 #define IPSDISPLAY2_NVGAMCTRL_2_V2N_DEFAULT 0x0E
342 #define IPSDISPLAY2_NVGAMCTRL_2_V2N_MASK 0x3F
343 #define IPSDISPLAY2_NVGAMCTRL_3_V4N_DEFAULT 0x09
344 #define IPSDISPLAY2_NVGAMCTRL_3_V4N_MASK 0x1F
345 #define IPSDISPLAY2_NVGAMCTRL_4_V6N_DEFAULT 0x09
346 #define IPSDISPLAY2_NVGAMCTRL_4_V6N_MASK 0x1F
347 #define IPSDISPLAY2_NVGAMCTRL_5_J0N_DEFAULT 0x10
348 #define IPSDISPLAY2_NVGAMCTRL_5_J0N_MASK 0x30
349 #define IPSDISPLAY2_NVGAMCTRL_5_J13N_DEFAULT 0x05
350 #define IPSDISPLAY2_NVGAMCTRL_5_J13N_MASK 0x0F
351 #define IPSDISPLAY2_NVGAMCTRL_6_V20N_DEFAULT 0x31
352 #define IPSDISPLAY2_NVGAMCTRL_6_V20N_MASK 0x7F
353 #define IPSDISPLAY2_NVGAMCTRL_7_V36N_DEFAULT 0x30
354 #define IPSDISPLAY2_NVGAMCTRL_7_V36N_MASK 0x70
355 #define IPSDISPLAY2_NVGAMCTRL_7_V27N_DEFAULT 0x03
356 #define IPSDISPLAY2_NVGAMCTRL_7_V27N_MASK 0x07
357 #define IPSDISPLAY2_NVGAMCTRL_8_V43N_DEFAULT 0x48
358 #define IPSDISPLAY2_NVGAMCTRL_8_V43N_MASK 0x7F
359 #define IPSDISPLAY2_NVGAMCTRL_9_J1N_DEFAULT 0x10
360 #define IPSDISPLAY2_NVGAMCTRL_9_11N_MASK 0x30
361 #define IPSDISPLAY2_NVGAMCTRL_9_V50N_DEFAULT 0x07
362 #define IPSDISPLAY2_NVGAMCTRL_9_V50N_MASK 0x0F
363 #define IPSDISPLAY2_NVGAMCTRL_10_V57N_DEFAULT 0x14
364 #define IPSDISPLAY2_NVGAMCTRL_10_V57N_MASK 0x1F
365 #define IPSDISPLAY2_NVGAMCTRL_11_V59N_DEFAULT 0x15
366 #define IPSDISPLAY2_NVGAMCTRL_11_V59N_MASK 0x1F
367 #define IPSDISPLAY2_NVGAMCTRL_12_V61N_DEFAULT 0x31
368 #define IPSDISPLAY2_NVGAMCTRL_12_V61N_MASK 0x3F
369 #define IPSDISPLAY2_NVGAMCTRL_13_V62N_DEFAULT 0x34
370 #define IPSDISPLAY2_NVGAMCTRL_13_V62N_MASK 0x3F
371 
376 #define IPSDISPLAY2_RES_WIDTH 240
377 #define IPSDISPLAY2_RES_HEIGHT 240
378 #define IPSDISPLAY2_NUM_PIXELS ( ( uint16_t ) IPSDISPLAY2_RES_WIDTH * IPSDISPLAY2_RES_HEIGHT )
379 
384 #define IPSDISPLAY2_POS_WIDTH_MIN 0
385 #define IPSDISPLAY2_POS_WIDTH_MAX ( IPSDISPLAY2_RES_WIDTH - 1 )
386 #define IPSDISPLAY2_POS_HEIGHT_MIN 0
387 #define IPSDISPLAY2_POS_HEIGHT_MAX ( IPSDISPLAY2_RES_HEIGHT - 1 )
388 #define IPSDISPLAY2_POS_OFFSET_LEFT 0
389 #define IPSDISPLAY2_POS_OFFSET_RIGHT 0
390 #define IPSDISPLAY2_POS_OFFSET_UP 0
391 #define IPSDISPLAY2_POS_OFFSET_DOWN 80
392 
397 #define IPSDISPLAY2_FONT_WIDTH 6
398 #define IPSDISPLAY2_FONT_HEIGHT 12
399 #define IPSDISPLAY2_FONT_TEXT_SPACE 1
400 #define IPSDISPLAY2_FONT_ASCII_OFFSET 32
401 #define IPSDISPLAY2_FONT_WIDTH_MSB 0x80
402 
407 #define IPSDISPLAY2_ROTATION_VERTICAL_0 0
408 #define IPSDISPLAY2_ROTATION_VERTICAL_180 1
409 #define IPSDISPLAY2_ROTATION_HORIZONTAL_0 2
410 #define IPSDISPLAY2_ROTATION_HORIZONTAL_180 3
411 
416 #define IPSDISPLAY2_COLOR_BLACK 0x0000
417 #define IPSDISPLAY2_COLOR_WHITE 0xFFFF
418 #define IPSDISPLAY2_COLOR_RED 0xF800
419 #define IPSDISPLAY2_COLOR_LIME 0x07E0
420 #define IPSDISPLAY2_COLOR_BLUE 0x001F
421 #define IPSDISPLAY2_COLOR_YELLOW 0xFFE0
422 #define IPSDISPLAY2_COLOR_CYAN 0x07FF
423 #define IPSDISPLAY2_COLOR_MAGENTA 0xF81F
424 #define IPSDISPLAY2_COLOR_SILVER 0xBDF7
425 #define IPSDISPLAY2_COLOR_GRAY 0x8410
426 #define IPSDISPLAY2_COLOR_MAROON 0x8000
427 #define IPSDISPLAY2_COLOR_OLIVE 0x8400
428 #define IPSDISPLAY2_COLOR_GREEN 0x0400
429 #define IPSDISPLAY2_COLOR_PURPLE 0x8010
430 #define IPSDISPLAY2_COLOR_TEAL 0x0410
431 #define IPSDISPLAY2_COLOR_NAVY 0x0010
432 
441 #define IPSDISPLAY2_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
442 #define IPSDISPLAY2_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
443  // ipsdisplay2_set
445 
460 #define IPSDISPLAY2_MAP_MIKROBUS( cfg, mikrobus ) \
461  cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
462  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
463  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
464  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
465  cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
466  cfg.bck = MIKROBUS( mikrobus, MIKROBUS_AN ); \
467  cfg.dc = MIKROBUS( mikrobus, MIKROBUS_INT )
468  // ipsdisplay2_map // ipsdisplay2
471 
476 typedef struct
477 {
478  // Output pins
479  digital_out_t rst;
480  digital_out_t dc;
481  digital_out_t cs;
482  digital_out_t bck;
484  // Modules
485  spi_master_t spi;
487  uint8_t rotation;
489 } ipsdisplay2_t;
490 
495 typedef struct
496 {
497  // Communication gpio pins
498  pin_name_t miso;
499  pin_name_t mosi;
500  pin_name_t sck;
501  pin_name_t cs;
503  // Additional gpio pins
504  pin_name_t rst;
505  pin_name_t dc;
506  pin_name_t bck;
508  // static variable
509  uint32_t spi_speed;
510  spi_master_mode_t spi_mode;
513 
518 typedef struct
519 {
520  uint16_t x;
521  uint16_t y;
524 
529 typedef enum
530 {
532  IPSDISPLAY2_ERROR = -1
533 
535 
552 
567 
581 
593 err_t ipsdisplay2_write_cmd ( ipsdisplay2_t *ctx, uint8_t cmd );
594 
609 err_t ipsdisplay2_write_cmd_par ( ipsdisplay2_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t len );
610 
623 err_t ipsdisplay2_write_data ( ipsdisplay2_t *ctx, uint16_t *data_in, uint16_t len );
624 
634 
644 
654 
664 
674 
684 
694 
709 err_t ipsdisplay2_set_rotation ( ipsdisplay2_t *ctx, uint8_t rotation );
710 
726 
738 err_t ipsdisplay2_fill_screen ( ipsdisplay2_t *ctx, uint16_t color );
739 
755 err_t ipsdisplay2_write_char ( ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, uint8_t data_in, uint16_t color );
756 
772 err_t ipsdisplay2_write_string ( ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, uint8_t *data_in, uint16_t color );
773 
787 err_t ipsdisplay2_draw_pixel ( ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, uint16_t color );
788 
805  ipsdisplay2_point_t end_pt, uint16_t color );
806 
823  ipsdisplay2_point_t end_pt, uint16_t color );
824 
838 err_t ipsdisplay2_draw_circle ( ipsdisplay2_t *ctx, ipsdisplay2_point_t center_pt, uint8_t radius, uint16_t color );
839 
855 err_t ipsdisplay2_draw_picture ( ipsdisplay2_t *ctx, uint8_t rotation, const uint16_t *image );
856 
857 #ifdef __cplusplus
858 }
859 #endif
860 #endif // IPSDISPLAY2_H
861  // ipsdisplay2
863 
864 // ------------------------------------------------------------------------ END
IPSDISPLAY2_OK
@ IPSDISPLAY2_OK
Definition: ipsdisplay2.h:531
ipsdisplay2_t
IPS Display 2 Click context object.
Definition: ipsdisplay2.h:477
ipsdisplay2_t::dc
digital_out_t dc
Definition: ipsdisplay2.h:480
ipsdisplay2_cfg_t::cs
pin_name_t cs
Definition: ipsdisplay2.h:501
ipsdisplay2_t::rst
digital_out_t rst
Definition: ipsdisplay2.h:479
ipsdisplay2_set_pos
err_t ipsdisplay2_set_pos(ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, ipsdisplay2_point_t end_pt)
IPS Display 2 set pos function.
IPSDISPLAY2_ERROR
@ IPSDISPLAY2_ERROR
Definition: ipsdisplay2.h:532
ipsdisplay2_t::bck
digital_out_t bck
Definition: ipsdisplay2.h:482
spi_specifics.h
This file contains SPI specific macros, functions, etc.
ipsdisplay2_enable_device
void ipsdisplay2_enable_device(ipsdisplay2_t *ctx)
IPS Display 2 enable device function.
ipsdisplay2_cfg_t::spi_speed
uint32_t spi_speed
Definition: ipsdisplay2.h:509
ipsdisplay2_t::rotation
uint8_t rotation
Definition: ipsdisplay2.h:487
ipsdisplay2_point_t::x
uint16_t x
Definition: ipsdisplay2.h:520
ipsdisplay2_t::spi
spi_master_t spi
Definition: ipsdisplay2.h:485
ipsdisplay2_draw_pixel
err_t ipsdisplay2_draw_pixel(ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, uint16_t color)
IPS Display 2 draw pixel function.
ipsdisplay2_t::cs
digital_out_t cs
Definition: ipsdisplay2.h:481
ipsdisplay2_point_t::y
uint16_t y
Definition: ipsdisplay2.h:521
ipsdisplay2_write_data
err_t ipsdisplay2_write_data(ipsdisplay2_t *ctx, uint16_t *data_in, uint16_t len)
IPS Display 2 write data function.
ipsdisplay2_return_value_t
ipsdisplay2_return_value_t
IPS Display 2 Click return value data.
Definition: ipsdisplay2.h:530
ipsdisplay2_enter_cmd_mode
void ipsdisplay2_enter_cmd_mode(ipsdisplay2_t *ctx)
IPS Display 2 enter cmd mode function.
ipsdisplay2_draw_line
err_t ipsdisplay2_draw_line(ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, ipsdisplay2_point_t end_pt, uint16_t color)
IPS Display 2 draw line function.
ipsdisplay2_write_cmd
err_t ipsdisplay2_write_cmd(ipsdisplay2_t *ctx, uint8_t cmd)
IPS Display 2 write cmd function.
ipsdisplay2_point_t
IPS Display 2 Click point coordinates object.
Definition: ipsdisplay2.h:519
ipsdisplay2_write_cmd_par
err_t ipsdisplay2_write_cmd_par(ipsdisplay2_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t len)
IPS Display 2 write cmd par function.
ipsdisplay2_draw_circle
err_t ipsdisplay2_draw_circle(ipsdisplay2_t *ctx, ipsdisplay2_point_t center_pt, uint8_t radius, uint16_t color)
IPS Display 2 draw circle function.
ipsdisplay2_cfg_t::miso
pin_name_t miso
Definition: ipsdisplay2.h:498
ipsdisplay2_draw_picture
err_t ipsdisplay2_draw_picture(ipsdisplay2_t *ctx, uint8_t rotation, const uint16_t *image)
IPS Display 2 draw picture function.
ipsdisplay2_enable_backlight
void ipsdisplay2_enable_backlight(ipsdisplay2_t *ctx)
IPS Display 2 enable backlight function.
ipsdisplay2_write_char
err_t ipsdisplay2_write_char(ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, uint8_t data_in, uint16_t color)
IPS Display 2 write char function.
ipsdisplay2_cfg_t::bck
pin_name_t bck
Definition: ipsdisplay2.h:506
ipsdisplay2_cfg_t::rst
pin_name_t rst
Definition: ipsdisplay2.h:504
ipsdisplay2_enter_data_mode
void ipsdisplay2_enter_data_mode(ipsdisplay2_t *ctx)
IPS Display 2 enter data mode function.
ipsdisplay2_set_rotation
err_t ipsdisplay2_set_rotation(ipsdisplay2_t *ctx, uint8_t rotation)
IPS Display 2 set rotation function.
ipsdisplay2_cfg_t
IPS Display 2 Click configuration object.
Definition: ipsdisplay2.h:496
ipsdisplay2_cfg_t::sck
pin_name_t sck
Definition: ipsdisplay2.h:500
ipsdisplay2_init
err_t ipsdisplay2_init(ipsdisplay2_t *ctx, ipsdisplay2_cfg_t *cfg)
IPS Display 2 initialization function.
ipsdisplay2_fill_screen
err_t ipsdisplay2_fill_screen(ipsdisplay2_t *ctx, uint16_t color)
IPS Display 2 fill screen function.
ipsdisplay2_disable_backlight
void ipsdisplay2_disable_backlight(ipsdisplay2_t *ctx)
IPS Display 2 disable backlight function.
ipsdisplay2_reset_device
void ipsdisplay2_reset_device(ipsdisplay2_t *ctx)
IPS Display 2 reset device function.
ipsdisplay2_draw_rectangle
err_t ipsdisplay2_draw_rectangle(ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, ipsdisplay2_point_t end_pt, uint16_t color)
IPS Display 2 draw rectangle function.
ipsdisplay2_write_string
err_t ipsdisplay2_write_string(ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, uint8_t *data_in, uint16_t color)
IPS Display 2 write string function.
ipsdisplay2_default_cfg
err_t ipsdisplay2_default_cfg(ipsdisplay2_t *ctx)
IPS Display 2 default configuration function.
ipsdisplay2_cfg_t::dc
pin_name_t dc
Definition: ipsdisplay2.h:505
ipsdisplay2_cfg_setup
void ipsdisplay2_cfg_setup(ipsdisplay2_cfg_t *cfg)
IPS Display 2 configuration object setup function.
ipsdisplay2_cfg_t::mosi
pin_name_t mosi
Definition: ipsdisplay2.h:499
ipsdisplay2_disable_device
void ipsdisplay2_disable_device(ipsdisplay2_t *ctx)
IPS Display 2 disable device function.
ipsdisplay2_cfg_t::spi_mode
spi_master_mode_t spi_mode
Definition: ipsdisplay2.h:510