-
Notifications
You must be signed in to change notification settings - Fork 1
/
SerLCDOut.h
61 lines (54 loc) · 2.14 KB
/
SerLCDOut.h
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
/**************************************************************************************************
*
* SerLCDOut.h
* Annealer Control Program
* Author: Dave Re
* Inception: 05/25/2020
*
* Output driver for I2C LCD based on SparkFun's SerLCD library. This is essentially a direct lift
* of the Malpartida I2C code, with just the object type and includes changed to reflect that it's
* a SerLCD.
*
* Later, we should see if we can make this generic, and maybe use the provided driver, instead of
* this one? Like, is SerialLCD a child of the Malpartida lcd object?
*
**************************************************************************************************/
#ifndef RSITE_ARDUINO_MENU_LCDOUT
#define RSITE_ARDUINO_MENU_LCDOUT
#ifndef ARDUINO_SAM_DUE
#include "menuDefs.h"
#include <Wire.h>
#include <SerLCD.h>
namespace Menu {
class lcdOut:public cursorOut {
public:
SerLCD* device;
inline lcdOut(SerLCD* o,idx_t *t,panelsList &p,menuOut::styles s=menuOut::minimalRedraw)
:cursorOut(t,p,s),device(o) {}
size_t write(uint8_t ch) override {return device->write(ch);}
void clear() override {
device->clear();
panels.reset();
}
void setCursor(idx_t x,idx_t y,idx_t panelNr=0) override {
const panel p=panels[panelNr];
device->setCursor(p.x+x,p.y+y);
}
idx_t startCursor(navRoot& root,idx_t x,idx_t y,bool charEdit,idx_t panelNr=0) override {return 0;}
idx_t endCursor(navRoot& root,idx_t x,idx_t y,bool charEdit,idx_t panelNr=0) override {return 0;}
idx_t editCursor(navRoot& root,idx_t x,idx_t y,bool editing,bool charEdit,idx_t panelNr=0) override {
trace(MENU_DEBUG_OUT<<"lcdOut::editCursor "<<x<<","<<y<<endl);
//text editor cursor
device->noBlink();
device->noCursor();
if (editing) {
device->setCursor(x, y);
if (charEdit) device->cursor();
else device->blink();
}
return 0;
}
};
}//namespace Menu
#endif
#endif