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