MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / ssd1351Init

Function ssd1351Init

modules/drivers/ssd1351/modSsd1351.c:316–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316void ssd1351Init(spiDisplay sd)
317{
318 uint8_t i = 0;
319
320 SCREEN_CS_INIT;
321 SCREEN_DC_INIT;
322 SCREEN_RST_INIT;
323
324 modSPIInit(&sd->spiConfig);
325
326 // N.B. Adafruit sample uses 500 millisecond delay... seems _very_ long... 500 microsceconds works just fine
327 SCREEN_CS_ACTIVE;
328 SCREEN_RST_DEACTIVE;
329 modDelayMicroseconds(500);
330 SCREEN_RST_ACTIVE;
331 modDelayMicroseconds(500);
332 SCREEN_RST_DEACTIVE;
333 modDelayMicroseconds(500);
334
335 while (i < sizeof (gSSD1351Initialization)) {
336 uint8_t command, count;
337 uint8_t data[16];
338
339 command = c_read8(&gSSD1351Initialization[i++]);
340 if (SSD1351_CMD_NULL == command)
341 break;
342
343 count = c_read8(&gSSD1351Initialization[i++]);
344 if (count > 0) {
345 c_memcpy(data, gSSD1351Initialization + i, count);
346 i += count;
347
348 if (SSD1351_CMD_STARTLINE == command)
349 data[0] = (96 == MODDEF_SSD1351_HEIGHT) ? 96 : 0;
350 }
351
352 ssd1351Command(sd, command, data, count);
353 }
354}
355
356void ssd1351ChipSelect(uint8_t active, modSPIConfiguration config)
357{

Callers 1

xs_ssd1351Function · 0.85

Calls 2

ssd1351CommandFunction · 0.85
modSPIInitFunction · 0.50

Tested by

no test coverage detected