example marix 8x8

Dependencies:   MAX7219 mbed

Fork of 00_LAB_matrix8x8_SPI by ferney alberto beltran molina

Files at this revision

API Documentation at this revision

Comitter:
burked01
Date:
Mon Nov 06 11:57:05 2017 +0000
Parent:
3:4a8de2f71ed0
Commit message:
h

Changed in this revision

MAX7219.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4a8de2f71ed0 -r 8f0d7520027d MAX7219.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MAX7219.lib	Mon Nov 06 11:57:05 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/Maxim-Integrated/code/MAX7219/#b5e4379a3d90
diff -r 4a8de2f71ed0 -r 8f0d7520027d main.cpp
--- a/main.cpp	Thu Mar 16 22:56:47 2017 +0000
+++ b/main.cpp	Mon Nov 06 11:57:05 2017 +0000
@@ -1,11 +1,11 @@
 
 #include "mbed.h"
-//#include "max7219.h"
+#include "max7219.h"
 
 // ***************************************************************************
 // option 1 : use  SPI
 // ***************************************************************************
-SPI deviceM(PB_15, PB_14, PB_13);
+/*SPI deviceM(PA_7, PA_6, PA_5);
 DigitalOut ssel (PB_12);
 
 #define  uint8_t unsigned char
@@ -100,43 +100,79 @@
                     while(1){
                         print_Snake();
                         }
-}
+}*/
 // ***************************************************************************
-// option two: use maz7219 library
+// option two: use max7219 library
 
 // ***************************************************************************    
-/*
-Max7219 deviceM(PB_15, PB_14, PB_13, PB_12);
+
+
+ Max7219 max7219(PA_7, PA_6, PA_5, D2);
+
+ int main()
+ {
+     max7219_configuration_t cfg = {
+         .device_number = 1,
+         .decode_mode = 3,
+         .intensity = Max7219::MAX7219_INTENSITY_5,
+         .scan_limit = Max7219::MAX7219_SCAN_8
+     };
+
+     max7219.init_device(cfg);
+     max7219.enable_device(1);
+     max7219.set_display_test();
+     wait(1);
+     max7219.clear_display_test();
+
+
+
+
 
 
-int main() {
-    
-    max7219_configuration_t cfg = {
-    .device_number = 1,
-    .decode_mode = 0,
-    .intensity = Max7219::MAX7219_INTENSITY_8,
-    .scan_limit = Max7219::MAX7219_SCAN_8
-};
-   
-    deviceM.init_device(cfg);
-    
-    deviceM.enable_device(1);
-   
-    deviceM.set_display_test();
-    wait(1);   
-   deviceM.clear_display_test();
-    wait(1);
-  
+     
     while(1){
-         deviceM.write_digit(1,8,0b11111111);
-         deviceM.write_digit(1,1,0b01010101);
-         deviceM.write_digit(1,2,0b10101010);
-         deviceM.write_digit(1,3,0b01010101);
-         deviceM.write_digit(1,4,0b10101010);
-         deviceM.write_digit(1,5,0b01010101);
-         deviceM.write_digit(1,6,0b10101010);
-         deviceM.write_digit(1,7,0b01010101);
+         
+         max7219.write_digit(1,1,0b01010101);
+         max7219.write_digit(1,2,0b10101010);
+         max7219.write_digit(1,3,0b01010101);
+         max7219.write_digit(1,4,0b10101010);
+         max7219.write_digit(1,5,0b01010101);
+         max7219.write_digit(1,6,0b10101010);
+         max7219.write_digit(1,7,0b01010101);
+         max7219.write_digit(1,8,0b11001100);
+         
+         
+         max7219.write_digit(2,1,0b01010101);
+         max7219.write_digit(2,2,0b10101010);
+         max7219.write_digit(2,3,0b01010101);
+         max7219.write_digit(2,4,0b10101010);
+         max7219.write_digit(2,5,0b01010101);
+         max7219.write_digit(2,6,0b10101010);
+         max7219.write_digit(2,7,0b01010101);
+         max7219.write_digit(2,8,0b11001100);
+         
+         
+         max7219.write_digit(3,1,0b01010101);
+         max7219.write_digit(3,2,0b10101010);
+         max7219.write_digit(3,3,0b01010101);
+         max7219.write_digit(3,4,0b10001010);
+         max7219.write_digit(3,5,0b01010101);
+         max7219.write_digit(3,6,0b10101010);
+         max7219.write_digit(3,7,0b01010101);
+         max7219.write_digit(3,8,0b11001100);
+         
+         
+         max7219.write_digit(4,1,0b01010101);
+         max7219.write_digit(4,2,0b10101010);
+         max7219.write_digit(4,3,0b01010101);
+         max7219.write_digit(4,4,0b10101010);
+         max7219.write_digit(4,5,0b01011101);
+         max7219.write_digit(4,6,0b10101010);
+         max7219.write_digit(4,7,0b01010101);
+         max7219.write_digit(4,8,0b11001100);
+         ;
+        
         }
 }
-*/
 
+