lib/unigraphic/SSD1322.cpp

changeset 66
48f29a1d43d6
parent 45
2da50a3d4e9f
--- a/lib/unigraphic/SSD1322.cpp	Mon Oct 04 21:14:39 2021 +0200
+++ b/lib/unigraphic/SSD1322.cpp	Mon Oct 04 21:15:35 2021 +0200
@@ -98,7 +98,7 @@
 		 const char *name)
     : GraphicsDisplay(name),
       screensize_X(DISPLAY_WIDTH), screensize_Y(DISPLAY_HEIGHT),
-      _BPP(BPP), _PAGES(DISPLAY_HEIGHT/8*BPP),
+      _PAGES(DISPLAY_HEIGHT/8*BPP), _BPP(BPP),
       _IC_X_SEGS(IC_X_SEGS), _IC_Y_COMS(IC_Y_COMS), _IC_PAGES(IC_Y_COMS/8*BPP),
       _spi(mosi, miso, sclk),
       _DC(DC), _CS(CS), _RST(reset)
@@ -138,13 +138,13 @@
 
 void SSD1322::hw_reset()
 {
-	ThisThread::sleep_for(15);
+	ThisThread::sleep_for(15ms);
   _DC = 1;
   _CS = 1;
   _RST = 0;                        // display reset
-  ThisThread::sleep_for(2);
+  ThisThread::sleep_for(2ms);
   _RST = 1;                       // end reset
-  ThisThread::sleep_for(100);
+  ThisThread::sleep_for(100ms);
 }
 
 void SSD1322::bus_enable(bool enable)
@@ -188,7 +188,7 @@
   // Enable Nibble Re-map,Scan from COM[N-1] to COM0,
   // Disable COM Split Odd Even
   // Enable Dual COM mode
-  unsigned char d;
+  unsigned char d = 0;
   switch (mode)
     {
     case(NONE):
@@ -324,9 +324,10 @@
     if((x >= screensize_X) || (y >= screensize_Y)) return 0;
 
     unsigned short page = y * _BPP / 8;
+	/* to be used in correct implementation...
     unsigned char pos = y & ((8 / _BPP) - 1); // position in page
     unsigned char mask = (( 1 << _BPP) - 1);
-
+	*/
     //FAUX
     return (_pixelBuffer[(x + page*screensize_X)]); // = (_pixelBuffer[(x + page*screensize_X)] & ~(mask<<(pos*_BPP))) | ((color&mask)<<(pos*_BPP));
 }
@@ -355,9 +356,6 @@
 
 void SSD1322::copy_to_lcd(void)
 {
-  unsigned int x, y;
-  unsigned int i;
-
   pixel_buffer_mutex.lock();
   memcpy((void*)_trBuffer,
 		 (const void*)_pixelBuffer,
@@ -372,6 +370,9 @@
   _CS = 0;
   _spi.transfer((uint8_t*) _trBuffer, 64*128, (uint8_t*) NULL, 0, _spiEventCb);
 #else
+  unsigned int x, y;
+  unsigned int i;
+
   i = 0;
   for(y=0; y<64; y++)
     for(x=0; x<128; x++)

mercurial