Hi I used the official program to initialize BMI270, but there was an error in the initialization program BMI270_Arduino_example_1:44:10: error: 'struct bmi2_dev' has no member named 'dev_id'
bmi2.dev_id = BMI270_CS; #include <SPI.h>
#include <bmi2.h>
#include <bmi270.h>
#include <bmi270_context.h>
#include <bmi2_defs.h>
#include <bmi2_ois.h>
#include <Arduino.h>
#define BMI270_CS SS
#define BMI270_INT1 6
/* Callback function prototypes for the BMI270 Sensor API */
int8_t bmi2_spi_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len);
int8_t bmi2_spi_write(uint8_t dev_id, uint8_t reg_addr, const uint8_t *data, uint16_t len);
void bmi2_delay_us(uint32_t period);
/* Static variables */
static struct bmi2_dev bmi2;
static volatile bool bmi2_intr_recvd = false;
static volatile uint32_t last_time_us = 0;
void setup(void)
{
int8_t rslt;
Serial.begin(115200);
while (!Serial.available()); // Wait for an input to proceed
pinMode(LED_BUILTIN, OUTPUT);
/* Use either the SPI or I2C configuration */
// /* Start of SPI configuration */
SPI.begin();
pinMode(BMI270_CS, OUTPUT);
digitalWrite(BMI270_CS, LOW);
delay(1);
digitalWrite(BMI270_CS, HIGH); // Toggle the chip select to switch into SPI mode
delay(10);
bmi2.dev_id = BMI270_CS;
bmi2.read = bmi2_spi_read;
bmi2.write = bmi2_spi_write;
bmi2.delay_us = bmi2_delay_us;
bmi2.intf = BMI2_SPI_INTERFACE;
bmi2.read_write_len = 8192;
bmi2.config_file_ptr = NULL; // Use the default BMI270 config file
/* End of SPI configuration */
rslt = bmi270_init(&bmi2);
print_rslt(rslt);
attachInterrupt(BMI270_INT1, bmi2_intr1_callback, RISING);
//rslt = configure_sensor(&bmi2);
//print_rslt(rslt);
}
... View more