Novo

Dependencies:   mbed

Fork of LukaIElmir by tim003 tim003

Committer:
tim003
Date:
Mon May 26 12:29:55 2014 +0000
Revision:
2:e4d483d82cd8
Child:
3:43648fa57d55
LukaIElmir2;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tim003 2:e4d483d82cd8 1 #include "MatrixSPI.h"
tim003 2:e4d483d82cd8 2
tim003 2:e4d483d82cd8 3 void MatrixSPI::setup () {
tim003 2:e4d483d82cd8 4 // initiation of the max 7219
tim003 2:e4d483d82cd8 5 // SPI setup: 8 bits, mode 0
tim003 2:e4d483d82cd8 6 max72_spi.format(8, 0);
tim003 2:e4d483d82cd8 7
tim003 2:e4d483d82cd8 8 // going by the datasheet, min clk is 100ns so theoretically 10MHz should work...
tim003 2:e4d483d82cd8 9 // max72_spi.frequency(10*MHZ);
tim003 2:e4d483d82cd8 10
tim003 2:e4d483d82cd8 11 sendSingle(scanLimit, 0x07);
tim003 2:e4d483d82cd8 12 sendSingle(decodeMode, 0x00); // using an led matrix (not digits)
tim003 2:e4d483d82cd8 13 sendSingle(shutdown, 0x01); // not in shutdown mode
tim003 2:e4d483d82cd8 14 sendSingle(displayTest, 0x00); // no display test
tim003 2:e4d483d82cd8 15 for (int e=1; e<=8; e++) { // empty registers, turn all LEDs off
tim003 2:e4d483d82cd8 16 sendSingle(e,0);
tim003 2:e4d483d82cd8 17 }
tim003 2:e4d483d82cd8 18 sendSingle(intensity, 0x0f & 0x0f); // the first 0x0f is the value you can set
tim003 2:e4d483d82cd8 19 // range: 0x00 to 0x0f
tim003 2:e4d483d82cd8 20 }