🚑️ Fix BIQU BX touch freeze (#24383)
This commit is contained in:
parent
831e1b5ecf
commit
253e35e066
@ -159,24 +159,28 @@ void GT911::read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_l
|
|||||||
void GT911::Init() {
|
void GT911::Init() {
|
||||||
OUT_WRITE(GT911_RST_PIN, LOW);
|
OUT_WRITE(GT911_RST_PIN, LOW);
|
||||||
OUT_WRITE(GT911_INT_PIN, LOW);
|
OUT_WRITE(GT911_INT_PIN, LOW);
|
||||||
delay(20);
|
delay(11);
|
||||||
|
WRITE(GT911_INT_PIN, HIGH);
|
||||||
|
delayMicroseconds(110);
|
||||||
WRITE(GT911_RST_PIN, HIGH);
|
WRITE(GT911_RST_PIN, HIGH);
|
||||||
|
delay(6);
|
||||||
|
WRITE(GT911_INT_PIN, LOW);
|
||||||
|
delay(55);
|
||||||
SET_INPUT(GT911_INT_PIN);
|
SET_INPUT(GT911_INT_PIN);
|
||||||
|
|
||||||
sw_iic.init();
|
sw_iic.init();
|
||||||
|
|
||||||
uint8_t clear_reg = 0x0000;
|
uint8_t clear_reg = 0x00;
|
||||||
write_reg(0x814E, 2, &clear_reg, 2); // Reset to 0 for start
|
write_reg(0x814E, 2, &clear_reg, 1); // Reset to 0 for start
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GT911::getFirstTouchPoint(int16_t *x, int16_t *y) {
|
bool GT911::getFirstTouchPoint(int16_t *x, int16_t *y) {
|
||||||
read_reg(0x814E, 2, ®.REG.status, 1);
|
read_reg(0x814E, 2, ®.REG.status, 1);
|
||||||
|
|
||||||
if (reg.REG.status & 0x80) {
|
if (reg.REG.status >= 0x80 && reg.REG.status <= 0x85) {
|
||||||
|
read_reg(0x8150, 2, reg.map + 2, 38);
|
||||||
uint8_t clear_reg = 0x00;
|
uint8_t clear_reg = 0x00;
|
||||||
write_reg(0x814E, 2, &clear_reg, 1); // Reset to 0 for start
|
write_reg(0x814E, 2, &clear_reg, 1); // Reset to 0 for start
|
||||||
read_reg(0x8150, 2, reg.map + 2, 8 * (reg.REG.status & 0x0F));
|
|
||||||
|
|
||||||
// First touch point
|
// First touch point
|
||||||
*x = ((reg.REG.point[0].xh & 0x0F) << 8) | reg.REG.point[0].xl;
|
*x = ((reg.REG.point[0].xh & 0x0F) << 8) | reg.REG.point[0].xl;
|
||||||
*y = ((reg.REG.point[0].yh & 0x0F) << 8) | reg.REG.point[0].yl;
|
*y = ((reg.REG.point[0].yh & 0x0F) << 8) | reg.REG.point[0].yl;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "../../../inc/MarlinConfig.h"
|
#include "../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#define GT911_SLAVE_ADDRESS 0xBA
|
#define GT911_SLAVE_ADDRESS 0x28
|
||||||
|
|
||||||
#if !PIN_EXISTS(GT911_RST)
|
#if !PIN_EXISTS(GT911_RST)
|
||||||
#error "GT911_RST_PIN is not defined."
|
#error "GT911_RST_PIN is not defined."
|
||||||
|
Loading…
Reference in New Issue
Block a user