#include "system.h"
#include "hd44780.h"
char * buf[10];
uint32_t stamp = 0;
uint16_t framecount = 0;
uint16_t fps = 0;
void setup() {
hd44780_enable(PinB2, PinB1, PinB0, PortD);
}
void loop() {
uint32_t now = system_ms();
if (now % 1000 < stamp % 1000) {
fps = framecount;
framecount = 0;
}
stamp = now;
framecount++;
sprintf(&buf, "time: %05lu", system_ms());
hd44780_print(0, 0, buf);
sprintf(&buf, "FPS: %u", fps);
hd44780_print(0, 1, buf);
}