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.
45 lines
727 B
45 lines
727 B
#include <stdarg.h>
|
|
|
|
#include "watchos.h"
|
|
|
|
Kernel* watchos::s_kernel = nullptr;
|
|
|
|
void watchos::initialize()
|
|
{
|
|
Serial.begin(115200);
|
|
}
|
|
|
|
Kernel* watchos::kernel()
|
|
{
|
|
if (s_kernel == nullptr)
|
|
{
|
|
s_kernel = new Kernel();
|
|
}
|
|
return s_kernel;
|
|
}
|
|
|
|
void watchos::panic(char* fmt...)
|
|
{
|
|
Serial.println("PANIC PANIC PANIC");
|
|
va_list args;
|
|
char msg[512];
|
|
va_start(args, fmt);
|
|
vsprintf(msg, fmt, args);
|
|
va_end(args);
|
|
Serial.println(msg);
|
|
delay(3000);
|
|
Serial.println("Resetting...");
|
|
ESP.restart();
|
|
}
|
|
|
|
void watchos::debug(char* fmt...)
|
|
{
|
|
#ifdef WATCHOS_DEBUG
|
|
va_list args;
|
|
char msg[512];
|
|
va_start(args, fmt);
|
|
vsprintf(msg, fmt, args);
|
|
va_end(args);
|
|
Serial.println(msg);
|
|
#endif
|
|
}
|