Final project repo for ECE 495

Dependencies:   Adafruit_GFX_MBED Adafruit_ILI9341 BurstSPI DS1820 mbed mbed-rtos ltc2991_lib

Revision:
0:7ba4e0775670
Child:
5:c1c710391df2
diff -r 000000000000 -r 7ba4e0775670 display/Display.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/display/Display.cpp	Tue Nov 29 16:56:43 2016 +0000
@@ -0,0 +1,34 @@
+
+
+#include "Adafruit_ILI9341.h"
+#include "Display.h"
+#include "Screen.h"
+
+Display::Display() { };
+
+void Display::set_screens(Screen **screens, int num) {
+    _screens = screens;
+    _num_screens = num;
+    _cur_screen_index = 0;
+    _cur_screen = _screens[_cur_screen_index];
+    _needs_init = 1;
+}
+
+void Display::next_screen() {
+    if (_cur_screen_index == _num_screens - 1) {
+        _cur_screen_index = 0;
+    }
+    else {
+        _cur_screen_index++;
+    }
+    _cur_screen = _screens[_cur_screen_index];
+    _needs_init = 1;
+}
+        
+void Display::update() {
+    if (_needs_init) {
+        _cur_screen->init();
+        _needs_init = 0;
+    }
+    _cur_screen->update(); 
+}