Add the pinned Sensirion SEN66 driver, central sensor and board profiles, and a separate GPIO I2C bus for SEN66 with display. Preserve the original display layout and keep NOx and CO2 in InfluxDB. Include protocol tests, hardware workflow documentation and verified deployment results without credentials.
64 lines
1.9 KiB
C
64 lines
1.9 KiB
C
#include "esp_lcd_panel_io.h"
|
|
#include "esp_lcd_panel_vendor.h"
|
|
#include "esp_lcd_panel_ops.h"
|
|
|
|
#include "esp_lcd_touch_axs5106.h"
|
|
|
|
#include "esp_log.h"
|
|
#include "bsp_touch.h"
|
|
|
|
esp_err_t bsp_touch_init(esp_lcd_touch_handle_t *touch_handle, i2c_master_bus_handle_t bus_handle, uint16_t xmax, uint16_t ymax, uint16_t rotation)
|
|
{
|
|
static i2c_master_dev_handle_t dev_handle;
|
|
i2c_device_config_t dev_cfg = {
|
|
.dev_addr_length = I2C_ADDR_BIT_LEN_7,
|
|
.device_address = ESP_LCD_TOUCH_IO_I2C_AXS5106_ADDRESS,
|
|
.scl_speed_hz = 400000,
|
|
};
|
|
*touch_handle = NULL;
|
|
esp_err_t err = i2c_master_bus_add_device(bus_handle, &dev_cfg, &dev_handle);
|
|
if (err != ESP_OK) return err;
|
|
|
|
esp_lcd_touch_config_t tp_cfg = {};
|
|
tp_cfg.x_max = xmax < ymax ? xmax : ymax;
|
|
tp_cfg.y_max = xmax < ymax ? ymax : xmax;;
|
|
tp_cfg.rst_gpio_num = EXAMPLE_PIN_TP_RST;
|
|
tp_cfg.int_gpio_num = EXAMPLE_PIN_TP_INT;
|
|
|
|
if (90 == rotation)
|
|
{
|
|
tp_cfg.flags.swap_xy = 1;
|
|
tp_cfg.flags.mirror_x = 0;
|
|
tp_cfg.flags.mirror_y = 0;
|
|
}
|
|
else if (180 == rotation)
|
|
{
|
|
tp_cfg.flags.swap_xy = 0;
|
|
tp_cfg.flags.mirror_x = 0;
|
|
tp_cfg.flags.mirror_y = 1;
|
|
}
|
|
else if (270 == rotation)
|
|
{
|
|
tp_cfg.flags.swap_xy = 1;
|
|
tp_cfg.flags.mirror_x = 1;
|
|
tp_cfg.flags.mirror_y = 1;
|
|
}
|
|
else
|
|
{
|
|
tp_cfg.flags.swap_xy = 0;
|
|
tp_cfg.flags.mirror_x = 1;
|
|
tp_cfg.flags.mirror_y = 0;
|
|
}
|
|
|
|
err = esp_lcd_touch_new_i2c_axs5106(dev_handle, &tp_cfg, touch_handle);
|
|
if (err == ESP_OK) {
|
|
err = i2c_master_probe(bus_handle, dev_cfg.device_address, 100);
|
|
if (err != ESP_OK) esp_lcd_touch_del(*touch_handle);
|
|
}
|
|
if (err != ESP_OK) {
|
|
i2c_master_bus_rm_device(dev_handle);
|
|
*touch_handle = NULL;
|
|
}
|
|
return err;
|
|
}
|