Class: Denko::Display::IL0373
Constant Summary
collapse
- COLUMNS =
212
- ROWS =
104
- PANEL_SETTING =
Subset of used commands from datasheet:
0x00
- POWER_SETTING =
0x01
- POWER_OFF =
0x02
- POWER_OFF_SEQUENCE =
0x03
- POWER_ON =
0x04
- POWER_ON_MEASURE =
0x05
- BOOSTER_SOFT_START =
0x06
- DEEP_SLEEP =
0x07
- DATA_START_1 =
0x10
- DATA_STOP =
0x11
- DISPLAY_REFRESH =
0x12
- DATA_START_2 =
0x13
- VCOM_DATA_SETTING =
0x50
- RESOLUTION_SETTING =
0x61
- PARTIAL_WINDOW =
0x90
- PARTIAL_IN =
0x91
- PARTIAL_OUT =
0x92
Behaviors::Lifecycle::CALLBACK_METHODS
SPIEPaperCommon::BUSY_WAIT_TIME, SPIEPaperCommon::RESET_TIME
Instance Attribute Summary
#spi_bit_order, #spi_frequency, #spi_mode
#state
#board, #params
#pin, #pins, #proxies
Instance Method Summary
collapse
-
#booster_soft_start ⇒ Object
-
#deep_sleep ⇒ Object
-
#draw(*args, **kwargs) ⇒ Object
-
#draw_partial(buffer, x_start, x_finish, p_start, p_finish, color = 1) ⇒ Object
-
#invert_black ⇒ Object
-
#power_on ⇒ Object
-
#reflect_x ⇒ Object
-
#reflect_y ⇒ Object
-
#refresh ⇒ Object
-
#rotate ⇒ Object
-
#set_panel_setting ⇒ Object
-
#set_power_setting ⇒ Object
-
#set_resolution ⇒ Object
-
#set_vcom_data_setting ⇒ Object
-
#set_window(x_start = x_min, x_finish = x_max, p_start = p_min, p_finish = p_max) ⇒ Object
Treat what the datasheet calls x as vertical (y, page), and vertical as horizontal (x).
-
#wake ⇒ Object
included
#busy_wait, #hw_reset, #initialize_pins
Methods included from SPICommon
#command, #data, #initialize_pins, #transfer_limit
#canvas, #colors, #columns, #get_partial_buffer, #p_max, #p_min, #rows, #x_max, #x_min, #y_max, #y_min
#ensure_byte_array, #initialize_pins, #proxy_pin, #spi_listen, #spi_read, #spi_stop, #spi_transfer, #spi_write, #update
#add_callback, #callbacks, #pre_callback_filter, #remove_callback, #update
#update_state
#atomically
#initialize, #micro_delay
#convert_pins, #proxy_pin, #proxy_states, #require_pin, #require_pins
Instance Method Details
#booster_soft_start ⇒ Object
108
109
110
111
112
|
# File 'lib/denko/display/il0373.rb', line 108
def booster_soft_start
command [BOOSTER_SOFT_START]
data [0x17, 0x17, 0x17]
end
|
#deep_sleep ⇒ Object
129
130
131
132
133
|
# File 'lib/denko/display/il0373.rb', line 129
def deep_sleep
command [DEEP_SLEEP]
data [0xA5]
end
|
#draw(*args, **kwargs) ⇒ Object
150
151
152
153
|
# File 'lib/denko/display/il0373.rb', line 150
def draw(*args, **kwargs)
wake
super(*args, **kwargs)
end
|
#draw_partial(buffer, x_start, x_finish, p_start, p_finish, color = 1) ⇒ Object
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
# File 'lib/denko/display/il0373.rb', line 155
def draw_partial(buffer, x_start, x_finish, p_start, p_finish, color=1)
set_window(x_start, x_finish, p_start, p_finish)
if (colors == 2)
(color == 2) ? command[DATA_START_2] : command[DATA_START_1]
else
command [DATA_START_2]
end
transformed_buffer = []
(x_start..x_finish).each do |x|
(p_start..p_finish).to_a.reverse.each do |page|
index = (page * columns) + x
transformed_buffer << buffer[index]
end
end
transformed_buffer.each_slice(transfer_limit) { |slice| data(slice) }
command [DATA_STOP]
end
|
#invert_black ⇒ Object
95
96
97
|
# File 'lib/denko/display/il0373.rb', line 95
def invert_black
@invert_black = !@invert_black
end
|
#power_on ⇒ Object
114
115
116
117
|
# File 'lib/denko/display/il0373.rb', line 114
def power_on
command [POWER_ON]
busy_wait
end
|
#reflect_x ⇒ Object
65
66
67
|
# File 'lib/denko/display/il0373.rb', line 65
def reflect_x
@reflect_x = !@reflect_x
end
|
#reflect_y ⇒ Object
69
70
71
|
# File 'lib/denko/display/il0373.rb', line 69
def reflect_y
@reflect_y = !@reflect_y
end
|
#refresh ⇒ Object
180
181
182
183
|
# File 'lib/denko/display/il0373.rb', line 180
def refresh
command [DISPLAY_REFRESH]
busy_wait
end
|
#rotate ⇒ Object
73
74
75
76
|
# File 'lib/denko/display/il0373.rb', line 73
def rotate
@reflect_x = !@reflect_x
@reflect_y = !@reflect_y
end
|
#set_panel_setting ⇒ Object
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
|
# File 'lib/denko/display/il0373.rb', line 35
def set_panel_setting
value = 0b0000_0011
value |= (1 << 4) if colors == 2
source_gate_bits = 0b11
source_gate_bits = 0b10 if (rows <= 128)
source_gate_bits = 0b01 if (rows <= 96) && (columns <= 252)
source_gate_bits = 0b00 if (rows <= 96) && (columns <= 230)
value |= source_gate_bits
value |= (1 << 2) if @reflect_y
value |= (1 << 3) if @reflect_x
command [PANEL_SETTING]
data [value]
end
|
#set_power_setting ⇒ Object
29
30
31
32
33
|
# File 'lib/denko/display/il0373.rb', line 29
def set_power_setting
command [POWER_SETTING]
data [0x03, 0x00, 0x26, 0x26, 0x03]
end
|
#set_resolution ⇒ Object
99
100
101
102
103
104
105
106
|
# File 'lib/denko/display/il0373.rb', line 99
def set_resolution
command [RESOLUTION_SETTING]
data [
p_max+1 << 3,
(columns >> 8) & 0b1,
columns & 0xFF
]
end
|
#set_vcom_data_setting ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/denko/display/il0373.rb', line 78
def set_vcom_data_setting
value = 0b0000_0111
if (colors == 2)
value |= (1 << 4) unless @invert_black
else
value |= (1 << 5) unless @invert_black
end
command [VCOM_DATA_SETTING]
data [value]
end
|
#set_window(x_start = x_min, x_finish = x_max, p_start = p_min, p_finish = p_max) ⇒ Object
Treat what the datasheet calls x as vertical (y, page), and vertical as horizontal (x).
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/denko/display/il0373.rb', line 136
def set_window(x_start=x_min, x_finish=x_max, p_start=p_min, p_finish=p_max)
command [PARTIAL_WINDOW]
data [
p_start << 3,
p_finish << 3,
(x_start >> 8) & 0b1,
x_start & 0xFF,
(x_finish >> 8) & 0b1,
x_finish & 0xFF,
0b0
]
command [PARTIAL_IN]
end
|
#wake ⇒ Object
119
120
121
122
123
124
125
126
127
|
# File 'lib/denko/display/il0373.rb', line 119
def wake
hw_reset
set_power_setting
set_panel_setting
set_vcom_data_setting
set_resolution
booster_soft_start
power_on
end
|