Renamed and cleaned up the CST816D_sleep function + implemented the CST816D_hardware_reset function
This commit is contained in:
parent
90aac63257
commit
1c51fc9710
@ -1,5 +1,6 @@
|
|||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "wm_gpio.h"
|
#include "wm_gpio.h"
|
||||||
|
#include "wm_osal.h"
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "app_log.h"
|
#include "app_log.h"
|
||||||
#include "CST816D.h"
|
#include "CST816D.h"
|
||||||
@ -26,19 +27,19 @@ bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CST816D_set_power_mode(void)
|
void CST816D_hardware_reset(void)
|
||||||
{
|
{
|
||||||
tls_gpio_cfg(WM_IO_PA_00, WM_GPIO_DIR_OUTPUT, WM_GPIO_ATTR_FLOATING);
|
tls_gpio_cfg(LCD_TOUCH_PANEL_RESET, WM_GPIO_DIR_OUTPUT, WM_GPIO_ATTR_FLOATING);
|
||||||
|
|
||||||
tls_gpio_write(WM_IO_PA_00, 0);
|
tls_gpio_write(LCD_TOUCH_PANEL_RESET, 0);
|
||||||
tls_os_time_delay(pdMS_TO_TICKS(5));
|
tls_os_time_delay(pdMS_TO_TICKS(5));
|
||||||
tls_gpio_write(WM_IO_PA_00, 1);
|
tls_gpio_write(LCD_TOUCH_PANEL_RESET, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CST816D_sleep(void)
|
||||||
|
{
|
||||||
|
CST816D_hardware_reset();
|
||||||
tls_os_time_delay(pdMS_TO_TICKS(50));
|
tls_os_time_delay(pdMS_TO_TICKS(50));
|
||||||
|
|
||||||
uint8_t data;
|
return i2c_write_reg(CST816D_I2C_ADDR, 0xA5, 0x03);
|
||||||
|
|
||||||
i2c_read_reg(CST816D_I2C_ADDR, 0xA5, &data);
|
|
||||||
|
|
||||||
i2c_write_reg(CST816D_I2C_ADDR, 0xA5, 0x03);
|
|
||||||
APP_LOG_DEBUG("CST 0xA5 : %u", data);
|
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,18 @@ typedef struct CST816D_Touch_Data
|
|||||||
bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data);
|
bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Issues a hardware reset of the touch panel.
|
* @brief Issues a physical hardware reset of the touch panel IC using the reset pin.
|
||||||
*/
|
*/
|
||||||
void CST816D_hardware_reset(void);
|
void CST816D_hardware_reset(void);
|
||||||
|
|
||||||
bool CST816D_set_power_mode(void);
|
/**
|
||||||
|
* @brief Sets the touch panel in sleep mode.
|
||||||
|
* A call to this function does not seem to have any effect on power consumption even though the touch IC
|
||||||
|
* acknowledges the command ... strange !
|
||||||
|
*
|
||||||
|
* @return true if the IC acknowledged the command
|
||||||
|
* @return false otherwise
|
||||||
|
*/
|
||||||
|
bool CST816D_sleep(void);
|
||||||
|
|
||||||
#endif //CST816D_H
|
#endif //CST816D_H
|
Loading…
Reference in New Issue
Block a user