* removed red LED
* added GT911 fw version and hiccup cound output to analogs page * changed I2C to 400 kHz * changed X Y threshold to 1 * added trace output * fixed bool / uint8_t errors
This commit is contained in:
committed by
Raphael Coeffic
parent
2c65b21355
commit
8c7f3cecec
@@ -49,7 +49,7 @@ class RadioAnalogsDiagsWindow: public Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
constexpr coord_t y = MENU_CONTENT_TOP + 6 * FH;
|
constexpr coord_t y = MENU_CONTENT_TOP + 5 * FH;
|
||||||
|
|
||||||
if (touchState.event != TE_NONE && touchState.event != TE_SLIDE_END) {
|
if (touchState.event != TE_NONE && touchState.event != TE_SLIDE_END) {
|
||||||
coord_t x = dc->drawText(MENUS_MARGIN_LEFT, y, STR_TOUCH_PANEL);
|
coord_t x = dc->drawText(MENUS_MARGIN_LEFT, y, STR_TOUCH_PANEL);
|
||||||
@@ -59,6 +59,14 @@ class RadioAnalogsDiagsWindow: public Window {
|
|||||||
dc->drawLine(touchState.x - 10, touchState.y - 8 - parent->top(), touchState.x + 10, touchState.y + 8 - parent->top(), SOLID, 0);
|
dc->drawLine(touchState.x - 10, touchState.y - 8 - parent->top(), touchState.x + 10, touchState.y + 8 - parent->top(), SOLID, 0);
|
||||||
dc->drawLine(touchState.x - 10, touchState.y + 8 - parent->top(), touchState.x + 10, touchState.y - 8- parent->top(), SOLID, 0);
|
dc->drawLine(touchState.x - 10, touchState.y + 8 - parent->top(), touchState.x + 10, touchState.y - 8- parent->top(), SOLID, 0);
|
||||||
}
|
}
|
||||||
|
#if !defined(SIMU)
|
||||||
|
constexpr coord_t y1 = MENU_CONTENT_TOP + 6 * FH;
|
||||||
|
constexpr coord_t x1 = MENUS_MARGIN_LEFT;
|
||||||
|
dc->drawText(x1, y1, "Touch GT911 FW ver:");
|
||||||
|
dc->drawNumber(x1 + 150, y1, touchGT911fwver, LEFT, 4);
|
||||||
|
dc->drawText(x1 + 200, y1, "Hiccups:");
|
||||||
|
dc->drawNumber(x1 + 260, y1, touchGT911hiccups, LEFT, 5);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -728,7 +728,7 @@
|
|||||||
#define I2C_SCL_GPIO_PinSource GPIO_PinSource8
|
#define I2C_SCL_GPIO_PinSource GPIO_PinSource8
|
||||||
#define I2C_SDA_GPIO_PinSource GPIO_PinSource9
|
#define I2C_SDA_GPIO_PinSource GPIO_PinSource9
|
||||||
#endif
|
#endif
|
||||||
#define I2C_SPEED 100000
|
#define I2C_SPEED 400000
|
||||||
|
|
||||||
// Haptic
|
// Haptic
|
||||||
#define HAPTIC_PWM
|
#define HAPTIC_PWM
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ const uint8_t TOUCH_GT911_Cfg[] = {
|
|||||||
0x50, // 0x8053 Screen touch level
|
0x50, // 0x8053 Screen touch level
|
||||||
0x3C, // 0x8054 Screen touch leave
|
0x3C, // 0x8054 Screen touch leave
|
||||||
0x03, // 0x8055 Low power control
|
0x03, // 0x8055 Low power control
|
||||||
0x05, // 0x8056 Refresh rate
|
0x0F, // 0x8056 Refresh rate
|
||||||
0x00, // 0x8057 X threshold
|
0x01, // 0x8057 X threshold
|
||||||
0x00, // 0x8058 Y threshold
|
0x01, // 0x8058 Y threshold
|
||||||
0x00, // 0x8059 Reserved
|
0x00, // 0x8059 Reserved
|
||||||
0x00, // 0x805A Reserved
|
0x00, // 0x805A Reserved
|
||||||
0x00, // 0x805B Space (top, bottom)
|
0x00, // 0x805B Space (top, bottom)
|
||||||
@@ -231,8 +231,8 @@ const uint8_t TOUCH_GT911_Cfg[] =
|
|||||||
0x3C, // 0x8054 Screen touch leave
|
0x3C, // 0x8054 Screen touch leave
|
||||||
0x03, // 0x8055 Low power control
|
0x03, // 0x8055 Low power control
|
||||||
0x0F, // 0x8056 Refresh rate
|
0x0F, // 0x8056 Refresh rate
|
||||||
0x0A, // 0x8057 X threshold
|
0x01, // 0x8057 X threshold
|
||||||
0x0A, // 0x8058 Y threshold
|
0x01, // 0x8058 Y threshold
|
||||||
0x00, // 0x8059 Reserved
|
0x00, // 0x8059 Reserved
|
||||||
0x00, // 0x805A Reserved
|
0x00, // 0x805A Reserved
|
||||||
0x11, // 0x805B Space (top, bottom)
|
0x11, // 0x805B Space (top, bottom)
|
||||||
@@ -404,8 +404,10 @@ const uint8_t TOUCH_GT911_Cfg[] =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool touchGT911Flag = false;
|
bool touchGT911Flag = false;
|
||||||
volatile bool touchEventOccured = false;
|
volatile static bool touchEventOccured = false;
|
||||||
struct TouchData touchData;
|
struct TouchData touchData;
|
||||||
|
uint16_t touchGT911fwver = 0;
|
||||||
|
uint16_t touchGT911hiccups = 0;
|
||||||
|
|
||||||
static void TOUCH_AF_ExtiStop(void)
|
static void TOUCH_AF_ExtiStop(void)
|
||||||
{
|
{
|
||||||
@@ -484,6 +486,8 @@ void TOUCH_AF_INT_Change(void)
|
|||||||
|
|
||||||
void I2C_Init()
|
void I2C_Init()
|
||||||
{
|
{
|
||||||
|
TRACE("I2C Init");
|
||||||
|
|
||||||
I2C_DeInit(I2C);
|
I2C_DeInit(I2C);
|
||||||
|
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
@@ -529,33 +533,55 @@ bool I2C_WaitEventCleared(uint32_t event)
|
|||||||
uint8_t I2C_GT911_WriteRegister(uint16_t reg, uint8_t * buf, uint8_t len)
|
uint8_t I2C_GT911_WriteRegister(uint16_t reg, uint8_t * buf, uint8_t len)
|
||||||
{
|
{
|
||||||
if (!I2C_WaitEventCleared(I2C_FLAG_BUSY))
|
if (!I2C_WaitEventCleared(I2C_FLAG_BUSY))
|
||||||
|
{
|
||||||
|
TRACE("I2C WRITE ERROR: busy timeout");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_GenerateSTART(I2C, ENABLE);
|
I2C_GenerateSTART(I2C, ENABLE);
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_MODE_SELECT))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_MODE_SELECT))
|
||||||
|
{
|
||||||
|
TRACE("I2C WRITE ERROR: could not issue start");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_Send7bitAddress(I2C, GT_CMD_WR, I2C_Direction_Transmitter);
|
I2C_Send7bitAddress(I2C, GT_CMD_WR, I2C_Direction_Transmitter);
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED))
|
||||||
|
{
|
||||||
|
TRACE("I2C WRITE ERROR: could not send device address");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_SendData(I2C, (uint8_t)((reg & 0xFF00) >> 8));
|
I2C_SendData(I2C, (uint8_t)((reg & 0xFF00) >> 8));
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTING))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTING))
|
||||||
|
{
|
||||||
|
TRACE("I2C WRITE ERROR: could not send register high address");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_SendData(I2C, (uint8_t)(reg & 0x00FF));
|
I2C_SendData(I2C, (uint8_t)(reg & 0x00FF));
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTING))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTING))
|
||||||
|
{
|
||||||
|
TRACE("I2C WRITE ERROR: could not send register low address");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* While there is data to be written */
|
/* While there is data to be written */
|
||||||
while (len--) {
|
while (len--) {
|
||||||
I2C_SendData(I2C, *buf);
|
I2C_SendData(I2C, *buf);
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTING))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTING))
|
||||||
|
{
|
||||||
|
TRACE("I2C WRITE ERROR: could not send data with %u bytes remaining", len+1 );
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
buf++;
|
buf++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTED))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTED))
|
||||||
|
{
|
||||||
|
TRACE("I2C WRITE ERROR: waiting for BTF failed.");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_GenerateSTOP(I2C, ENABLE);
|
I2C_GenerateSTOP(I2C, ENABLE);
|
||||||
return true;
|
return true;
|
||||||
@@ -564,35 +590,61 @@ uint8_t I2C_GT911_WriteRegister(uint16_t reg, uint8_t * buf, uint8_t len)
|
|||||||
bool I2C_GT911_ReadRegister(u16 reg, uint8_t * buf, uint8_t len)
|
bool I2C_GT911_ReadRegister(u16 reg, uint8_t * buf, uint8_t len)
|
||||||
{
|
{
|
||||||
if (!I2C_WaitEventCleared(I2C_FLAG_BUSY))
|
if (!I2C_WaitEventCleared(I2C_FLAG_BUSY))
|
||||||
|
{
|
||||||
|
TRACE("I2C READ ERROR: busy timeout");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_GenerateSTART(I2C, ENABLE);
|
I2C_GenerateSTART(I2C, ENABLE);
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_MODE_SELECT))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_MODE_SELECT))
|
||||||
|
{
|
||||||
|
TRACE("I2C READ ERROR: could not issue first step start");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_Send7bitAddress(I2C, GT_CMD_WR, I2C_Direction_Transmitter);
|
I2C_Send7bitAddress(I2C, GT_CMD_WR, I2C_Direction_Transmitter);
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED))
|
||||||
|
{
|
||||||
|
TRACE("I2C READ ERROR: could not send first step device address");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_SendData(I2C, (uint8_t)((reg & 0xFF00) >> 8));
|
I2C_SendData(I2C, (uint8_t)((reg & 0xFF00) >> 8));
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTING))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTING))
|
||||||
|
{
|
||||||
|
TRACE("I2C READ ERROR: could not send register high address");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_SendData(I2C, (uint8_t)(reg & 0x00FF));
|
I2C_SendData(I2C, (uint8_t)(reg & 0x00FF));
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTED))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTED))
|
||||||
|
{
|
||||||
|
TRACE("I2C READ ERROR: could not send register low address");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// see GP911 data sheet, chapter 6.1.c, page 12, diagram for reading data
|
// According to GP911 data sheet, repeated start is not listed, so we do full stop.
|
||||||
|
// See chapter 6.1.c, page 12, diagram for reading data
|
||||||
I2C_GenerateSTOP(I2C, ENABLE);
|
I2C_GenerateSTOP(I2C, ENABLE);
|
||||||
if (!I2C_WaitEventCleared(I2C_FLAG_BUSY))
|
if (!I2C_WaitEventCleared(I2C_FLAG_BUSY))
|
||||||
|
{
|
||||||
|
TRACE("I2C READ ERROR: timeout waiting for first stop");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_GenerateSTART(I2C, ENABLE);
|
I2C_GenerateSTART(I2C, ENABLE);
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_MODE_SELECT))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_MODE_SELECT))
|
||||||
|
{
|
||||||
|
TRACE("I2C READ ERROR: could not issue second step start");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
I2C_Send7bitAddress(I2C, GT_CMD_RD, I2C_Direction_Receiver);
|
I2C_Send7bitAddress(I2C, GT_CMD_RD, I2C_Direction_Receiver);
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED))
|
||||||
|
{
|
||||||
|
TRACE("I2C READ ERROR: could not send second step device address");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (len > 1) {
|
if (len > 1) {
|
||||||
I2C_AcknowledgeConfig(I2C, ENABLE);
|
I2C_AcknowledgeConfig(I2C, ENABLE);
|
||||||
@@ -600,10 +652,13 @@ bool I2C_GT911_ReadRegister(u16 reg, uint8_t * buf, uint8_t len)
|
|||||||
|
|
||||||
while (len) {
|
while (len) {
|
||||||
if (len == 1) {
|
if (len == 1) {
|
||||||
I2C_AcknowledgeConfig(I2C, DISABLE);
|
I2C_AcknowledgeConfig(I2C, DISABLE); // Send NACK on last byte
|
||||||
}
|
}
|
||||||
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_RECEIVED))
|
if (!I2C_WaitEvent(I2C_EVENT_MASTER_BYTE_RECEIVED))
|
||||||
|
{
|
||||||
|
TRACE("I2C READ ERROR: could not read data with %u bytes remaining", len );
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
*buf++ = I2C_ReceiveData(I2C);
|
*buf++ = I2C_ReceiveData(I2C);
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
@@ -612,18 +667,30 @@ bool I2C_GT911_ReadRegister(u16 reg, uint8_t * buf, uint8_t len)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I2C_GT911_SendConfig(uint8_t mode)
|
bool I2C_GT911_SendConfig(void)
|
||||||
{
|
{
|
||||||
uint8_t buf[2];
|
uint8_t buf[2];
|
||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
buf[1] = mode;
|
buf[1] = 1;
|
||||||
|
bool bResult = true;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(TOUCH_GT911_Cfg); i++)
|
for (i = 0; i < sizeof(TOUCH_GT911_Cfg); i++)
|
||||||
buf[0] += TOUCH_GT911_Cfg[i];//check sum
|
buf[0] += TOUCH_GT911_Cfg[i];//check sum
|
||||||
|
|
||||||
buf[0] = (~buf[0]) + 1;
|
buf[0] = (~buf[0]) + 1;
|
||||||
I2C_GT911_WriteRegister(GT_CFGS_REG, (uint8_t *) TOUCH_GT911_Cfg, sizeof(TOUCH_GT911_Cfg));//
|
if (!I2C_GT911_WriteRegister(GT_CFGS_REG, (uint8_t *) TOUCH_GT911_Cfg, sizeof(TOUCH_GT911_Cfg)))
|
||||||
I2C_GT911_WriteRegister(GT_CHECK_REG, buf, 2);//write checksum
|
{
|
||||||
|
TRACE("GT911 ERROR: write config failed");
|
||||||
|
bResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!I2C_GT911_WriteRegister(GT_CHECK_REG, buf, 2)) //write checksum
|
||||||
|
{
|
||||||
|
TRACE("GT911 ERROR: write config checksum failed");
|
||||||
|
bResult = false;
|
||||||
|
}
|
||||||
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
void touchPanelDeInit(void)
|
void touchPanelDeInit(void)
|
||||||
@@ -661,29 +728,55 @@ bool touchPanelInit(void)
|
|||||||
delay_ms(50);
|
delay_ms(50);
|
||||||
|
|
||||||
TRACE("Reading Touch registry");
|
TRACE("Reading Touch registry");
|
||||||
I2C_GT911_ReadRegister(GT_PID_REG, tmp, 4);
|
if (!I2C_GT911_ReadRegister(GT_PID_REG, tmp, 4))
|
||||||
|
{
|
||||||
|
TRACE("GT911 ERROR: Product ID read failed");
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp((char *) tmp, "911") == 0) //ID==9147
|
if (strcmp((char *) tmp, "911") == 0) //ID==9147
|
||||||
{
|
{
|
||||||
TRACE("GT911 chip detected");
|
TRACE("GT911 chip detected");
|
||||||
tmp[0] = 0X02;
|
tmp[0] = 0X02;
|
||||||
I2C_GT911_WriteRegister(GT_CTRL_REG, tmp, 1);
|
if (!I2C_GT911_WriteRegister(GT_CTRL_REG, tmp, 1))
|
||||||
I2C_GT911_ReadRegister(GT_CFGS_REG, tmp, 1);
|
{
|
||||||
|
TRACE("GT911 ERROR: write to control register failed");
|
||||||
|
}
|
||||||
|
if (!I2C_GT911_ReadRegister(GT_CFGS_REG, tmp, 1))
|
||||||
|
{
|
||||||
|
TRACE("GT911 ERROR: configration register read failed");
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("Chip config Ver:%x\r\n", tmp[0]);
|
TRACE("Chip config Ver:%x", tmp[0]);
|
||||||
if (tmp[0] <= GT911_CFG_NUMER) //Config ver
|
if (tmp[0] <= GT911_CFG_NUMER) //Config ver
|
||||||
{
|
{
|
||||||
TRACE("Sending new config %d", GT911_CFG_NUMER);
|
TRACE("Sending new config %d", GT911_CFG_NUMER);
|
||||||
I2C_GT911_SendConfig(1);
|
if (!I2C_GT911_SendConfig())
|
||||||
|
{
|
||||||
|
TRACE("GT911 ERROR: sending configration failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!I2C_GT911_ReadRegister(GT911_FIRMWARE_VERSION_REG, tmp, 2))
|
||||||
|
{
|
||||||
|
TRACE("GT911 ERROR: reading firmware version failed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
touchGT911fwver = (tmp[1] << 8) + tmp[0];
|
||||||
|
TRACE("GT911 FW version: %u", touchGT911fwver);
|
||||||
}
|
}
|
||||||
|
|
||||||
delay_ms(10);
|
delay_ms(10);
|
||||||
tmp[0] = 0X00;
|
tmp[0] = 0X00;
|
||||||
I2C_GT911_WriteRegister(GT_CTRL_REG, tmp, 1); //end reset
|
if (!I2C_GT911_WriteRegister(GT_CTRL_REG, tmp, 1)) //end reset
|
||||||
|
{
|
||||||
|
TRACE("GT911 ERROR: write to control register failed");
|
||||||
|
}
|
||||||
touchGT911Flag = true;
|
touchGT911Flag = true;
|
||||||
|
|
||||||
TOUCH_AF_ExtiConfig();
|
TOUCH_AF_ExtiConfig();
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
TRACE("GT911 chip NOT FOUND");
|
TRACE("GT911 chip NOT FOUND");
|
||||||
@@ -723,7 +816,8 @@ void touchPanelRead()
|
|||||||
uint32_t startReadStatus = RTOS_GET_MS();
|
uint32_t startReadStatus = RTOS_GET_MS();
|
||||||
do {
|
do {
|
||||||
if (!I2C_GT911_ReadRegister(GT911_READ_XY_REG, &state, 1)) {
|
if (!I2C_GT911_ReadRegister(GT911_READ_XY_REG, &state, 1)) {
|
||||||
ledRed();
|
//ledRed();
|
||||||
|
touchGT911hiccups++;
|
||||||
TRACE("GT911 I2C read XY error");
|
TRACE("GT911 I2C read XY error");
|
||||||
touchPanelDeInit();
|
touchPanelDeInit();
|
||||||
touchPanelInit();
|
touchPanelInit();
|
||||||
@@ -744,7 +838,8 @@ void touchPanelRead()
|
|||||||
if (pointsCount > 0 && pointsCount <= GT911_MAX_TP) {
|
if (pointsCount > 0 && pointsCount <= GT911_MAX_TP) {
|
||||||
if (!I2C_GT911_ReadRegister(GT911_READ_XY_REG + 1, touchData.data,
|
if (!I2C_GT911_ReadRegister(GT911_READ_XY_REG + 1, touchData.data,
|
||||||
pointsCount * sizeof(TouchPoint))) {
|
pointsCount * sizeof(TouchPoint))) {
|
||||||
ledRed();
|
//ledRed();
|
||||||
|
touchGT911hiccups++;
|
||||||
TRACE("GT911 I2C data read error");
|
TRACE("GT911 I2C data read error");
|
||||||
touchPanelDeInit();
|
touchPanelDeInit();
|
||||||
touchPanelInit();
|
touchPanelInit();
|
||||||
@@ -778,7 +873,10 @@ void touchPanelRead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t zero = 0;
|
uint8_t zero = 0;
|
||||||
I2C_GT911_WriteRegister(GT911_READ_XY_REG, &zero, 1);
|
if (!I2C_GT911_WriteRegister(GT911_READ_XY_REG, &zero, 1))
|
||||||
|
{
|
||||||
|
TRACE("GT911 ERROR: clearing XY register failed");
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("touch event = %s", event2str(touchState.event));
|
TRACE("touch event = %s", event2str(touchState.event));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
#define HAS_TOUCH_PANEL() touchGT911Flag == true
|
#define HAS_TOUCH_PANEL() touchGT911Flag == true
|
||||||
|
|
||||||
extern bool touchGT911Flag;
|
extern bool touchGT911Flag;
|
||||||
|
extern uint16_t touchGT911fwver;
|
||||||
|
extern uint16_t touchGT911hiccups;
|
||||||
extern bool touchPanelInit();
|
extern bool touchPanelInit();
|
||||||
|
|
||||||
void touchPanelRead();
|
void touchPanelRead();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
#include "touch_driver.h"
|
#include "touch_driver.h"
|
||||||
|
|
||||||
static bool touchEventOccured;
|
volatile static bool touchEventOccured;
|
||||||
|
|
||||||
#define FT6x06_MAX_INSTANCE 1
|
#define FT6x06_MAX_INSTANCE 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user