A derived version of the BSD licensed Adafrut GFX library for the SSD1306 controller for an OLED 128x32 or 128x64 display using SPI or I2C.

Fork of Adafruit_GFX by Neal Horman

Revision:
17:bbd6430a27ca
Parent:
16:7fb1d4d3525d
diff -r 7fb1d4d3525d -r bbd6430a27ca Adafruit_SSD1306.cpp
--- a/Adafruit_SSD1306.cpp	Tue Nov 11 22:08:20 2014 +0000
+++ b/Adafruit_SSD1306.cpp	Mon Aug 15 18:38:35 2016 +0000
@@ -149,6 +149,10 @@
 	std::fill(buffer.begin(),buffer.end(),0);
 }
 
+void Adafruit_SSD1306::print(string text) {
+	for (string::iterator c = text.begin(); c != text.end(); c++) this->writeChar( (uint8_t) *c );
+}
+
 void Adafruit_SSD1306::splash(void)
 {
 #ifndef NO_SPLASH_ADAFRUIT
@@ -228,3 +232,18 @@
 		);
 #endif
 }
+
+void Adafruit_SSD1306::drawXBitmap(int16_t x, int16_t y,
+ const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color) {
+
+  int16_t i, j, byteWidth = (w + 7) / 8;
+  uint8_t byte;
+
+  for(j=0; j<h; j++) {
+    for(i=0; i<w; i++ ) {
+      if(i & 7) byte >>= 1;
+      else      byte   = pgm_read_byte(bitmap + j * byteWidth + i / 8);
+      if(byte & 0x01) drawPixel(x+i, y+j, color);
+    }
+  }
+}