#include <DMD32.h>
#include <fonts/SystemFont5x7.h>
#include <fonts/Arial_Black_16_ISO_8859_1.h>
//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
#define LED_BUILTIN 2
static const int spiClk = 1000000; // 1 MHz
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
//Timer setup
//create a hardware timer of ESP32
hw_timer_t * timer = NULL;
SPIClass *vspi = NULL;
void IRAM_ATTR triggerScan()
{
dmd.scanDisplayBySPI();
}
// void spiCommand(SPIClass *spi, byte data) {
// //use it as you would the regular arduino SPI API
// spi->beginTransaction(SPISettings(spiClk, MSBFIRST, SPI_MODE0));
// spi->transfer(data);
// spi->endTransaction();
// }
void setup(void)
{
vspi = new SPIClass(VSPI);
vspi->begin();
pinMode(PIN_DMD_A, OUTPUT);
digitalWrite(PIN_DMD_A, HIGH);
pinMode(PIN_OTHER_SPI_nCS, OUTPUT); //VSPI SS
digitalWrite(PIN_OTHER_SPI_nCS,HIGH);
timer = timerBegin(1000000);
timerAttachInterrupt(timer,&triggerScan);
timerAlarm(timer,300,true,0);
//clear/init the DMD pixels held in RAM
dmd.clearScreen( false ); //true is normal (all pixels off), false is negative (all pixels on)
Serial.begin(115200);
}
void loop(void)
{
// dmd.clearScreen( false );
// delay(500);
// dmd.clearScreen( true );
// delay(500);
dmd.selectFont(Arial_Black_16_ISO_8859_1);
// Français, Österreich, Magyarország
const char *MSG = "anakkendali.com";
dmd.drawMarquee(MSG,strlen(MSG),(32*DISPLAYS_ACROSS)-1,0);
long start=millis();
long timer=start;
while(1){
if ((timer+30) < millis()) {
dmd.stepMarquee(-1,0);
timer=millis();
}
}
}