8 static const char *
const TAG =
"ft5x06.touchscreen";
11 ESP_LOGCONFIG(TAG,
"Setting up FT5x06 Touchscreen...");
35 ESP_LOGD(TAG,
"Read vendor ID 0x%X", data[0]);
39 ESP_LOGE(TAG,
"Unknown vendor ID 0x%X", data[0]);
52 ESP_LOGCONFIG(TAG,
"FT5x06 Touchscreen setup complete");
57 uint8_t data[MAX_TOUCHES][6];
60 ESP_LOGW(TAG,
"Failed to read status");
67 ESP_LOGW(TAG,
"Failed to read touch data");
70 for (uint8_t i = 0; i != touch_cnt; i++) {
71 uint8_t
status = data[i][0] >> 6;
72 uint8_t
id = data[i][2] >> 3;
76 ESP_LOGD(TAG,
"Read %X status, id: %d, pos %d/%d", status,
id, x, y);
77 if (status == 0 || status == 2) {
84 ESP_LOGCONFIG(TAG,
"FT5x06 Touchscreen:");
85 ESP_LOGCONFIG(TAG,
" Address: 0x%02X", this->
address_);
86 ESP_LOGCONFIG(TAG,
" Vendor ID: 0x%X", (
int) this->
vendor_id_);
92 ESP_LOGE(TAG,
"%s failed - err 0x%X", msg, err);
bool read_byte(uint8_t a_register, uint8_t *data, bool stop=true)
ErrorCode read_register(uint8_t a_register, uint8_t *data, size_t len, bool stop=true)
reads an array of bytes from a specific register in the I²C device
bool err_check_(i2c::ErrorCode err, const char *msg)
void update_touches() override
int get_native_height()
Get the native (original) height of the display in pixels.
void set_timeout(const std::string &name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
bool read_bytes(uint8_t a_register, uint8_t *data, uint8_t len)
Compat APIs All methods below have been added for compatibility reasons.
virtual void pin_mode(gpio::Flags flags)=0
bool set_mode_(FTMode mode)
int get_native_width()
Get the native (original) width of the display in pixels.
void attach_interrupt_(InternalGPIOPin *irq_pin, esphome::gpio::InterruptType type)
Call this function to send touch points to the on_touch listener and the binary_sensors.
No error found during execution of method.
BedjetMode mode
BedJet operating mode.
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
uint8_t address_
store the address of the device on the bus
display::Display * display_
InternalGPIOPin * interrupt_pin_
virtual void mark_failed()
Mark this component as failed.
void add_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_raw, int16_t z_raw=0)
Implementation of SPI Controller mode.
void dump_config() override
ErrorCode write_register(uint8_t a_register, const uint8_t *data, size_t len, bool stop=true)
writes an array of bytes to a specific register in the I²C device
ErrorCode
Error codes returned by I2CBus and I2CDevice methods.