1 /*
2  * Copyright (c) 2019 Marc Reilly
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef ST7789V_DISPLAY_DRIVER_H__
7 #define ST7789V_DISPLAY_DRIVER_H__
8 
9 #include <zephyr.h>
10 
11 #define ST7789V_CMD_SW_RESET			0x01
12 
13 #define ST7789V_CMD_SLEEP_IN			0x10
14 #define ST7789V_CMD_SLEEP_OUT			0x11
15 #define ST7789V_CMD_INV_OFF			0x20
16 #define ST7789V_CMD_INV_ON			0x21
17 #define ST7789V_CMD_GAMSET			0x26
18 #define ST7789V_CMD_DISP_OFF			0x28
19 #define ST7789V_CMD_DISP_ON			0x29
20 
21 #define ST7789V_CMD_CASET			0x2a
22 #define ST7789V_CMD_RASET			0x2b
23 #define ST7789V_CMD_RAMWR			0x2c
24 
25 #define ST7789V_CMD_MADCTL			0x36
26 #define ST7789V_MADCTL_MY_TOP_TO_BOTTOM		0x00
27 #define ST7789V_MADCTL_MY_BOTTOM_TO_TOP		0x80
28 #define ST7789V_MADCTL_MX_LEFT_TO_RIGHT		0x00
29 #define ST7789V_MADCTL_MX_RIGHT_TO_LEFT		0x40
30 #define ST7789V_MADCTL_MV_REVERSE_MODE		0x20
31 #define ST7789V_MADCTL_MV_NORMAL_MODE		0x00
32 #define ST7789V_MADCTL_ML			0x10
33 #define ST7789V_MADCTL_RBG			0x00
34 #define ST7789V_MADCTL_BGR			0x08
35 #define ST7789V_MADCTL_MH_LEFT_TO_RIGHT		0x00
36 #define ST7789V_MADCTL_MH_RIGHT_TO_LEFT		0x04
37 
38 #define ST7789V_CMD_COLMOD			0x3a
39 #define ST7789V_COLMOD_RGB_65K			(0x5 << 4)
40 #define ST7789V_COLMOD_RGB_262K			(0x6 << 4)
41 #define ST7789V_COLMOD_FMT_12bit		(3)
42 #define ST7789V_COLMOD_FMT_16bit		(5)
43 #define ST7789V_COLMOD_FMT_18bit		(6)
44 
45 #define ST7789V_CMD_RAMCTRL			0xb0
46 #define ST7789V_CMD_RGBCTRL			0xb1
47 #define ST7789V_CMD_PORCTRL			0xb2
48 #define ST7789V_CMD_CMD2EN			0xdf
49 #define ST7789V_CMD_DGMEN			0xba
50 #define ST7789V_CMD_GCTRL			0xb7
51 #define ST7789V_CMD_VCOMS			0xbb
52 
53 #define ST7789V_CMD_LCMCTRL			0xc0
54 #define ST7789V_LCMCTRL_XMY			0x40
55 #define ST7789V_LCMCTRL_XBGR			0x20
56 #define ST7789V_LCMCTRL_XINV			0x10
57 #define ST7789V_LCMCTRL_XMX			0x08
58 #define ST7789V_LCMCTRL_XMH			0x04
59 #define ST7789V_LCMCTRL_XMV			0x02
60 
61 #define ST7789V_CMD_VDVVRHEN			0xc2
62 #define ST7789V_CMD_VRH				0xc3
63 #define ST7789V_CMD_VDS				0xc4
64 #define ST7789V_CMD_FRCTRL2			0xc6
65 #define ST7789V_CMD_PWCTRL1			0xd0
66 
67 #define ST7789V_CMD_PVGAMCTRL			0xe0
68 #define ST7789V_CMD_NVGAMCTRL			0xe1
69 
70 #endif
71