void i2c_OLED_send_char(unsigned char ascii) { unsigned char i; uint8_t buffer; for (i = 0; i < 5; i++) { buffer = multiWiiFont[ascii - 32][i]; buffer ^= CHAR_FORMAT; // apply i2c_OLED_send_byte(buffer); } i2c_OLED_send_byte(CHAR_FORMAT); // the gap }
void i2c_OLED_send_char(unsigned char ascii) { uint8_t i; memcpy(bufferOLED,myFont[ascii - 32],5); for( i = 0; i < 5; i++) { bufferOLED[i] ^= CHAR_FORMAT; i2c_OLED_send_byte(bufferOLED[i]); } i2c_OLED_send_byte(CHAR_FORMAT); }
// RLE compressed bitmaps must be 128 width with vertical data orientation, and size included in file. static void bitmapDecompressAndShow(uint8_t *bitmap) { uint8_t data = 0, count = 0; uint16_t i; uint8_t width = *bitmap; bitmap++; uint8_t height = *bitmap; bitmap++; uint16_t bitmapSize = (width * height) / 8; for (i = 0; i < bitmapSize; i++) { if(count == 0) { data = *bitmap; bitmap++; if(data == *bitmap) { bitmap++; count = *bitmap; bitmap++; } else { count = 1; } } count--; i2c_OLED_send_byte(data); } }
void i2c_OLED_clear_display_quick(void) { i2c_OLED_send_cmd(0xb0); // set page address to 0 i2c_OLED_send_cmd(0x40); // Display start line register to 0 i2c_OLED_send_cmd(0); // Set low col address to 0 i2c_OLED_send_cmd(0x10); // Set high col address to 0 for(uint16_t i = 0; i < 1024; i++) { // fill the display's RAM with graphic... 128*64 pixel picture i2c_OLED_send_byte(0x00); // clear } }
void i2c_OLED_clear_display(void) { i2c_OLED_send_cmd(0xa6); // Set Normal Display i2c_OLED_send_cmd(0xae); // Display OFF i2c_OLED_send_cmd(0x20); // Set Memory Addressing Mode i2c_OLED_send_cmd(0x00); // Set Memory Addressing Mode to Horizontal addressing mode i2c_OLED_send_cmd(0xb0); // set page address to 0 i2c_OLED_send_cmd(0x40); // Display start line register to 0 i2c_OLED_send_cmd(0); // Set low col address to 0 i2c_OLED_send_cmd(0x10); // Set high col address to 0 for(uint16_t i = 0; i < 1024; i++) { // fill the display's RAM with graphic... 128*64 pixel picture i2c_OLED_send_byte(0x00); // clear } i2c_OLED_send_cmd(0x81); // Setup CONTRAST CONTROL, following byte is the contrast Value... always a 2 byte instruction i2c_OLED_send_cmd(200); // Here you can set the brightness 1 = dull, 255 is very bright i2c_OLED_send_cmd(0xaf); // display on }