XIAO ESP32C6 I2C Slave Pins?

Thank you @grobasoz for pointing me to the Espressif framework. I was able to configure my XIAO ESP32C6 as an I2C Slave using this framework. I have included the code stub that I used to to configure my XIAO board as an I2C slave:

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/i2c_slave.h"
#include "esp_log.h"

static const char *TAG = "I2C_SLAVE_EXAMPLE";

// Define I2C slave configuration
#define I2C_SLAVE_PORT          I2C_NUM_0
#define I2C_SLAVE_SDA_IO        GPIO_NUM_22
#define I2C_SLAVE_SCL_IO        GPIO_NUM_23
#define I2C_SLAVE_ADDRESS       0x8 // Your desired 7-bit slave address

void app_main(void)
{
    i2c_slave_config_t i2c_slv_config = {
        .i2c_port = I2C_SLAVE_PORT,
        .clk_source = I2C_CLK_SRC_DEFAULT,
        .scl_io_num = I2C_SLAVE_SCL_IO,
        .sda_io_num = I2C_SLAVE_SDA_IO,
        .slave_addr = I2C_SLAVE_ADDRESS,
        .send_buf_depth = 100,
        .receive_buf_depth = 100,
    };

    i2c_slave_dev_handle_t slave_handle;
    ESP_ERROR_CHECK(i2c_new_slave_device(&i2c_slv_config, &slave_handle));
}
2 Likes