Browse Source

Modify test task to store/read count from eeprom

master
Adam Pippin 4 years ago
parent
commit
20f0146820
  1. 29
      watchos.ino

29
watchos.ino

@ -1,5 +1,6 @@
#include <M5StickC.h> #include <M5StickC.h>
#include "Kernel.h" #include "Kernel.h"
#include "EAT.h"
#include "Colours.h" #include "Colours.h"
#include "PowerManagement.h" #include "PowerManagement.h"
@ -10,16 +11,32 @@ int test_func(int pid, unsigned int signal)
{ {
M5.Lcd.fillScreen(TFT_DARKGREY); M5.Lcd.fillScreen(TFT_DARKGREY);
M5.Lcd.setCursor(0, 0); M5.Lcd.setCursor(0, 0);
if (signal & SIGNAL_START) if (signal & SIGNAL_START)
{ {
M5.Lcd.setRotation(3); M5.Lcd.setRotation(3);
M5.Lcd.print("Initializing..."); M5.Lcd.print("Initializing...");
if (EAT_allocate(1, 2))
{
EAT_write(1, 0, 0);
EAT_write(1, 1, 0);
}
else
{
byte count_low = EAT_read(1, 0);
byte count_hi = EAT_read(1, 1);
count = (count_hi << 8) + count_low;
}
} }
if ((signal & SIGNAL_STOP)) // || count == 5) if ((signal & SIGNAL_STOP)) // || count == 5)
{ {
M5.Lcd.print("Stopping"); M5.Lcd.print("Stopping");
EAT_write(1, 0, count & 0xFF);
EAT_write(1, 1, (count >> 8) & 0xFF);
return 255; return 255;
} }
if (signal & SIGNAL_TICK && (signal & SIGNAL_INPUT_A) == 0 && (signal & SIGNAL_INPUT_B) ==0) if (signal & SIGNAL_TICK && (signal & SIGNAL_INPUT_A) == 0 && (signal & SIGNAL_INPUT_B) ==0)
{ {
count++; count++;
@ -44,9 +61,19 @@ void setup()
{ {
M5.begin(); M5.begin();
Kernel_setup(); Kernel_setup();
//Kernel_start(&PowerManagement, 1000); Kernel_start(&PowerManagement, 1000);
Kernel_start(&UserInput, 0); Kernel_start(&UserInput, 0);
Kernel_start(&test_func, 1000); Kernel_start(&test_func, 1000);
M5.update();
if (M5.BtnB.isPressed())
{
EAT_initialize();
}
else
{
EAT_load();
}
} }
void loop() void loop()

Loading…
Cancel
Save