ESPHome 2026.7.0
Loading...
Searching...
No Matches
gsl3670_touchscreen.h
Go to the documentation of this file.
1#pragma once
2
6#include "esphome/core/hal.h"
7#include "esphome/core/log.h"
8
9namespace esphome::gsl3670 {
10
11// ---------------------------------------------------------------------------
12// GSL3670 touchscreen ESPHome component
13// ---------------------------------------------------------------------------
15 public:
17 void set_firmware(const uint8_t *fw, size_t len) {
18 this->firmware_ = fw;
19 this->firmware_len_ = len;
20 }
21
22 void set_interrupt_pin(InternalGPIOPin *pin) { interrupt_pin_ = pin; }
23 void set_reset_pin(GPIOPin *pin) { reset_pin_ = pin; }
24
25 // touchscreen::Touchscreen / Component interface
26 void setup() override;
27 void dump_config() override;
28
29 protected:
30 void update_touches() override;
31
32 private:
33 // ---------- init steps (mirrors esp_lcd_touch_gsl3670_init) ----------
34 void clear_reg_(); // GPIO reset + 0x88/0xe4/0xe0 sequence
35 void reset_(); // GPIO reset + 0xe4/0xbc sequence
36 void load_firmware_(); // write GSLX670_FW table
37 void startup_chip_(); // 0x00→0xe0 + gsl_DataInit
38
39 // ---------- I2C helpers ----------
40 bool write_reg_(uint8_t reg, const uint8_t *data, size_t len);
41 bool write_reg8_(uint8_t reg, uint8_t val);
42
43 InternalGPIOPin *interrupt_pin_{nullptr};
44 GPIOPin *reset_pin_{nullptr};
45
46 const uint8_t *firmware_{nullptr};
47 size_t firmware_len_{0};
48};
49
50} // namespace esphome::gsl3670
void set_firmware(const uint8_t *fw, size_t len)
Supply the firmware table (generated by codegen from the YAML)
void set_interrupt_pin(InternalGPIOPin *pin)
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
Definition i2c.h:152
mopeka_std_values val[3]
const void size_t len
Definition hal.h:64