tr

Revision:
33:d80e568a2e18
Parent:
31:8a0c21042f82
Child:
35:2d5931a66fba
--- a/N5110.h	Thu Feb 16 15:41:00 2017 +0000
+++ b/N5110.h	Thu Feb 16 15:58:48 2017 +0000
@@ -32,6 +32,13 @@
 #define HEIGHT 48
 #define BANKS 6
 
+/// Fill types for 2D shapes
+enum FillType {
+    FILL_TRANSPARENT, ///< Transparent with outline
+    FILL_BLACK,       ///< Filled black
+    FILL_WHITE,       ///< Filled white (no outline)
+};
+
 /** N5110 Class
 @brief Library for interfacing with Nokia 5110 LCD display (https://www.sparkfun.com/products/10168) using the hardware SPI on the mbed.
 @brief The display is powered from a GPIO pin meaning it can be controlled via software.  The LED backlight is also software-controllable (via PWM pin).
@@ -151,21 +158,20 @@
 
         lcd.clear();
         // example of how to draw circles
-        lcd.drawCircle(WIDTH/2,HEIGHT/2,20,1);  // x,y,radius,black fill
-        lcd.drawCircle(WIDTH/2,HEIGHT/2,10,2);  // x,y,radius,white fill
-        lcd.drawCircle(WIDTH/2,HEIGHT/2,30,0);  // x,y,radius,transparent with outline
+        lcd.drawCircle(WIDTH/2,HEIGHT/2,20,FILL_BLACK);  // x,y,radius,black fill
+        lcd.drawCircle(WIDTH/2,HEIGHT/2,10,FILL_WHITE);  // x,y,radius,white fill
+        lcd.drawCircle(WIDTH/2,HEIGHT/2,30,FILL_TRANSPARENT);  // x,y,radius,transparent with outline
         lcd.refresh();  // refresh after drawing shapes
         wait(5.0);
 
         lcd.clear();
         // example of how to draw rectangles
         //          origin x,y,width,height,type
-        lcd.drawRect(10,10,50,30,1);  // filled black rectangle
-        lcd.drawRect(15,15,20,10,2);  // filled white rectange (no outline)
-        lcd.drawRect(2,2,70,40,0);    // transparent, just outline
+        lcd.drawRect(10,10,50,30,FILL_BLACK);  // filled black rectangle
+        lcd.drawRect(15,15,20,10,FILL_WHITE);  // filled white rectange (no outline)
+        lcd.drawRect(2,2,70,40,  FILL_TRANSPARENT);    // transparent, just outline
         lcd.refresh();  // refresh after drawing shapes
         wait(5.0);
-
     }
 }
 
@@ -342,15 +348,15 @@
     *   This function draws a circle at the specified origin with specified radius in the screen buffer
     *   Uses the midpoint circle algorithm.
     *   @see http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
-    *   @param  x0 - x-coordinate of centre
-    *   @param  y0 - y-coordinate of centre
+    *   @param  x0     - x-coordinate of centre
+    *   @param  y0     - y-coordinate of centre
     *   @param  radius - radius of circle in pixels
-    *   @param  fill - 0 transparent (w/outline), 1 filled black, 2 filled white (wo/outline)
+    *   @param  fill   - fill-type for the shape
     */
     void drawCircle(unsigned int const x0,
                     unsigned int const y0,
                     unsigned int const radius,
-                    unsigned int const fill);
+                    FillType const     fill);
 
     /** Draw Line
     *
@@ -374,13 +380,13 @@
     *   @param  y0 - y-coordinate of origin (top-left)
     *   @param  width - width of rectangle
     *   @param  height - height of rectangle
-    *   @param  fill - 0 transparent (w/outline), 1 filled black, 2 filled white (wo/outline)
+    *   @param  fill   - fill-type for the shape
     */
     void drawRect(unsigned int const x0,
                   unsigned int const y0,
                   unsigned int const width,
                   unsigned int const height,
-                  unsigned int const fill);
+                  FillType const     fill);
 
 private:
 // methods