#ifndef I2CBRN_COMPONENT
#define I2CBRN_COMPONENT
#define I2C_TIMEOUT_MS_VALUE 20
#include <string.h>
#include "esp_log.h"
#include "buscfg.h"

#define TAG_I2C "cani2c"

#include "driver/i2c_master.h"
extern i2c_master_bus_config_t i2c0_bus_cfg;
extern i2c_master_bus_handle_t i2c0_bus_hdl;

esp_err_t i2c_master_bus_detect_devices(i2c_master_bus_handle_t handle);
esp_err_t i2c_write_register(i2c_master_dev_handle_t dev_handle, uint8_t reg_addr, uint8_t *data, size_t len);
esp_err_t i2c_read_register(i2c_master_dev_handle_t dev_handle, uint8_t reg_addr, uint8_t *data, size_t len);
esp_err_t i2c_write_register_16(i2c_master_dev_handle_t dev_handle, uint8_t reg_addr, uint16_t value);
esp_err_t i2c_read_register_16(i2c_master_dev_handle_t dev_handle, uint8_t reg_addr, uint16_t *value);
esp_err_t i2c_write_register_8(i2c_master_dev_handle_t dev_handle, uint8_t reg_addr, uint8_t value);
esp_err_t i2c_read_register_8(i2c_master_dev_handle_t dev_handle, uint8_t reg_addr, uint8_t *value);
#endif