Sylaina / oled-display

Library for OLED-displays runs on AVR
GNU General Public License v3.0
121 stars 29 forks source link

Add inverted mode. #8

Closed TheFeaRhq closed 4 years ago

TheFeaRhq commented 4 years ago

Hi! great library! thank you.

it would be great if you add inverted text mode.

since i dont use graphic mode i made changes only to text mode.. void lcd_putc(char c){ ........ else if(charMode == INVERTED){ i2c_start(LCD_I2C_ADR << 1); i2c_byte(0x40); for (uint8_t i = 0; i < sizeof(FONT[0]); i++) { // print font to ram, print 6 columns i2c_byte(~(pgm_read_byte(&(FONT[(uint8_t)c][i])))); } i2c_stop(); cursorPosition.x += sizeof(FONT[0]);
}

simply adding "~" bitwise NOT operation in i2c_byte.

and defining INVERTED as 3 in lcd.h

thank you.

Sylaina commented 4 years ago

If you want inverted textmode call

lcd_inverted();

in your source-code. This will switch lcd to an inverted textmode.