Bird Techstep / MAX72XX

Fork of MAX72XX by Bird Techstep

Files at this revision

API Documentation at this revision

Comitter:
techstep
Date:
Wed Aug 06 03:14:28 2014 +0000
Parent:
2:8662e8d7d8fa
Commit message:
MAX7219; MAX7221

Changed in this revision

MAX72XX.cpp Show annotated file Show diff for this revision Revisions of this file
MAX72XX.h Show annotated file Show diff for this revision Revisions of this file
--- a/MAX72XX.cpp	Mon Aug 04 12:11:51 2014 +0000
+++ b/MAX72XX.cpp	Wed Aug 06 03:14:28 2014 +0000
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * Type : C++
  * File : MAX72XX.cpp
- * Dec. : MAX7219 & MAX7221 Software SPI library
+ * Dec. : MAX7219 & MAX7221 Software SPI library [7 SEGMENT]
  * Copyright (c) 2013-2014, Bird Techstep, tbird_th@hotmail.com
  *
- * Remark Original codr from LedControl Library [Arduino]
+ * Remark : Original codr from LedControl Library [Arduino]
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -24,7 +24,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  *****************************************************************************/
-#include "mbed.h"
 #include "MAX72XX.h"
 
 #define LOW  0
@@ -75,14 +74,11 @@
     for(int i=0;i<64;i++) 
     status[i] = 0x00;
     for(int i=0;i<maxDevices;i++) {
-        spiTransfer(i,OP_DISPLAYTEST,0);
-        //scanlimit is set to max on startup
-        setScanLimit(i,7);
-        //decode is done in source
-        spiTransfer(i,OP_DECODEMODE,0);
+        spiTransfer(i,OP_DISPLAYTEST,0);    // Display test off on startup
+        setScanLimit(i,7);                  // Scanlimit is set to max on startup
+        spiTransfer(i,OP_DECODEMODE,0);     // Decode-mode is done in source
         clearDisplay(i);
-        //we go into shutdown-mode on startup
-        shutdown(i,true);
+        shutdown(i,true);                   // We go into shutdown-mode on startup
     }
 }
 
@@ -227,8 +223,7 @@
     offset = addr*8;
     index  = value;
     if(index >127) {
-    //no defined beyond index 127, so we use the space char
-    index = 32;
+    index = 32;         //No defined beyond index 127, so we use the space char
     }
     v = charTable[index];
     if(dp)
--- a/MAX72XX.h	Mon Aug 04 12:11:51 2014 +0000
+++ b/MAX72XX.h	Wed Aug 06 03:14:28 2014 +0000
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * Type : Header
  * File : MAX72XX.h
- * Dec. : MAX7219 & MAX7221 Software SPI library
+ * Dec. : MAX7219 & MAX7221 Software SPI library [7 SEGMENT]
  * Copyright (c) 2013-2014, Bird Techstep, tbird_th@hotmail.com
  *
- * Remark Original codr from LedControl Library [Arduino]
+ * Remark : Original codr from LedControl Library [Arduino]
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -27,6 +27,8 @@
 #ifndef MAX72XX_H
 #define MAX72XX_H
 
+#include "mbed.h"
+
 // Segments to be switched on for characters and digits on 7-Segment Displays
 const static char charTable[128] = {
     0x7E, 0x30, 0x6D, 0x79, 0x33, 0x5B, 0x5F, 0x70, // 0, 1, 2, 3, 4, 5, 6, 7,