Novo

Dependencies:   mbed

Fork of LukaIElmir by tim003 tim003

Revision:
2:e4d483d82cd8
Child:
3:43648fa57d55
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MatrixSPI.cpp	Mon May 26 12:29:55 2014 +0000
@@ -0,0 +1,20 @@
+#include "MatrixSPI.h"
+
+ void MatrixSPI::setup () {
+        // initiation of the max 7219
+        // SPI setup: 8 bits, mode 0
+        max72_spi.format(8, 0);
+        
+        // going by the datasheet, min clk is 100ns so theoretically 10MHz should work...
+        // max72_spi.frequency(10*MHZ);
+        
+        sendSingle(scanLimit, 0x07);
+        sendSingle(decodeMode, 0x00);  // using an led matrix (not digits)
+        sendSingle(shutdown, 0x01);    // not in shutdown mode
+        sendSingle(displayTest, 0x00); // no display test
+        for (int e=1; e<=8; e++) {    // empty registers, turn all LEDs off
+            sendSingle(e,0);
+        }
+        sendSingle(intensity, 0x0f & 0x0f);    // the first 0x0f is the value you can set
+                                           // range: 0x00 to 0x0f
+}
\ No newline at end of file