aboutsummaryrefslogtreecommitdiffstats
path: root/source/controller.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2019-03-25 16:16:18 -0400
committerClyne Sullivan <tullivan99@gmail.com>2019-03-25 16:16:18 -0400
commitf986c858e54d9be72020ae2d7319e70eab6de17d (patch)
tree907147e27f153a8de2738c14cb0bafed27cd9c75 /source/controller.cpp
parent352e0df7d800b033ce24ad1022461f5d1908da93 (diff)
dynamic ui, widgets
Diffstat (limited to 'source/controller.cpp')
-rwxr-xr-xsource/controller.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/source/controller.cpp b/source/controller.cpp
index a364c9d..d9ac961 100755
--- a/source/controller.cpp
+++ b/source/controller.cpp
@@ -2,8 +2,9 @@
#include <bluefruit.h>
-#include "sharp.hpp"
#include "rtc.hpp"
+#include "sharp.hpp"
+#include "widget.hpp"
BLEUart bleuart;
@@ -45,7 +46,8 @@ void setup(void)
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
Serial.println(F("Ready."));
- Sharp::setScreen(RTC::showTime);
+ Sharp::addWidget<TimeWidget>();
+ Sharp::addWidget<NotificationWidget>("Welcome to smartwatch");
}
void loop(void)
@@ -59,18 +61,17 @@ void loop(void)
void handlePacket(void)
{
char buf[64];
- char *p = buf;
- do {
- *p++ = bleuart.read();
- } while (bleuart.available());
- *p = '\0';
+ unsigned int i;
+ for (i = 0; bleuart.available() && i < 63; i++)
+ buf[i] = bleuart.read();
+ buf[i] = '\0';
switch (buf[0]) {
case 'L':
- RTC::setMessage(buf + 1);
+ //RTC::setMessage(buf + 1);
break;
case 'T':
- Serial.println("Setting time!");
+ Sharp::addWidget<NotificationWidget>("Time updated");
RTC::setTicks(std::atoi(buf + 1) * 60);
break;
default: