Born on Stahl's Birthday.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

58 lines
1.1 KiB

#include "dizzy.hh"
ld::DaisySeed seed{};
struct Time {
Time()
{
msec = seed.system.GetNow();
usec = seed.system.GetUs();
tick = seed.system.GetTick();
}
u32 msec;
u32 usec;
u32 tick;
};
std::string to_string(Time &obj)
{
std::string ret{ "Time: " };
ret += std::to_string(obj.msec);
ret += " / ";
ret += std::to_string(obj.usec);
ret += " / ";
ret += std::to_string(obj.tick);
return ret;
}
void print_uptime(u32 time)
{
Time t{};
std::string str{ to_string(t) + "\n\r" };
dz::Console::tx(str.c_str(), str.size());
}
dz::PeriodicTaskCT<print_uptime, 1000> task1{};
int main(void)
{
seed.Init();
dz::Console::init();
while (!dz::Console::has_next()) {};
std::string motd{ "dizzy console\n" };
dz::Console::tx(motd.c_str(), motd.size());
while (true) {
Time time_mainloop_begin{};
while (dz::Console::has_next()) {
char b = dz::Console::rx();
dz::Console::tx(&b, 1);
}
task1.run_pending(time_mainloop_begin.msec);
}
}