Test code for SDA5708 LED matrix display

Dependencies:   SDA5708 mbed

main.cpp

Committer:
wim
Date:
2014-09-29
Revision:
0:7163ac97bad9
Child:
1:bffa08157551

File content as of revision 0:7163ac97bad9:


#include "mbed.h"
#include "SDA5708.h"

// mbed Interface Hardware definitions
DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
DigitalOut heartbeatLED(LED4);

// Host PC Communication channels
Serial pc(USBTX, USBRX);

// SPI Communication
SPI spi_led(p5, NC, p7); // MOSI, MISO, SCLK

//Display
SDA5708 led(&spi_led, p8, p9); // SPI bus, CS pin, RST pin

// Variables for Heartbeat and Status monitoring
Ticker heartbeat;
bool heartbeatflag=false;

// Heartbeat monitor
void pulse() {
  heartbeatLED = !heartbeatLED;
}

void heartbeat_start() {
  heartbeat.attach(&pulse, 0.5);
  heartbeatflag = true;
}

void heartbeat_stop() {
  heartbeat.detach();
  heartbeatflag = false;
}

int main() {
  int cnt;
  
  heartbeat_start();

  led.locate(0, 0);                               

//led.printf("*=%6d", 123456);
//            12345678 
  led.printf("Hi mbed ");  
  wait(2);
  
  cnt=0x20;  
  while(1) {
    wait(0.5);
                        
    led.putc(cnt);
    cnt++;
    if (cnt == 0x80) cnt=0x20;
  }
  
}