Library for Modtronix im4OLED board with 128x64 OLED and 4 buttons. For details, see product page http://modtronix.com/im4oled.html. Is a clone of Adafruit_GFX library, with some additional code added.
Fork of Adafruit_GFX by
Diff: mx_ssd1306.h
- Revision:
- 23:44309099c532
- Parent:
- 22:f63aeb3769b5
- Child:
- 26:ef08580c35df
diff -r f63aeb3769b5 -r 44309099c532 mx_ssd1306.h --- a/mx_ssd1306.h Tue Oct 20 17:18:02 2015 +1100 +++ b/mx_ssd1306.h Wed Oct 21 14:49:56 2015 +1100 @@ -26,7 +26,7 @@ #include "mbed.h" #include "mx_gfx.h" -#if !defined(OLED_NO_VECTOR) +#if (OLED_USE_VECTOR==1) #include <vector> #endif #include <algorithm> @@ -70,7 +70,7 @@ //Initialize as all dirty memset(&dirty[0], 0xff, sizeof(dirty)); -#if defined(OLED_NO_VECTOR) +#if (OLED_USE_VECTOR==0) memset(&buffer[0], 0, sizeof(buffer)); #else buffer.resize(rawHeight * rawWidth / 8); @@ -154,10 +154,10 @@ #endif // the memory buffer for the LCD -#if defined(OLED_NO_VECTOR) - uint8_t buffer[OLED_HEIGHT * OLED_WIDTH / 8]; +#if (OLED_USE_VECTOR==1) + std::vector<uint8_t> buffer; #else - std::vector<uint8_t> buffer; + uint8_t buffer[OLED_HEIGHT * OLED_WIDTH / 8]; #endif }; @@ -232,7 +232,7 @@ dc = 1; cs = 0; -#if defined(OLED_NO_VECTOR) +#if (OLED_USE_VECTOR==0) for(uint16_t i=0, q=sizeof(buffer); i<q; i++) { #else for(uint16_t i=0, q=buffer.size(); i<q; i++) { @@ -245,7 +245,7 @@ if(height() == 32) { -#if defined(OLED_NO_VECTOR) +#if (OLED_USE_VECTOR==0) for(uint16_t i=0, q=sizeof(buffer); i<q; i++) { #else for(uint16_t i=0, q=buffer.size(); i<q; i++) { @@ -371,7 +371,7 @@ buff[0] = 0x40; // Data Mode // send display buffer in 16 byte chunks -#if defined(OLED_NO_VECTOR) +#if (OLED_USE_VECTOR==0) for(uint16_t i=0, q=sizeof(buffer); i<q; i+=16 ) { #else for(uint16_t i=0, q=buffer.size(); i<q; i+=16 ) {