Skip to content

Commit c16d316

Browse files
committed
MagTag SSD1680 FPC-7519rev.b: use VCOM=0x20 for correct contrast
The FPC-7519rev.b panel (User ID byte 0xca) shows a dark gray background with the default VCOM=0x28. Setting VCOM=0x20 (-1.5V) gives a light gray background with solid black text. Surgical fix: dedicated ssd1680_vcom20_display_start_sequence and DISPLAY_SSD1680_COLSTART_8_VCOM20 type routed to case 0xca: only. The 0x44 and 0x00 panels are untouched.
1 parent e512a25 commit c16d316

1 file changed

Lines changed: 45 additions & 4 deletions

File tree

  • ports/espressif/boards/adafruit_magtag_2.9_grayscale

ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,40 @@ const uint8_t ssd1680_display_start_sequence[] = {
128128
0x22, 0x00, 0x01, 0xc7 // display update mode
129129
};
130130

131+
// FPC-7519rev.b (User ID byte 0xca) requires VCOM=0x20 (-1.5V) for correct contrast.
132+
// The 0x44 panel works correctly with the default VCOM=0x28, so keep them separate.
133+
const uint8_t ssd1680_vcom20_display_start_sequence[] = {
134+
0x12, DELAY, 0x00, 0x14, // soft reset and wait 20ms
135+
0x11, 0x00, 0x01, 0x03, // Ram data entry mode
136+
0x3c, 0x00, 0x01, 0x03, // border color
137+
0x2c, 0x00, 0x01, 0x20, // Set vcom voltage (0x20 = -1.5V, tuned for FPC-7519rev.b)
138+
0x03, 0x00, 0x01, 0x17, // Set gate voltage
139+
0x04, 0x00, 0x03, 0x41, 0xae, 0x32, // Set source voltage
140+
0x4e, 0x00, 0x01, 0x01, // ram x count
141+
0x4f, 0x00, 0x02, 0x00, 0x00, // ram y count
142+
0x01, 0x00, 0x03, 0x27, 0x01, 0x00, // set display size
143+
0x32, 0x00, 0x99, // Update waveforms
144+
0x2a, 0x60, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L0
145+
0x20, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L1
146+
0x28, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L2
147+
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L3
148+
0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VS L4
149+
0x00, 0x02, 0x00, 0x05, 0x14, 0x00, 0x00, // TP, SR, RP of Group0
150+
0x1E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x01, // TP, SR, RP of Group1
151+
0x00, 0x02, 0x00, 0x05, 0x14, 0x00, 0x00, // TP, SR, RP of Group2
152+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // TP, SR, RP of Group3
153+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // TP, SR, RP of Group4
154+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // TP, SR, RP of Group5
155+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // TP, SR, RP of Group6
156+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // TP, SR, RP of Group7
157+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // TP, SR, RP of Group8
158+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // TP, SR, RP of Group9
159+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // TP, SR, RP of Group10
160+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // TP, SR, RP of Group11
161+
0x24, 0x22, 0x22, 0x22, 0x23, 0x32, 0x00, 0x00, 0x00, // FR, XON
162+
0x22, 0x00, 0x01, 0xc7 // display update mode
163+
};
164+
131165
const uint8_t ssd1680_display_stop_sequence[] = {
132166
0x10, DELAY, 0x01, 0x01, 0x64
133167
};
@@ -141,6 +175,7 @@ typedef enum {
141175
DISPLAY_IL0373,
142176
DISPLAY_SSD1680_COLSTART_0,
143177
DISPLAY_SSD1680_COLSTART_8,
178+
DISPLAY_SSD1680_COLSTART_8_VCOM20, // FPC-7519rev.b (User ID 0xca)
144179
} display_type_t;
145180

146181
static display_type_t detect_display_type(void) {
@@ -218,8 +253,9 @@ static display_type_t detect_display_type(void) {
218253
case 0x00:
219254
return DISPLAY_SSD1680_COLSTART_0;
220255
case 0x44:
221-
case 0xca:
222256
return DISPLAY_SSD1680_COLSTART_8;
257+
case 0xca:
258+
return DISPLAY_SSD1680_COLSTART_8_VCOM20;
223259
}
224260
}
225261

@@ -268,12 +304,17 @@ void board_init(void) {
268304
} else {
269305
epaperdisplay_construct_args_t args = EPAPERDISPLAY_CONSTRUCT_ARGS_DEFAULTS;
270306
// Default colstart is 0.
271-
if (display_type == DISPLAY_SSD1680_COLSTART_8) {
307+
if (display_type == DISPLAY_SSD1680_COLSTART_8 || display_type == DISPLAY_SSD1680_COLSTART_8_VCOM20) {
272308
args.colstart = 8;
273309
}
274310
args.bus = bus;
275-
args.start_sequence = ssd1680_display_start_sequence;
276-
args.start_sequence_len = sizeof(ssd1680_display_start_sequence);
311+
if (display_type == DISPLAY_SSD1680_COLSTART_8_VCOM20) {
312+
args.start_sequence = ssd1680_vcom20_display_start_sequence;
313+
args.start_sequence_len = sizeof(ssd1680_vcom20_display_start_sequence);
314+
} else {
315+
args.start_sequence = ssd1680_display_start_sequence;
316+
args.start_sequence_len = sizeof(ssd1680_display_start_sequence);
317+
}
277318
args.stop_sequence = ssd1680_display_stop_sequence;
278319
args.stop_sequence_len = sizeof(ssd1680_display_stop_sequence);
279320
args.width = 296;

0 commit comments

Comments
 (0)