A fork with some I2C optimizations that speed up the display.

Fork of SSD1308_128x64_I2C by Wim Huiskamp

Files at this revision

API Documentation at this revision

Comitter:
ruevs
Date:
Tue Jun 12 08:22:06 2018 +0000
Parent:
4:df92b0c0cb92
Commit message:
MPU9250 and BMP180 support for the "Xadow - IMU 10DOF" board.

Changed in this revision

SSD1308.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r df92b0c0cb92 -r b6fbc7614a98 SSD1308.cpp
--- a/SSD1308.cpp	Thu Jan 01 17:53:40 2015 +0000
+++ b/SSD1308.cpp	Tue Jun 12 08:22:06 2018 +0000
@@ -51,7 +51,7 @@
 //#include "font_16x20.h"
 #include "font_16x24.h"
 
-#if defined(TARGET_LPC1768)
+#if (defined(TARGET_LPC1768)) || (defined(TARGET_LPC11UXX) || defined(TARGET_LPC11U6X) || defined(TARGET_LPC1347) || defined(TARGET_LPC1549))
 #define I2C_OPTIMIZE   1
 #else
 #define I2C_OPTIMIZE   0
@@ -418,7 +418,7 @@
  *  @param char chr character to write
 */
 void SSD1308::writeChar(char chr) {
-
+#if (I2C_OPTIMIZE == 0)
   const uint8_t char_index = chr - 0x20;
 
   for (uint8_t i = 0; i < 8; i++) {
@@ -429,7 +429,9 @@
        _sendData( font_8x8[char_index][i] );
      }  
   }
-
+#else
+  _sendData(8, (uint8_t *)&(font_8x8[chr-0x20][0]));
+#endif
 }
 
 
@@ -691,25 +693,11 @@
  *  @param uint8_t data databyte to write
 */
 void SSD1308::_sendData(uint8_t data){
-
-#if (I2C_OPTIMIZE == 0)
-//I2C Blockwrite versions dont seem to work ?
-//That may be related to fact that the SSD1308/SSD1306 does NOT return an acknowledge: blockwrite may abort the operation
-//Noted for mbed lib v63 on 20/7/13 
   char databytes[2];
     
   databytes[0] = DATA_MODE;
   databytes[1] = data;    
   _i2c.write(_writeOpcode, databytes, 2);    // Write Data   
-
-#else
-  _i2c.start();
-  _i2c.write(_writeOpcode);
-  _i2c.write(DATA_MODE);  
-  _i2c.write(data); 
-  _i2c.stop();  
-#endif
-
 }
 
 /** @brief Write len bytes from buffer data to display,