Luka Ristic 2020/0331

Revision:
12:7964c2cfdebc
Parent:
10:d5aee2d2f8dd
Parent:
11:86909e6db3c8
Child:
15:77feec1c0684
--- a/Adafruit_SSD1306.h	Mon Oct 20 03:16:15 2014 +0000
+++ b/Adafruit_SSD1306.h	Tue Oct 21 02:16:49 2014 +0000
@@ -42,6 +42,11 @@
 #define SSD1306_EXTERNALVCC 0x1
 #define SSD1306_SWITCHCAPVCC 0x2
 
+/** The pure base class for the SSD1306 display driver.
+ *
+ * You should derive from this for a new transport interface type,
+ * such as the SPI and I2C drivers.
+ */
 class Adafruit_SSD1306 : public Adafruit_GFX
 {
 public:
@@ -53,16 +58,21 @@
 	};
 
 	void begin(uint8_t switchvcc = SSD1306_SWITCHCAPVCC);
+	
+	// These must be implemented in the derived transport driver
 	virtual void command(uint8_t c) = 0;
 	virtual void data(uint8_t c) = 0;
-    
+	virtual void drawPixel(int16_t x, int16_t y, uint16_t color);
+
+	/// Clear the display buffer    
 	void clearDisplay(void);
 	virtual void invertDisplay(bool i);
+
+	/// Cause the display to be updated with the buffer content.
 	void display();
+	/// Fill the buffer with the AdaFruit splash screen.
 	virtual void splash();
     
-	virtual void drawPixel(int16_t x, int16_t y, uint16_t color);
-    
 protected:
 	virtual void sendDisplayBuffer() = 0;
 	DigitalOut2 rst;
@@ -71,9 +81,25 @@
 	std::vector<uint8_t> buffer;
 };
 
+
+/** This is the SPI SSD1306 display driver transport class
+ *
+ */
 class Adafruit_SSD1306_Spi : public Adafruit_SSD1306
 {
 public:
+	/** Create a SSD1306 SPI transport display driver instance with the specified DC, RST, and CS pins, as well as the display dimentions
+	 *
+	 * Required parameters
+	 * @param spi - a reference to an initialized SPI object
+	 * @param DC (Data/Command) pin name
+	 * @param RST (Reset) pin name
+	 * @param CS (Chip Select) pin name
+	 *
+	 * Optional parameters
+	 * @param rawHeight - the vertical number of pixels for the display, defaults to 32
+	 * @param rawWidth - the horizonal number of pixels for the display, defaults to 128
+	 */
 	Adafruit_SSD1306_Spi(SPI &spi, PinName DC, PinName RST, PinName CS, uint8_t rawHieght = 32, uint8_t rawWidth = 128)
 	    : Adafruit_SSD1306(RST, rawHieght, rawWidth)
 	    , cs(CS,true)
@@ -113,6 +139,12 @@
 		for(uint16_t i=0, q=buffer.size(); i<q; i++)
 			mspi.write(buffer[i]);
 
+		if(height() == 32)
+		{
+			for(uint16_t i=0, q=buffer.size(); i<q; i++)
+				mspi.write(0);
+		}
+
 		cs = 1;
 	};
 
@@ -120,10 +152,24 @@
 	SPI &mspi;
 };
 
+/** This is the I2C SSD1306 display driver transport class
+ *
+ */
 class Adafruit_SSD1306_I2c : public Adafruit_SSD1306
 {
 public:
 	#define SSD_I2C_ADDRESS     0x78
+	/** Create a SSD1306 I2C transport display driver instance with the specified RST pin name, the I2C address, as well as the display dimensions
+	 *
+	 * Required parameters
+	 * @param i2c - A reference to an initialized I2C object
+	 * @param RST - The Reset pin name
+	 *
+	 * Optional parameters
+	 * @param i2cAddress - The i2c address of the display
+	 * @param rawHeight - The vertical number of pixels for the display, defaults to 32
+	 * @param rawWidth - The horizonal number of pixels for the display, defaults to 128
+	 */
 	Adafruit_SSD1306_I2c(I2C &i2c, PinName RST, uint8_t i2cAddress = SSD_I2C_ADDRESS, uint8_t rawHeight = 32, uint8_t rawWidth = 128)
 	    : Adafruit_SSD1306(RST, rawHeight, rawWidth)
 	    , mi2c(i2c)