MCPcopy Create free account
hub / github.com/PricelessToolkit/MailBoxGuard / setBrightness

Method setBrightness

Code/Arduino_libraries/SSD1306/OLEDDisplay.cpp:785–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783}
784
785void OLEDDisplay::setBrightness(uint8_t brightness) {
786 uint8_t contrast = brightness;
787 if (brightness < 128) {
788 // Magic values to get a smooth/ step-free transition
789 contrast = brightness * 1.171;
790 } else {
791 contrast = brightness * 1.171 - 43;
792 }
793
794 uint8_t precharge = 241;
795 if (brightness == 0) {
796 precharge = 0;
797 }
798 uint8_t comdetect = brightness / 8;
799
800 setContrast(contrast, precharge, comdetect);
801}
802
803void OLEDDisplay::resetOrientation() {
804 sendCommand(SEGREMAP);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected