sforkowany z mirror/meshtastic-firmware
Support detecting RAK14006 KB
rodzic
7f0fd642ec
commit
e48285a33a
|
@ -34,6 +34,7 @@ uint8_t oled_probe(byte addr)
|
||||||
void scanI2Cdevice(void)
|
void scanI2Cdevice(void)
|
||||||
{
|
{
|
||||||
byte err, addr;
|
byte err, addr;
|
||||||
|
uint8_t r = 0x00;
|
||||||
int nDevices = 0;
|
int nDevices = 0;
|
||||||
for (addr = 1; addr < 127; addr++) {
|
for (addr = 1; addr < 127; addr++) {
|
||||||
Wire.beginTransmission(addr);
|
Wire.beginTransmission(addr);
|
||||||
|
@ -72,7 +73,22 @@ void scanI2Cdevice(void)
|
||||||
#endif
|
#endif
|
||||||
if (addr == CARDKB_ADDR) {
|
if (addr == CARDKB_ADDR) {
|
||||||
cardkb_found = addr;
|
cardkb_found = addr;
|
||||||
DEBUG_MSG("m5 cardKB found\n");
|
// Do we have the RAK14006 instead?
|
||||||
|
Wire.beginTransmission(addr);
|
||||||
|
Wire.write(0x04); // SENSOR_GET_VERSION
|
||||||
|
Wire.endTransmission();
|
||||||
|
delay(20);
|
||||||
|
Wire.requestFrom((int)addr, 1);
|
||||||
|
if (Wire.available()) {
|
||||||
|
r = Wire.read();
|
||||||
|
}
|
||||||
|
if (r == 0x02) { // KEYPAD_VERSION
|
||||||
|
DEBUG_MSG("RAK14004 found\n");
|
||||||
|
kb_model = 0x02;
|
||||||
|
} else {
|
||||||
|
DEBUG_MSG("m5 cardKB found\n");
|
||||||
|
kb_model = 0x00;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (addr == FACESKB_ADDR) {
|
if (addr == FACESKB_ADDR) {
|
||||||
faceskb_found = addr;
|
faceskb_found = addr;
|
||||||
|
|
|
@ -75,6 +75,8 @@ uint8_t screen_model;
|
||||||
|
|
||||||
// The I2C address of the cardkb or RAK14004 (if found)
|
// The I2C address of the cardkb or RAK14004 (if found)
|
||||||
uint8_t cardkb_found;
|
uint8_t cardkb_found;
|
||||||
|
// 0x02 for RAK14004 and 0x00 for cardkb
|
||||||
|
uint8_t kb_model;
|
||||||
|
|
||||||
// The I2C address of the Faces Keyboard (if found)
|
// The I2C address of the Faces Keyboard (if found)
|
||||||
uint8_t faceskb_found;
|
uint8_t faceskb_found;
|
||||||
|
@ -295,7 +297,7 @@ void setup()
|
||||||
|
|
||||||
// Don't call screen setup until after nodedb is setup (because we need
|
// Don't call screen setup until after nodedb is setup (because we need
|
||||||
// the current region name)
|
// the current region name)
|
||||||
#if defined(ST7735_CS) || defined(HAS_EINK)
|
#if defined(ST7735_CS) || defined(HAS_EINK) || defined(ILI9341_DRIVER)
|
||||||
screen->setup();
|
screen->setup();
|
||||||
#else
|
#else
|
||||||
if (screen_found)
|
if (screen_found)
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
extern uint8_t screen_found;
|
extern uint8_t screen_found;
|
||||||
extern uint8_t screen_model;
|
extern uint8_t screen_model;
|
||||||
extern uint8_t cardkb_found;
|
extern uint8_t cardkb_found;
|
||||||
|
extern uint8_t kb_model;
|
||||||
extern uint8_t faceskb_found;
|
extern uint8_t faceskb_found;
|
||||||
extern uint8_t rtc_found;
|
extern uint8_t rtc_found;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue