support new NV14 touch controller (#2027)

* support new NV14 touch controller

* implement review changes
reduced CST836U read delay to 5 us
This commit is contained in:
Malte Langermann
2022-06-25 16:09:04 +02:00
committed by Raphael Coeffic
parent 10c851469a
commit 42e54f5100
4 changed files with 200 additions and 50 deletions
@@ -187,17 +187,22 @@ int stm32_i2c_write(uint8_t bus, uint16_t addr, uint16_t reg, uint16_t reg_size,
return 0;
}
int stm32_i2c_is_dev_ready(uint8_t bus, uint16_t addr, uint32_t timeout)
int stm32_i2c_is_dev_ready(uint8_t bus, uint16_t addr, uint32_t retries, uint32_t timeout)
{
I2C_HandleTypeDef* h = get_i2c_handle(bus);
if (!h) return -1;
if (!h) return -1;
HAL_StatusTypeDef err = HAL_I2C_IsDeviceReady(h, addr << 1, (uint32_t)-1, timeout);
HAL_StatusTypeDef err = HAL_I2C_IsDeviceReady(h, addr << 1, retries, timeout);
if (err != HAL_OK) return -1;
return 0;
}
int stm32_i2c_is_dev_ready(uint8_t bus, uint16_t addr, uint32_t timeout)
{
return stm32_i2c_is_dev_ready(bus, addr, 1, timeout);
}
static int i2c_enable_gpio_clock(GPIO_TypeDef *GPIOx)
{
if (GPIOx == GPIOA)