@@ -62,7 +62,15 @@ extern "C" {
6262 ****************************************************************************/
6363
6464/*! @name BMI270 Chip identifier */
65+ #if CONFIG_SENSOR_BMI220
66+ #define BMI270_CHIP_ID UINT8_C(0x26)
67+ #elif CONFIG_SENSOR_BMI270
6568#define BMI270_CHIP_ID UINT8_C(0x24)
69+ #else
70+ #error "Invalid sensor selected"
71+ #endif
72+
73+ #define BMI270_I2C_ADDRESS UINT8_C(0x68)
6674
6775/*! @name BMI270 feature input start addresses */
6876#define BMI270_CONFIG_ID_STRT_ADDR UINT8_C(0x00)
@@ -125,6 +133,55 @@ extern "C" {
125133/*! BMI270 User Interface function prototypes
126134 ****************************************************************************/
127135
136+ /**
137+ * @brief BMI270 I2C configuration structure
138+ *
139+ * This structure contains the configuration parameters for communicating with
140+ * the BMI270 sensor over I2C. It specifies the I2C port and the I2C address of
141+ * the BMI270 device.
142+ */
143+ typedef struct {
144+ i2c_port_t i2c_port ; /*!< I2C port used to connect to the BMI270 device */
145+ uint8_t i2c_addr ; /*!< I2C address of the BMI270 device, can be 0x38 or 0x39 depending on the A0 pin */
146+ } bmi270_i2c_config_t ;
147+
148+ /**
149+ * @brief Handle type for BMI270 sensor
150+ *
151+ * This is a pointer to a structure representing the BMI270 device. It is used
152+ * as a handle for interacting with the sensor.
153+ */
154+ typedef struct bmi2_dev * bmi270_handle_t ;
155+
156+ /**
157+ * @brief Create and initialize a BMI270 sensor object
158+ *
159+ * This function initializes the BMI270 sensor and prepares it for use.
160+ * It configures the I2C interface and creates a handle for further communication.
161+ *
162+ * @param[in] i2c_conf Pointer to the I2C configuration structure
163+ * @param[out] handle_ret Pointer to a variable that will hold the created sensor handle
164+ * @return
165+ * - ESP_OK: Successfully created the sensor object
166+ * - ESP_ERR_INVALID_ARG: Invalid arguments were provided
167+ * - ESP_FAIL: Failed to initialize the sensor
168+ */
169+ esp_err_t bmi270_sensor_create (const bmi270_i2c_config_t * i2c_conf , bmi270_handle_t * handle_ret );
170+
171+ /**
172+ * @brief Delete and release a BMI270 sensor object
173+ *
174+ * This function releases the resources allocated for the BMI270 sensor.
175+ * It should be called when the sensor is no longer needed.
176+ *
177+ * @param[in] handle Handle of the BMI270 sensor object
178+ * @return
179+ * - ESP_OK: Successfully deleted the sensor object
180+ * - ESP_ERR_INVALID_ARG: Invalid handle was provided
181+ * - ESP_FAIL: Failed to delete the sensor object
182+ */
183+ esp_err_t bmi270_sensor_del (bmi270_handle_t handle );
184+
128185/**
129186 * \ingroup bmi270
130187 * \defgroup bmi270ApiInit Initialization
0 commit comments