Provides a multiplexed dual seven segment display driver used by RenBED

Dependents:   RenBuggy RenBEDCounter RenBEDHelloWorld AmpBoardTest ... more

Files at this revision

API Documentation at this revision

Comitter:
jf1452
Date:
Wed Feb 05 10:36:35 2014 +0000
Parent:
4:74572124e539
Commit message:
Added better Int support

Changed in this revision

SevenSegmentDisplay.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 74572124e539 -r cb7339a2e196 SevenSegmentDisplay.cpp
--- a/SevenSegmentDisplay.cpp	Tue Jan 21 13:31:34 2014 +0000
+++ b/SevenSegmentDisplay.cpp	Wed Feb 05 10:36:35 2014 +0000
@@ -99,18 +99,30 @@
     uint8_t Digits[6];
     uint8_t Counter;
     int     TempValue;
+    int     StartDigit = 0;
 
     TempValue = iDisplayValue;
     for (Counter = 5; Counter > 0; Counter--) {
         Digits[Counter] = TempValue % 10;
         TempValue   = (int)(TempValue / 10);
     }
-    Digits[0] = 36;
+    Digits[0] = 0;
+    Digits[5] += 0x80;
+
+    for (Counter = 0; Counter < 6; Counter++) {
+        if (Digits[Counter] == 0)
+            Digits[Counter] = 36;
+        else
+        {
+            StartDigit = Counter & 0xFE;
+            break;
+        }
+    }
 
     D_ui8LeftDigit  = Digits[iSequence++];
     D_ui8RightDigit = Digits[iSequence++];
     if (iSequence == 6)
-        iSequence = 0;
+        iSequence = StartDigit;
 }
 
 /*******************************************************************************
@@ -268,7 +280,12 @@
 void SevenSegmentDisplay::DisplayInt(int iValue)
 {
     iDisplayValue = iValue;
-    iSequence = 0;
+    if (iValue > 9999)
+        iSequence = 0;
+    else if (iValue > 99)
+        iSequence = 2;
+    else
+        iSequence = 4;
 }
 
 /*******************************************************************************