Maxim Integrated / Mbed OS MAXREFDES155#

Dependencies:   MaximInterface

Revision:
10:71359af61af8
Parent:
0:33d4e66780c0
Child:
11:989eabe2a376
diff -r 40dd19da90c3 -r 71359af61af8 Display.cpp
--- a/Display.cpp	Thu Apr 06 15:19:57 2017 -0500
+++ b/Display.cpp	Mon Apr 10 11:55:33 2017 -0500
@@ -30,11 +30,16 @@
 * ownership rights.
 *******************************************************************************/
 
-#include "Bitmap.hpp"
 #include "Display.hpp"
 
+/// @{
+/// Width and height of the display in pixels.
+static const int width = 128;
+static const int height = 64;
+/// @}
+
 Display::Display(PinName mosi, PinName miso, PinName sclk, PinName ssel, PinName a0) :
-    spi(mosi, miso, sclk), cs(ssel, 1), a0(a0, 0)
+    m_canvas(width, height), spi(mosi, miso, sclk), cs(ssel, 1), a0(a0, 0)
 {
     spi.format(8, 3); // CPOL = 1, CPHA = 1
 }
@@ -52,16 +57,16 @@
     sendCommand(0xAF);
 }
 
-void Display::update(const Bitmap & canvas)
+void Display::update()
 {   
     sendCommand(0xAE);
     sendCommand(0x40);
     const int rowsPerPage = 8;
     int row = -rowsPerPage;
-    int column = canvas.width();
-    for (Bitmap::SegmentBuffer::const_iterator it = canvas.data().begin(); it != canvas.data().end(); it++)
+    int column = m_canvas.width();
+    for (Bitmap::SegmentBuffer::const_iterator it = m_canvas.data().begin(); it != m_canvas.data().end(); it++)
     {
-        if (column == canvas.width())
+        if (column == m_canvas.width())
         {
             row += rowsPerPage;
             if (row >= height) // Height of the canvas is greater than height of the display.