Simple library for interfacing to Nokia 5110 LCD display (as found on the SparkFun website). revised to clear a circle when required with typecirc integer

Dependents:   L2_2645_project Space_Teroid_Game

Fork of N5110 by Craig Evans

Files at this revision

API Documentation at this revision

Comitter:
wray2303
Date:
Fri May 08 09:39:21 2015 +0000
Parent:
20:ba8addc061ea
Commit message:
updated library;

Changed in this revision

N5110.cpp Show annotated file Show diff for this revision Revisions of this file
N5110.h Show annotated file Show diff for this revision Revisions of this file
--- a/N5110.cpp	Thu Apr 23 18:57:52 2015 +0000
+++ b/N5110.cpp	Fri May 08 09:39:21 2015 +0000
@@ -298,8 +298,9 @@
 
 }
 
-// function to draw circle
-void N5110:: drawCircle(int x0,int y0,int radius,int fill)
+
+
+void N5110:: drawCircle(int x0,int y0,int radius,int fill,int typecirc)
 {
     // from http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
     int x = radius;
@@ -308,6 +309,7 @@
 
     while(x >= y) {
 
+if (typecirc == 1){
         // if transparent, just draw outline
         if (fill == 0) {
             setPixel( x + x0,  y + y0);
@@ -327,7 +329,28 @@
             drawLine(y+x0,-x+y0,-y+x0,-x+y0,type);
             drawLine(x+x0,-y+y0,-x+x0,-y+y0,type);
         }
+        }
+        else
+{
+    if (fill == 0) {
+            clearPixel( x + x0,  y + y0);
+            clearPixel(-x + x0,  y + y0);
+            clearPixel( y + x0,  x + y0);
+            clearPixel(-y + x0,  x + y0);
+            clearPixel(-y + x0, -x + y0);
+            clearPixel( y + x0, -x + y0);
+            clearPixel( x + x0, -y + y0);
+            clearPixel(-x + x0, -y + y0);
+        } else {  // drawing filled circle, so draw lines between points at same y value
 
+            int type = (fill==1) ? 1:0;  // black or white fill
+
+            drawLine(x+x0,y+y0,-x+x0,y+y0,type);
+            drawLine(y+x0,x+y0,-y+x0,x+y0,type);
+            drawLine(y+x0,-x+y0,-y+x0,-x+y0,type);
+            drawLine(x+x0,-y+y0,-x+x0,-y+y0,type);
+        }
+        }
 
         y++;
         if (radiusError<0) {
--- a/N5110.h	Thu Apr 23 18:57:52 2015 +0000
+++ b/N5110.h	Fri May 08 09:39:21 2015 +0000
@@ -290,7 +290,7 @@
     *   @param  radius - radius of circle in pixels
     *   @param  fill - 0 transparent (w/outline), 1 filled black, 2 filled white (wo/outline)
     */
-    void drawCircle(int x0,int y0,int radius,int fill);
+    void drawCircle(int x0,int y0,int radius,int fill, int typecirc);
 
     /** Draw Line
     *