File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ /* -*- C++ -*- */
2+ /* *************
3+ Jan. 2018 Rui Azevedo - ruihfazevedo(@rrob@)gmail.com
4+
5+ I2C keypad driver
6+ using
7+ https://github.com/whatnick/i2ckeypad
8+
9+ Note: you may be need to adjust keypad-to-pcf8574 pin mappings and keymap in i2ckeypad.cpp for your specific keypad.
10+
11+ ***/
12+
13+ #ifndef RSITE_I2CKEYPAD_DEF_H
14+ #define RSITE_I2CKEYPAD_DEF_H
15+ #include " ../menuDefs.h"
16+
17+ #include < i2ckeypad.h>
18+ namespace Menu {
19+
20+ class I2CkeypadIn :public menuIn {
21+ public:
22+ char key=0 ;
23+ i2ckeypad * in;
24+ I2CkeypadIn (i2ckeypad * in):in(in) {}
25+ int available (void ) {
26+ return peek ()!=0 ;
27+ }
28+ int peek (void ) {
29+ return key != 0 ? key : (key=in->get_key ()) ?key : 0 ;
30+ }
31+ int read () {
32+ if (key != 0 ) {
33+ char k=key;
34+ key=0 ;
35+ return k;
36+ }
37+ return available ()?read ():0 ;
38+ }
39+ void flush () {}
40+ size_t write (uint8_t v) {return 0 ;}
41+ };
42+ };
43+ #endif
You can’t perform that action at this time.
0 commit comments