9 static const char *
const TAG =
"ax15231.touchscreen";
11 constexpr
static const uint8_t AXS_READ_TOUCHPAD[11] = {0xb5, 0xab, 0xa5, 0x5a, 0x0, 0x0, 0x0, 0x8};
13 #define ERROR_CHECK(err) \ 14 if ((err) != i2c::ERROR_OK) { \ 15 this->status_set_warning("Failed to communicate"); \ 20 ESP_LOGCONFIG(TAG,
"Setting up AXS15231 Touchscreen...");
35 ESP_LOGCONFIG(TAG,
"AXS15231 Touchscreen setup complete");
42 err = this->
write(AXS_READ_TOUCHPAD,
sizeof(AXS_READ_TOUCHPAD),
false);
44 err = this->
read(data,
sizeof(data));
55 ESP_LOGCONFIG(TAG,
"AXS15231 Touchscreen:");
59 ESP_LOGCONFIG(TAG,
" Width: %d", this->
x_raw_max_);
60 ESP_LOGCONFIG(TAG,
" Height: %d", this->
y_raw_max_);
virtual void digital_write(bool value)=0
ErrorCode read(uint8_t *data, size_t len)
reads an array of bytes from the device using an I2CBus
int get_native_height()
Get the native (original) height of the display in pixels.
virtual void pin_mode(gpio::Flags flags)=0
InternalGPIOPin * interrupt_pin_
ErrorCode write(const uint8_t *data, size_t len, bool stop=true)
writes an array of bytes to a device using an I2CBus
int get_native_width()
Get the native (original) width of the display in pixels.
void update_touches() override
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.
void status_clear_warning()
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
void dump_config() override
display::Display * display_
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.
ErrorCode
Error codes returned by I2CBus and I2CDevice methods.
void IRAM_ATTR HOT delay(uint32_t ms)