This program consists of the software developed for the ELEC5870M Individual Project. It runs on the mbed LPC1768. It uses the mbed RTOS to perform the following tasks: - Implements intuitive GUI with buttons, LCD TFT Display and LEDs. - Serial Communication with the RPi - I2C communication with INA219 voltage current sensors - Power control at the USB ports

Dependencies:   Adafruit_GFX Adafruit_ST7735 INA219 MODSERIAL MbedJSONValue mbed-rtos mbed

Revision:
3:7666de697752
Child:
4:c7b0670f96b2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Screens/OutputScreen.h	Sat Feb 04 20:17:44 2017 +0000
@@ -0,0 +1,134 @@
+#ifndef OUTPUTSCREEN_H
+#define OUTPUTSCREEN_H
+
+#include "ListController.h"
+
+class OutputScreen:public Button <OutputScreen>
+{
+public:
+    OutputScreen(uint16_t backgroundColor);
+    int start();
+    void buttonPressed(int button);
+
+private:
+    void drawOutputScreen();
+    void drawTile();
+
+    int changeScreen;
+    ListController *list;   // manages the list
+    bool scroll;    // updated when a scroll event occurs
+    bool enter;     // updated when an enter event occurs
+    uint16_t bgColor;   // background color
+
+};
+
+OutputScreen::OutputScreen(uint16_t backgroundColor)
+{
+
+    bgColor = backgroundColor;
+}
+
+int OutputScreen::start()
+{
+
+    // draw the screen
+    drawOutputScreen();
+
+    // attach interrupts to buttons
+    Button<OutputScreen>::activateButtons(this);
+
+    changeScreen = 0;
+    scroll = false;
+    enter = false;
+
+
+    while (changeScreen == 0) {
+        //updateTile();
+
+        // scroll event occured
+        if (scroll) {
+            // perform scroll on the list
+            list->scroll();
+            // reset variable
+            scroll = false;
+        }
+
+        // enter event occured
+        if (enter) {
+            // read the current option on the list
+            changeScreen = list->getCurrentOption();
+        }
+        //wait_ms(500);
+        Thread::wait(200);
+    }
+
+    // release the memory held by the list
+    delete list;
+
+    // dettach interrupts to buttons
+    Button<OutputScreen>::deActivateButtons();
+
+    return changeScreen;
+}
+
+
+void OutputScreen::drawOutputScreen()
+{
+
+    // draw the tile
+    drawTile();
+
+    // construct the list
+    list = new ListController( 0,
+                               63,
+                               "Output",
+                               "Raspberry Pi",
+                               "Utility Port",
+                               "",
+                               "",
+                               backgroundColor,
+                               2);
+
+
+    // draw the list
+    list->drawList();
+    //Button<BatteriesScreen>::activateButtons();
+}
+
+void OutputScreen::drawTile()
+{
+    // draw the tile background
+    tft.fillRect(0,0,tft.width(),63,ST7735_YELLOW);
+
+    // the design of this tile is pending
+    tft.setCursor(5,5);
+    tft.setTextSize(1);
+    tft.setTextColor(ST7735_RED);
+    tft.printf("To be designed!...");
+}
+
+void OutputScreen::buttonPressed(int button)
+{
+    switch(button) {
+
+        case BACKBUTTON:
+            // navigate to the previous screen
+            changeScreen = -1;
+            break;
+
+        case SCROLLBUTTON:
+            // scroll to the next option
+            scroll = true;
+            break;
+
+        case ENTERBUTTON:
+            // navigate to the selected option
+            //changeScreen = ListController::getCurrentOption();
+
+        default:
+            // do nothing
+            break;
+    }
+}
+
+#endif
\ No newline at end of file