nucleo_spi_max7219_led8x8

Dependencies:   MAX7219 mbed

Fork of 06_spi_max7219_led8x8 by hobbielektronika

Revision:
1:e065a60fea05
Parent:
0:bd34a367f642
--- a/main.cpp	Tue Nov 24 06:41:43 2015 +0000
+++ b/main.cpp	Wed Nov 02 02:46:17 2016 +0000
@@ -1,21 +1,23 @@
-/* 06_spi_max7219_led8x8
- *
+/* nucleo_spi_max7219_led8x8
+ * 
  * Simple demo to drive a 8x8-as LED matrix by a MAX7219 LED driver IC
  * After initialisation two characters (H and W) are displayed alternatively.
  * The MAX7219 IC is driven by hardware SPI: SPI0 module at PTD1, PTD2, PTD3.
  */
 
 #include "mbed.h"
-
-SPI spi(PTD2, PTD3, PTD1);          // Arduino compatible MOSI, MISO, SCLK
-DigitalOut cs(PTD0);                // Chip select
+//#include "max7219.h" //此头文件未使用
+ SPI spi(D11, D12, D13);          // Arduino compatible MOSI, MISO, SCLK
+//nucleo MOSI, MISO, SCLK
+//      PTD2, PTD3, PTD1   
+DigitalOut cs(D10);                // Chip select
 
 const unsigned char led1[]= {
-    0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0xFF
-};  //H
+    0x0,0x66,0x99,0x81,0x42,0x24,0x18,0x0
+};  //心
 const unsigned char led2[]= {
-    0x1F,0x60,0x80,0x40,0x40,0x80,0x60,0x1F
-};  //W
+    0x3C,0x24,0x24,0xFF,0xFF,0x24,0x24,0x3C
+};  //中
 
 /// Send two bytes to SPI bus
 void SPI_Write2(unsigned char MSB, unsigned char LSB)
@@ -53,6 +55,7 @@
     spi.format(8,0);                // 8-bit format, mode 0,0
     spi.frequency(1000000);         // SCLK = 1 MHz
     Init_MAX7219();                 // Initialize the LED controller
+    
     while (1) {
         for(int i=1; i<9; i++)      // Write first character (8 rows)
             SPI_Write2(i,led1[i-1]);
@@ -62,9 +65,3 @@
         wait(1);                    // 1 sec delay
     }
 }
-
-
-
-
-
-