platform for developing on SQFMI's Watchy
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.5 KiB

/*
Name: watchos2.ino
Created: 6/30/2021 9:38:10 PM
Author: Adam
*/
#include "watchos.h"
#include "Module_RTC.h"
#include "Module_Storage.h"
#include "Module_Power.h"
#include "Module_Input.h"
#include "Task_Test.cpp"
#include "Task_Clock.cpp"
#include "Task_Battery.cpp"
#include <GxEPD2_BW.h>
#include <Fonts/FreeMono12pt7b.h>
#include <DSEG7_Classic_Bold_53.h>
// the setup function runs once when you press reset or power the board
void setup()
{
ulong start = millis();
watchos::initialize();
Kernel* kernel = watchos::kernel();
Module_Storage* storage;
Module_UI* ui;
kernel->registerTask(new Module_RTC(), WATCHOS_MODULE_RTC);
kernel->registerTask(storage = new Module_Storage(), WATCHOS_MODULE_STORAGE);
kernel->registerTask(new Module_Input(), WATCHOS_MODULE_INPUT);
kernel->registerTask(new Module_Power(), WATCHOS_MODULE_POWER);
kernel->registerTask(ui = new Module_UI(), WATCHOS_MODULE_UI);
watchos::run(new Task_Clock());
watchos::run(new Task_Test());
watchos::run(new Task_Battery());
if (!storage->isValid())
{
watchos::debug("Resetting storage");
storage->reset();
}
watchos::debug("Setup done!");
ui->registerFont(0, &FreeMono12pt7b);
ui->registerFont(1, &DSEG7_Classic_Bold_53);
watchos::setup();
ui->setLayoutMode(ui->getRoot(), ui_layout_mode::ABSOLUTE);
watchos::debug("Startup took %d ms", (int)(millis() - start));
}
// the loop function runs over and over again until power down or reset
void loop()
{
watchos::tick();
}