@@ -21,6 +21,9 @@ void St7789::Init() {
21
21
#ifndef DRIVER_DISPLAY_MIRROR
22
22
DisplayInversionOn ();
23
23
#endif
24
+ PorchSet ();
25
+ FrameRateNormalSet ();
26
+ IdleFrameRateOff ();
24
27
NormalModeOn ();
25
28
SetVdv ();
26
29
PowerControl ();
@@ -159,8 +162,28 @@ void St7789::IdleModeOff() {
159
162
WriteCommand (static_cast <uint8_t >(Commands::IdleModeOff));
160
163
}
161
164
162
- void St7789::FrameRateLow () {
163
- WriteCommand (static_cast <uint8_t >(Commands::FrameRate));
165
+ void St7789::PorchSet () {
166
+ WriteCommand (static_cast <uint8_t >(Commands::Porch));
167
+ // Normal mode front porch
168
+ WriteData (0x02 );
169
+ // Normal mode back porch
170
+ WriteData (0x03 );
171
+ // Porch control enable
172
+ WriteData (0x01 );
173
+ // Idle mode front:back porch
174
+ WriteData (0xed );
175
+ // Partial mode front:back porch (partial mode unused but set anyway)
176
+ WriteData (0xed );
177
+ }
178
+
179
+ void St7789::FrameRateNormalSet () {
180
+ WriteCommand (static_cast <uint8_t >(Commands::FrameRateNormal));
181
+ // Note that datasheet table inaccurate - see formula below table
182
+ WriteData (0x0a );
183
+ }
184
+
185
+ void St7789::IdleFrameRateOn () {
186
+ WriteCommand (static_cast <uint8_t >(Commands::FrameRateIdle));
164
187
// Enable frame rate control for partial/idle mode, 8x frame divider
165
188
// In testing this divider appears to actually be 16x?
166
189
WriteData (0x13 );
@@ -170,14 +193,14 @@ void St7789::FrameRateLow() {
170
193
WriteData (0x1f );
171
194
}
172
195
173
- void St7789::FrameRateNormal () {
174
- WriteCommand (static_cast <uint8_t >(Commands::FrameRate ));
196
+ void St7789::IdleFrameRateOff () {
197
+ WriteCommand (static_cast <uint8_t >(Commands::FrameRateIdle ));
175
198
// Disable frame rate control and divider
176
199
WriteData (0x00 );
177
200
// Idle mode frame rate (normal)
178
- WriteData (0x0f );
201
+ WriteData (0x0a );
179
202
// Partial mode frame rate (normal, unused)
180
- WriteData (0x0f );
203
+ WriteData (0x0a );
181
204
}
182
205
183
206
void St7789::DisplayOn () {
@@ -260,13 +283,13 @@ void St7789::HardwareReset() {
260
283
261
284
void St7789::LowPowerOn () {
262
285
IdleModeOn ();
263
- FrameRateLow ();
286
+ IdleFrameRateOn ();
264
287
NRF_LOG_INFO (" [LCD] Low power mode" );
265
288
}
266
289
267
290
void St7789::LowPowerOff () {
268
291
IdleModeOff ();
269
- FrameRateNormal ();
292
+ IdleFrameRateOff ();
270
293
NRF_LOG_INFO (" [LCD] Normal power mode" );
271
294
}
272
295
0 commit comments