2013-04-05 16:41:21 +00:00
|
|
|
/*
|
|
|
|
Serial Adapter Project: Dynamic serial TTY passthroughs
|
|
|
|
by: Mike Crosson
|
|
|
|
Nusku Networks
|
|
|
|
date: 2013/03/09
|
|
|
|
license: CC-BY SA 3.0 - Creative commons share-alike 3.0
|
|
|
|
use this code however you'd like, just keep this license and
|
|
|
|
attribute.
|
|
|
|
*/
|
2013-04-06 23:21:06 +00:00
|
|
|
|
2013-04-17 23:59:03 +00:00
|
|
|
#ifndef UILCD_h
|
|
|
|
#define UILCD_h
|
|
|
|
|
2013-04-06 23:21:06 +00:00
|
|
|
#include "Arduino.h"
|
|
|
|
|
|
|
|
#include <Adafruit_GFX.h>
|
|
|
|
#include <Adafruit_ST7735.h>
|
|
|
|
#include <SD.h>
|
|
|
|
#include <SPI.h>
|
|
|
|
|
|
|
|
#include "Project.h"
|
2013-04-07 00:42:58 +00:00
|
|
|
#include "UIJoystickPSP.h"
|
2013-04-07 03:20:17 +00:00
|
|
|
#include "Config.h"
|
2013-04-06 23:21:06 +00:00
|
|
|
|
2013-04-17 23:59:03 +00:00
|
|
|
// Forward declaration of Config
|
|
|
|
class Config;
|
2013-04-06 23:21:06 +00:00
|
|
|
|
|
|
|
#define BUFFPIXEL 20
|
|
|
|
|
2013-04-07 00:42:58 +00:00
|
|
|
enum screen {
|
|
|
|
splashScreen,
|
2013-04-07 02:24:15 +00:00
|
|
|
mainScreen,
|
|
|
|
connectionScreen,
|
|
|
|
lineSpeedScreen,
|
2013-04-07 04:49:23 +00:00
|
|
|
voltageScreen,
|
|
|
|
timeoutscreen
|
2013-04-07 00:42:58 +00:00
|
|
|
};
|
|
|
|
|
2013-04-06 23:21:06 +00:00
|
|
|
class UILCD {
|
|
|
|
private:
|
|
|
|
Adafruit_ST7735* tft;
|
2013-04-07 03:20:17 +00:00
|
|
|
Config* config;
|
2013-04-06 23:21:06 +00:00
|
|
|
|
2013-04-07 02:24:15 +00:00
|
|
|
int currentLine;
|
2013-04-07 00:42:58 +00:00
|
|
|
screen currentScreen;
|
|
|
|
|
2013-04-06 23:21:06 +00:00
|
|
|
uint32_t read32(File f);
|
|
|
|
uint16_t read16(File f);
|
|
|
|
|
2013-04-07 00:52:37 +00:00
|
|
|
void drawSplashScreen();
|
|
|
|
void drawMainScreen();
|
2013-04-07 03:20:17 +00:00
|
|
|
void drawConnectionScreen(bool keepCurrentLine);
|
|
|
|
void drawLineSpeedScreen(bool keepCurrentLine);
|
|
|
|
void drawVoltageScreen(bool keepCurrentLine);
|
2013-04-07 04:49:23 +00:00
|
|
|
void drawTimeoutScreen(bool keepCurrentLine);
|
2013-04-07 00:42:58 +00:00
|
|
|
void hilightLine(int line);
|
|
|
|
void unHilightLine(int line);
|
|
|
|
void mainScreenHilight(joyDirection direction);
|
2013-04-07 02:24:15 +00:00
|
|
|
void configScreenHighlight(joyDirection direction);
|
|
|
|
void mainScreenOkButton();
|
|
|
|
void mainScreenCancelButton();
|
2013-04-07 00:42:58 +00:00
|
|
|
|
2013-04-06 23:21:06 +00:00
|
|
|
public:
|
2013-04-07 03:20:17 +00:00
|
|
|
UILCD(Config* config);
|
2013-04-06 23:21:06 +00:00
|
|
|
void bmpDraw(char *filename, uint8_t x, uint8_t y);
|
2013-04-07 00:42:58 +00:00
|
|
|
void handleJoystickEvent(joyDirection aDirection);
|
2013-04-07 02:24:15 +00:00
|
|
|
void handleOkButtonEvent();
|
|
|
|
void handleCancelButtonEvent();
|
2013-04-07 05:32:42 +00:00
|
|
|
void turnOff();
|
|
|
|
void turnOn();
|
|
|
|
void start();
|
2013-04-06 23:21:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|