-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfloraOS.cpp
82 lines (57 loc) · 1.65 KB
/
floraOS.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "floraOS.h"
#include "homePanel.h"
#include "controlPanel.h"
#include "loggingPanel.h"
#include "src/sTerm/sTerm.h"
#define PLANTBOT_BAUD 9600 //115200 //500000
// *****************************************************
// floraOS
// *****************************************************
// Our global OS.
floraOS ourOS;
// Create it..
floraOS::floraOS(void) { }
// Delete it..
floraOS::~floraOS(void) { }
// Possibly we'll need to do something during startup.
// cellOS uses this to tweak its color pallette.
int floraOS::begin(void) {
ourComPort.begin(PLANTBOT_BAUD);
pinMode(BEEP_PIN, OUTPUT);
digitalWrite(BEEP_PIN, HIGH); //Means off.
return lilOS::begin();
}
// Used to create our custom panels..
panel* floraOS::createPanel(int panelID) {
pauseUpdates x;
beep();
switch (panelID) {
case homeApp :
ourComPort.disableBG(false);
return new homeScreen();
case controlApp :
ourComPort.disableBG(false);
return new controlPanel();
//case calcApp : return new rpnCalc();
case loggingApp :
ourComPort.disableBG(false);
return new loggingPanel();
case sTermApp :
ourComPort.disableBG(false);
return new sTermPanel();
/*
case breakoutApp :
ourComPort.disableBG(true);
return new breakout();
*/
default : return NULL;
}
}
void floraOS::beep() { tone(BEEP_PIN, 500,35); }
// Just in case we need it, here it is..
void floraOS::idle(void) { }
void floraOS::loop(void) {
lilOS::loop(); // Let our default actions run.
ourComPort.updateTime(); // Give our background process a kick.
}
// Globals