/* * i2c_bus — single owner of the board's I2C bus. * * SDA 38 / SCL 39, shared by the PCF8574 expander (0x21) and the CST826 touch * controller (0x15). The I2C connector on the case brings the same bus out, so * anything added later lands here too. */ #pragma once #include "driver/i2c_master.h" #include "esp_err.h" #define I2C_BUS_SDA_GPIO 38 #define I2C_BUS_SCL_GPIO 39 #define I2C_BUS_FREQ_HZ 400000 /* Initialise the bus. Safe to call more than once. */ esp_err_t i2c_bus_init(void); /* Add a device to the shared bus. */ esp_err_t i2c_bus_add_device(uint8_t addr, i2c_master_dev_handle_t *out); /* * Probe every address and log what answers. * * PRD 8.1: this is the cheap sanity check that tells you the board is alive * and the I2C pins are right, independently of the display. Expect 0x21 and * 0x15. Returns the number of devices found. */ int i2c_bus_scan(void);