7 Segment LED Displaydriver, I2C interface, SAA1064

Dependents:   812_hello

Files at this revision

API Documentation at this revision

Comitter:
wim
Date:
Mon Sep 23 19:23:34 2013 +0000
Parent:
1:79cb73f852da
Commit message:
Documentation updated

Changed in this revision

SAA1064.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 79cb73f852da -r 970360b29a2a SAA1064.cpp
--- a/SAA1064.cpp	Tue Sep 10 19:59:35 2013 +0000
+++ b/SAA1064.cpp	Mon Sep 23 19:23:34 2013 +0000
@@ -4,6 +4,7 @@
  * Released under the MIT License: http://mbed.org/license/mit
  *
  * version 0.2 Initial Release
+ * version 0.3 Improved Leading Zero suppress for writeInt 
 */
 #include "mbed.h"
 #include "SAA1064.h"
@@ -80,7 +81,7 @@
     // value 0...9999
     digit_value = value/1000; // compute thousands
     value = value % 1000;     // compute remainder
-    if ((digit_value==0)&& leading)
+    if ((digit_value==0) && !(dp_digit==1) && leading )
       data[1] = SAA1064_BLNK;               // suppress leading zero    
     else {
       data[1] = SAA1064_SEGM[digit_value];
@@ -91,7 +92,7 @@
     
     digit_value = value/100;  // compute hundreds
     value = value % 100;      // compute remainder
-    if ((digit_value==0) && leading)
+    if ((digit_value==0) && !(dp_digit==2) && leading)
       data[2] = SAA1064_BLNK;               // suppress leading zero    
     else {
       data[2] = SAA1064_SEGM[digit_value];
@@ -101,7 +102,7 @@
     
     digit_value = value/10;   // compute tens
     value = value % 10;       // compute remainder
-    if ((digit_value==0) && leading)
+    if ((digit_value==0) && !(dp_digit==3) && leading)
       data[3] = SAA1064_BLNK;               // suppress leading zero    
     else {
       data[3] = SAA1064_SEGM[digit_value];
@@ -122,7 +123,7 @@
           
     digit_value = value/100;  // compute hundreds
     value = value % 100;      // compute remainder
-    if ((digit_value==0) && leading)
+    if ((digit_value==0) && !(dp_digit==2) && leading)
       data[2] = SAA1064_BLNK;               // suppress leading zero    
     else {
       data[2] = SAA1064_SEGM[digit_value];
@@ -132,7 +133,7 @@
         
     digit_value = value/10;   // compute tens
     value = value % 10;       // compute remainder
-    if ((digit_value==0) && leading)
+    if ((digit_value==0) && !(dp_digit==3) && leading)
       data[3] = SAA1064_BLNK;               // suppress leading zero    
     else {
       data[3] = SAA1064_SEGM[digit_value];