//#DOC Main, program entry and main loop
#include "main.h"
#include <otSerial.h>
#include <otTimer.h>
#include <otMalloc.h>
#include <otPrintf.h>
#include <otDisplay.h>
#include <otILI9341.h>
//#define DTYPE otDisplay::D_7SEGMENT
#define DTYPE otDisplay::D_NIXIE
otDisplay dsp[4];
otILI9341 tft;
void setup()
{
UartEnableSignals(UART0);
UartSetBaud(UART0, 115200);
_initMalloc();
setStdout(4096, UART0); // printf output is now directed on UART0
tft.init();
tft.setRotation(otILI9341::IR_270);
tft.clear();
DelayMs(1000);
if(!dsp[0].init(DTYPE, 0, "%05d", &tft))
{
printf("You must add one or multiple defines to the project!\n");
printf("Use: SEVEN_SEGMENT_0 or SEVEN_SEGMENT_1, ... SEVEN_SEGMENT_3\n");
IDLE;
}
dsp[1].init(DTYPE, 1, "%05d", &tft);
dsp[2].init(DTYPE, 2, "%05d", &tft);
dsp[3].init(DTYPE, 3, "%05d", &tft);
}
void loop()
{
int ys;
for(int i = 0; i < 10000; i++)
{
ys = 5;
dsp[0].display(i, 20, ys);
ys += dsp[0].verSize() + 5;
dsp[1].display(i, 20, ys);
ys += dsp[1].verSize() + 5;
dsp[2].display(i, 20, ys);
ys += dsp[2].verSize() + 5;
dsp[3].display(i, 20, ys);
}
}