MCPcopy Create free account
hub / github.com/OpenStickCommunity/GP2040-CE / obdSetContrast

Function obdSetContrast

lib/OneBitDisplay/OneBitDisplay.cpp:688–705  ·  view source on GitHub ↗

Sets the brightness (0=off, 255=brightest)

Source from the content-addressed store, hash-verified

686// Sets the brightness (0=off, 255=brightest)
687//
688void obdSetContrast(OBDISP *pOBD, unsigned char ucContrast)
689{
690 if (pOBD->type == LCD_HX1230)
691 { // valid values are 0-31, so scale it
692 ucContrast >>= 3;
693 obdWriteCommand(pOBD, 0x80 + ucContrast);
694 }
695 else if (pOBD->type == LCD_NOKIA5110)
696 {
697 // we allow values of 0xb0-0xbf, so shrink the range
698 ucContrast >>= 4;
699 obdWriteCommand(pOBD, 0x21); // set advanced command mode
700 obdWriteCommand(pOBD, 0xb0 | ucContrast);
701 obdWriteCommand(pOBD, 0x20); // set simple command mode
702 }
703 else // OLEDs + UC1701
704 obdWriteCommand2(pOBD, 0x81, ucContrast);
705} /* obdSetContrast() */
706
707//
708// Special case for Sharp Memory LCD

Callers 2

obdSPIInitFunction · 0.85
initMethod · 0.85

Calls 1

obdWriteCommand2Function · 0.85

Tested by

no test coverage detected