MCPcopy Create free account
hub / github.com/cbm80amiga/Arduino_ST7789_Fast / commonST7789Init

Method commonST7789Init

Arduino_ST7789_Fast.cpp:306–343  ·  view source on GitHub ↗

---------------------------------------------------------- Initialization code common to all ST7789 displays

Source from the content-addressed store, hash-verified

304// ----------------------------------------------------------
305// Initialization code common to all ST7789 displays
306void Arduino_ST7789::commonST7789Init(const uint8_t *cmdList)
307{
308 pinMode(dcPin, OUTPUT);
309#ifndef CS_ALWAYS_LOW
310 pinMode(csPin, OUTPUT);
311#endif
312
313#ifndef COMPATIBILITY_MODE
314 dcPort = portOutputRegister(digitalPinToPort(dcPin));
315 dcMask = digitalPinToBitMask(dcPin);
316#ifndef CS_ALWAYS_LOW
317 csPort = portOutputRegister(digitalPinToPort(csPin));
318 csMask = digitalPinToBitMask(csPin);
319#endif
320#endif
321
322 // on AVR ST7789 works correctly in MODE2 and MODE3 but for STM32 only MODE3 seems to be working
323 SPI.begin();
324#ifdef COMPATIBILITY_MODE
325 spiSettings = SPISettings(16000000, MSBFIRST, SPI_MODE3); // 8000000 gives max speed on AVR 16MHz
326#else
327 SPI.setClockDivider(SPI_CLOCK_DIV2);
328 SPI.setDataMode(SPI_MODE3);
329#endif
330
331 CS_ACTIVE;
332 if(rstPin != -1) {
333 pinMode(rstPin, OUTPUT);
334 digitalWrite(rstPin, HIGH);
335 delay(50);
336 digitalWrite(rstPin, LOW);
337 delay(50);
338 digitalWrite(rstPin, HIGH);
339 delay(50);
340 }
341
342 if(cmdList) displayInit(cmdList);
343}
344
345// ----------------------------------------------------------
346void Arduino_ST7789::setRotation(uint8_t m)

Callers

nothing calls this directly

Calls 1

beginMethod · 0.80

Tested by

no test coverage detected