Added new function to the touch panel API to put it in sleep or standby, WIP and not working yet

This commit is contained in:
Th3maz1ng 2023-01-22 21:15:59 +01:00
parent c574644d3a
commit 7148e76115
2 changed files with 22 additions and 0 deletions

View File

@ -1,4 +1,7 @@
#include "i2c.h"
#include "wm_gpio.h"
#include "FreeRTOS.h"
#include "app_log.h"
#include "CST816D.h"
bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data)
@ -22,3 +25,20 @@ bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data)
touch_data->isValid = false;
return false;
}
bool CST816D_set_power_mode(void)
{
tls_gpio_cfg(WM_IO_PA_00, WM_GPIO_DIR_OUTPUT, WM_GPIO_ATTR_FLOATING);
tls_gpio_write(WM_IO_PA_00, 0);
tls_os_time_delay(pdMS_TO_TICKS(5));
tls_gpio_write(WM_IO_PA_00, 1);
tls_os_time_delay(pdMS_TO_TICKS(50));
uint8_t data;
i2c_read_reg(CST816D_I2C_ADDR, 0xA5, &data);
i2c_write_reg(CST816D_I2C_ADDR, 0xA5, 0x03);
APP_LOG_DEBUG("CST 0xA5 : %u", data);
}

View File

@ -56,4 +56,6 @@ typedef struct CST816D_Touch_Data
*/
bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data);
bool CST816D_set_power_mode(void);
#endif //CST816D_H