A slightly updated version for use in ENGO 333 at the University of Calgary.

Dependents:   1TestDECAWAVE_plus_others 3TestBeaconDECAWAVE_plus_others DecaWave etch-a-sketch-engo333 ... more

Fork of C12832 by Chris Styles

Revision:
17:878d97d7c263
Parent:
16:7de323fa46fe
--- a/C12832.h	Wed Feb 05 14:25:16 2014 +0000
+++ b/C12832.h	Fri Oct 30 04:55:38 2015 +0000
@@ -53,36 +53,96 @@
 class C12832 : public GraphicsDisplay
 {
 public:
-    /** Create a C12832 object connected to SPI1
-      *
-      */
+
+    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    // START: Functions Relevant to ENGO 333 Lab #8
+
 
+    // Constructor
+    //
+    // Arguments are the pins used for communicating with the device 
+    // (do not worry about these details):
+    //    mosi  - MOSI (master out slave in) pin number
+    //    sck   - SCK pin number
+    //    reset - RESET pin number  
+    //    ao    - A0 pin
+    //    ncs   - NCS pin number
     C12832(PinName mosi, PinName sck, PinName reset, PinName a0, PinName ncs, const char* name = "LCD");
 
 
-    /** Get the width of the screen in pixel
-      *
-      * @param
-      * @returns width of screen in pixel
-      *
-      */
+    // Get the the width of the LCD screen in units of pixels
+    //
+    // Arguments:
+    //    None
+    //
+    // Returns:
+    //    The width of the screen
     virtual int width();
 
-    /** Get the height of the screen in pixel
-     *
-     * @returns height of screen in pixel
-     *
-     */
+
+    // Get the the height of the LCD screen in units of pixels
+    //
+    // Arguments:
+    //    None
+    //
+    // Returns:
+    //    The height of the screen
     virtual int height();
 
-    /** Draw a pixel at x,y black or white
-     *
-     * @param x horizontal position
-     * @param y vertical position
-     * @param colour ,1 set pixel ,0 erase pixel
-     */
+    
+    // Specify the value of a pixel. 
+    //
+    // Arguments:
+    //    x      - X coordinate of the pixel whose value is to be set
+    //    y      - Y coordinate of the pixel whose value is to be set
+    //    colour - The value of the pixel (1 = on, 0 = off)
+    //
+    // Returns:
+    //    Nothing
+    //
+    // Remarks:
+    //  - This function does NOT update the LCD, it only sets the value 
+    //    of the pixel in an internally stored buffer. To actually update 
+    //    the LCD, you need to copy the buffer to the LCD using the 
+    //    copy_to_lcd() function.
+    //
+    //  - Pixel locations are zero-based meaning a value of zero is the 
+    //    smallest possible value and the largest value is the width/height
+    //    (in pixels) less one.
+    //
+    //  - The origin (X=0,Y=0) point is in the upper left corner of the screen
+    //    with X increasing to the right and Y increasing downward.
+    //
+    //  - If the given pixel location is outside the boundaries of the
+    //    LCD, nothing happens.
     virtual void pixel(int x, int y,int colour);
 
+
+    // Copy the internally-stored buffer to the LCD. This effectively updates what is
+    // shown/displayed on the LCD.
+    //
+    // Arguments:
+    //    None
+    //
+    // Returns:
+    //    Nothing
+    void copy_to_lcd(void);
+
+
+    // Clear the LCD screen
+    //
+    // Arguments:
+    //    None
+    //
+    // Returns:
+    //    Nothing
+    virtual void cls(void);
+
+
+    // END: Functions Relevant to ENGO 333 Lab #8
+    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    
+
     /** draw a circle
       *
       * @param x0,y0 center
@@ -130,17 +190,10 @@
       */
     void fillrect(int x0, int y0, int x1, int y1, int colour);
 
-    /** copy display buffer to lcd
-      *
-      */
-
-    void copy_to_lcd(void);
 
     /** set the orienation of the screen
       *
       */
-
-
     void set_contrast(unsigned int o);
 
     /** read the contrast level
@@ -148,18 +201,12 @@
       */
     unsigned int get_contrast(void);
 
-
     /** invert the screen
       *
       * @param o = 0 normal, 1 invert
       */
     void invert(unsigned int o);
 
-    /** clear the screen
-       *
-       */
-    virtual void cls(void);
-
     /** set the drawing mode
       *
       * @param mode NORMAl or XOR