M5Stack driver improvements

This commit is contained in:
fvanroie 2021-01-06 21:03:30 +01:00
parent 4621f1f72c
commit 79bb4792f2
2 changed files with 8 additions and 19 deletions

View File

@ -12,15 +12,15 @@ void m5stack_init()
Axp.begin();
Axp.SetCHGCurrent(AXP192::kCHG_100mA);
Axp.SetLcdVoltage(3300);
Axp.SetLcdVoltage(2800);
Axp.SetBusPowerMode(0);
Axp.SetCHGCurrent(AXP192::kCHG_190mA);
// Axp.SetLDOEnable(3, true);
Axp.SetLDOEnable(3, true);
// CoverScrollText("Motor Test", M5.Lcd.color565(SUCCE_COLOR));
// delay(150);
// Axp.SetLDOEnable(3, false);
delay(150);
Axp.SetLDOEnable(3, false);
Axp.SetLed(1);
// CoverScrollText("LED Test", M5.Lcd.color565(SUCCE_COLOR));
@ -34,7 +34,7 @@ void m5stack_init()
// FastLED.show();
Axp.SetLDOVoltage(3, 3300);
// Axp.SetLed(1);
Axp.SetLed(1);
}
#endif

View File

@ -13,21 +13,10 @@ FT6336U * touchpanel;
// Read touch points
bool IRAM_ATTR FT6336U_getXY(int16_t * touchX, int16_t * touchY, bool debug)
{
FT6336U_TouchPointType tp = touchpanel->scan();
if(touchpanel->read_touch_number() != 1) return false;
if(tp.touch_count != 1) return false;
if(debug) {
char tempString[128];
sprintf(tempString, "FT6336U TD Count %d / TD1 (%d, %4d, %4d) / TD2 (%d, %4d, %4d)\r", tp.touch_count,
tp.tp[0].status, tp.tp[0].x, tp.tp[0].y, tp.tp[1].status, tp.tp[1].x, tp.tp[1].y);
Serial.print(tempString);
}
int i = 0; // tp.tp[0].status == TouchStatusEnum::touch ? 0 : 1;
*touchX = TFT_WIDTH - tp.tp[i].y;
*touchY = tp.tp[i].x;
*touchX = TFT_WIDTH - touchpanel->read_touch1_y();
*touchY = touchpanel->read_touch1_y();
return true;
}