Skip to content

Commit b798fed

Browse files
authored
Merge pull request #124 from reaper7/master
fix esp32 compilation error,
2 parents 9634f34 + dab26f1 commit b798fed

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

src/menuIO/PCF8574KeyIn.h

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22

33
/**************
44
todo: write description
5+
available keys from 0 to 7 correspond with pcf8574 input pins from p0 to p7
6+
7+
example:
8+
9+
#include <menuIO/PCF8574KeyIn.h>
10+
11+
#define K_UP 0
12+
#define K_RIGHT 1
13+
#define K_LEFT 2
14+
#define K_DOWN 3
15+
16+
#define K_ESC 4
17+
#define K_ENTER 5
18+
19+
keyMap myBtn_map[]={
20+
{K_UP,options->getCmdChar(downCmd)},
21+
{K_RIGHT,options->getCmdChar(leftCmd)},
22+
{K_LEFT,options->getCmdChar(rightCmd)},
23+
{K_DOWN,options->getCmdChar(upCmd)},
24+
{K_ESC,options->getCmdChar(escCmd)},
25+
{K_ENTER,options->getCmdChar(enterCmd)}
26+
};
27+
PCF8574KeyIn<6> myButton(myBtn_map);
28+
529
***/
630

731
#ifndef __PCF8574KeyIn_h__
@@ -29,11 +53,10 @@ todo: write description
2953
public:
3054
keyMap* keys;
3155
int lastkey;
32-
TwoWire iicWire;
3356
unsigned long pressMills=0;
3457
PCF8574KeyIn<N, _dev, _sda, _scl>(keyMap k[]):keys(k),lastkey(-1) {}
3558
void begin() {
36-
iicWire.begin(_sda, _scl);
59+
Wire.begin(_sda, _scl);
3760
}
3861
int available(void) {
3962
int ch=peek();
@@ -55,10 +78,8 @@ todo: write description
5578
}
5679
int peek(void) {
5780
//Serial<<"peek"<<endl;
58-
59-
iicWire.requestFrom(_dev, 1);
60-
uint8_t val = iicWire.read();
61-
81+
Wire.requestFrom(_dev, 1);
82+
uint8_t val = Wire.read();
6283
for(int n=0;n<N;n++) {
6384
int8_t pin=keys[n].pin;
6485
if (((val)&1<<pin)==0) {

0 commit comments

Comments
 (0)