forked from parallaxinc/spin-standard-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.con.ssd1331.spin
142 lines (120 loc) · 4.97 KB
/
core.con.ssd1331.spin
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
{
--------------------------------------------
Filename: core.con.ssd1331.spin
Author: Jesse Burt
Description: SSD1331-specific constants
Copyright (c) 2022
Started: Nov 18, 2018
Updated: Feb 19, 2022
See end of file for terms of use.
--------------------------------------------
}
CON
' SPI configuration
SCK_MAX_FREQ = 6_666_666 ' According to the datasheet
SPI_MODE = 0
T_RES = 3 ' minimum low pulse on RESET
T_RES_COMPLT = 2 ' reset completion time (max)
' D/C states
CMD = 0
DATA = 1
' Register map
DRAWLINE = $21
DRAWRECT = $22
COPY = $23
CLEAR = $25
FILLCPY = $26
FILLCPY_MASK = $11
REVCOPY = 4
FILL = 0
REVCOPY_MASK = (1 << REVCOPY) ^ FILLCPY_MASK
FILL_MASK = 1 ^ FILLCPY_MASK
SCROLLSETUP = $27
SCROLLSTOP = $2E
SCROLLSTART = $2F
SETCOLUMN = $15
SETROW = $75
CONTRASTA = $81
CONTRASTB = $82
CONTRASTC = $83
MASTERCURRENT = $87
SETREMAP = $A0
SETREMAP_MASK = $FF
COLORFMT = 6
COMSPLIT = 5
COMREMAP = 4
COMLR_SWAP = 3
SUBPIX_ORDER = 2
SEGREMAP = 1
ADDRINC = 0
COLORFMT_BITS = %11
COLORFMT_MASK = (COLORFMT_BITS << COLORFMT) ^ SETREMAP_MASK
COMSPLIT_MASK = (1 << COMSPLIT) ^ SETREMAP_MASK
COMREMAP_MASK = (1 << COMREMAP) ^ SETREMAP_MASK
COMLR_SWAP_MASK = (1 << COMLR_SWAP) ^ SETREMAP_MASK
SUBPIX_ORDER_MASK = (1 << SUBPIX_ORDER) ^ SETREMAP_MASK
SEGREMAP_MASK = (1 << SEGREMAP) ^ SETREMAP_MASK
ADDRINC_MASK = 1 ^ SETREMAP_MASK
STARTLINE = $A1
DISPLAYOFFSET = $A2
NORMALDISPLAY = $A4
DISPLAYALLON = $A5
DISPLAYALLOFF = $A6
INVERTDISPLAY = $A7
SETMULTIPLEX = $A8
DISPLAYONDIM = $AC
SETMASTER = $AD
MASTERCFG_EXT_VCC = $8E
DISPLAYOFF = $AE
DISPLAYON = $AF
PWRMODE = $B0
PWRSAVE_ENA = $1A
PWRSAVE_DIS = $0B
PRECHG = $B1
PRECHG_MASK = $FF
PHASE2 = 4
PHASE1 = 0
PHASE2_BITS = %1111
PHASE1_BITS = %1111
PHASE2_MASK = (PHASE2_BITS << PHASE2) ^ PRECHG_MASK
PHASE1_MASK = PHASE1_BITS ^ PRECHG_MASK
CLKDIV_FRQ = $B3
CLKDIV_FRQ_MASK = $FF
FOSCFREQ = 4
CLKDIV = 0
FOSCFREQ_BITS = %1111
CLKDIV_BITS = %1111
FOSCFREQ_MASK = (FOSCFREQ_BITS << FOSCFREQ) ^ CLKDIV_FRQ_MASK
CLKDIV_MASK = CLKDIV_BITS ^ CLKDIV_FRQ_MASK
PRECHGA = $8A
PRECHGB = $8B
PRECHGC = $8C
PRECHGLVL = $BB
PRECHG_LVL = 1
NOP1 = $BC
NOP2 = $BD
VCOMH = $BE
NOP3 = $E3
' Other constants
SEL_EXTERNAL_VCC = $8E
#ifndef __propeller2__
PUB Null
'' This is not a top-level object
#endif
{
--------------------------------------------------------------------------------------------------------
TERMS OF USE: MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------------------------------
}