Driver for the Seeedstudio RGB OLED module for the xadow M0

Revision:
3:af00512c9694
Parent:
2:e033aab5daad
Child:
4:1707ca53e7d5
--- a/src/SSD1331.cpp	Thu Nov 12 22:31:58 2015 +0000
+++ b/src/SSD1331.cpp	Thu Nov 12 23:23:33 2015 +0000
@@ -69,7 +69,7 @@
     init();
 };
 
-void SSD1331::sendCmd(unsigned char cmd)
+void SSD1331::sendCmd(uint8_t cmd)
 {
     _dc = 0;
     _cs = 0;
@@ -77,7 +77,7 @@
     _cs = 1;
 }
 
-void SSD1331::sendCmd(unsigned char cmd, unsigned char arg1)
+void SSD1331::sendCmd(uint8_t cmd, uint8_t arg1)
 {
     _dc = 0;
     _cs = 0;
@@ -86,7 +86,7 @@
     _cs = 1;
 }
     
-void SSD1331::sendCmd(unsigned char cmd, unsigned char arg1, unsigned char arg2)
+void SSD1331::sendCmd(uint8_t cmd, uint8_t arg1, uint8_t arg2)
 {
     _dc = 0;
     _cs = 0;
@@ -96,13 +96,13 @@
     _cs = 1;
 }    
 
-void  SSD1331::sendCmd(unsigned char *cmd, int count)
+void  SSD1331::sendCmd(uint8_t *cmd, uint8_t count)
 {
     if(!cmd) return;
     
     _dc = 0;
     _cs = 0;
-    for(int i=0; i<count; ++i)
+    for(uint8_t i=0; i<count; ++i)
        _spiPort.write(*cmd++);
     _cs = 1;
 }
@@ -198,39 +198,19 @@
 //    sendCmd(CMD_NORMAL_BRIGHTNESS_DISPLAY_ON);//set display on
 }
 
-void SSD1331::drawPixel(uint16_t x, uint16_t y, uint16_t color)
+void SSD1331::drawPixel(uint8_t x, uint8_t y, uint16_t color)
 {
     if ((x >= RGB_OLED_WIDTH) || (y >= RGB_OLED_HEIGHT))
         return;
         
-    //set column point
-    sendCmd(CMD_SET_COLUMN_ADDRESS, x, RGB_OLED_WIDTH-1);
-
-    //set row point
-    sendCmd(CMD_SET_ROW_ADDRESS, y, RGB_OLED_HEIGHT-1);
+    //                      set column point               set row point
+    uint8_t cmd[7] = {CMD_SET_COLUMN_ADDRESS, x, x,  CMD_SET_ROW_ADDRESS, y, y,   0x00};
+    sendCmd(cmd, 6);
 
     //fill 16bit colour
     sendData(color);
 }
 
-//------------------------------------------------------------
-
-
-void SSD1331::Draw_Dot(uint8_t x, uint8_t y,unsigned int Color)
-{
-    x=96-x;
-    
-    unsigned char cmd[7]={0x15,0x00,0x00,0x75,0x00,0x00,0x00};
-
-    cmd[1] = (unsigned char)x; 
-    cmd[2] = (unsigned char)x; 
-    cmd[4] = (unsigned char)y; 
-    cmd[5] = (unsigned char)y; 
-    sendCmd(cmd, 6);
-    sendData(Color);
-}
-
-
 //-------------------------------------------------------------------------
 void SSD1331::drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color)
 {