Skip to content

Commit

Permalink
Added interrupt pin selection to BMI088 (#23926)
Browse files Browse the repository at this point in the history
* Added interrupt pin selection to BMI088

* Fixed typo
  • Loading branch information
alexcekay authored and mrpollo committed Nov 12, 2024
1 parent a6777fa commit c49a57f
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/drivers/imu/bosch/bmi088/BMI088_Accelerometer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,13 @@ class BMI088_Accelerometer : public BMI088
{ Register::FIFO_WTM_1, 0, 0 },
{ Register::FIFO_CONFIG_0, FIFO_CONFIG_0_BIT::BIT1_ALWAYS | FIFO_CONFIG_0_BIT::FIFO_mode, 0 },
{ Register::FIFO_CONFIG_1, FIFO_CONFIG_1_BIT::BIT4_ALWAYS | FIFO_CONFIG_1_BIT::Acc_en, 0 },
# if defined(CONFIG_BMI088_ACCELEROMETER_INT1)
{ Register::INT1_IO_CONF, INT1_IO_CONF_BIT::int1_out, 0 },
{ Register::INT1_INT2_MAP_DATA, INT1_INT2_MAP_DATA_BIT::int1_fwm, 0},
# elif defined(CONFIG_BMI088_ACCELEROMETER_INT2)
{ Register::INT2_IO_CONF, INT2_IO_CONF_BIT::int2_out, 0 },
{ Register::INT1_INT2_MAP_DATA, INT1_INT2_MAP_DATA_BIT::int2_fwm, 0},
# endif
};
};

Expand Down
9 changes: 7 additions & 2 deletions src/drivers/imu/bosch/bmi088/BMI088_Gyroscope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,16 @@ class BMI088_Gyroscope : public BMI088
{ Register::GYRO_RANGE, GYRO_RANGE_BIT::gyro_range_2000_dps, 0 },
{ Register::GYRO_BANDWIDTH, 0, GYRO_BANDWIDTH_BIT::gyro_bw_532_Hz },
{ Register::GYRO_INT_CTRL, GYRO_INT_CTRL_BIT::fifo_en, 0 },
{ Register::INT3_INT4_IO_CONF, 0, INT3_INT4_IO_CONF_BIT::Int3_od | INT3_INT4_IO_CONF_BIT::Int3_lvl },
{ Register::INT3_INT4_IO_MAP, INT3_INT4_IO_MAP_BIT::Int3_fifo, 0 },
{ Register::FIFO_WM_ENABLE, FIFO_WM_ENABLE_BIT::fifo_wm_enable, 0 },
{ Register::FIFO_CONFIG_0, 0, 0 }, // fifo_water_mark_level_trigger_retain<6:0>
{ Register::FIFO_CONFIG_1, FIFO_CONFIG_1_BIT::FIFO_MODE, 0 },
#if defined(CONFIG_BMI088_GYROSCOPE_INT3)
{ Register::INT3_INT4_IO_CONF, 0, INT3_INT4_IO_CONF_BIT::Int3_od | INT3_INT4_IO_CONF_BIT::Int3_lvl },
{ Register::INT3_INT4_IO_MAP, INT3_INT4_IO_MAP_BIT::Int3_fifo, 0 },
# elif defined(CONFIG_BMI088_GYROSCOPE_INT4)
{ Register::INT3_INT4_IO_CONF, 0, INT3_INT4_IO_CONF_BIT::Int4_od | INT3_INT4_IO_CONF_BIT::Int4_lvl },
{ Register::INT3_INT4_IO_MAP, INT3_INT4_IO_MAP_BIT::Int4_fifo, 0 },
# endif
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ enum class Register : uint8_t {
FIFO_CONFIG_1 = 0x49,

INT1_IO_CONF = 0x53,
INT2_IO_CONF = 0x54,

INT1_INT2_MAP_DATA = 0x58,

Expand Down Expand Up @@ -113,10 +114,18 @@ enum FIFO_CONFIG_1_BIT : uint8_t {
enum INT1_IO_CONF_BIT : uint8_t {
int1_in = Bit4,
int1_out = Bit3,

int1_od = Bit2,
int1_lvl = Bit1,
};

// INT2_IO_CONF
enum INT2_IO_CONF_BIT : uint8_t {
int2_io = Bit4,
int2_out = Bit3,
int2_od = Bit2,
int2_lvl = Bit1,
};

// INT1_INT2_MAP_DATA
enum INT1_INT2_MAP_DATA_BIT : uint8_t {
int2_drdy = Bit6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ enum GYRO_INT_CTRL_BIT : uint8_t {

// INT3_INT4_IO_CONF
enum INT3_INT4_IO_CONF_BIT : uint8_t {
Int4_od = Bit3, // '0' Push-pull
Int4_lvl = Bit2, // '0' Active low
Int3_od = Bit1, // ‘0’ Push-pull
Int3_lvl = Bit0, // ‘0’ Active low
};
Expand Down
44 changes: 44 additions & 0 deletions src/drivers/imu/bosch/bmi088/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,47 @@ menuconfig DRIVERS_IMU_BOSCH_BMI088
default n
---help---
Enable support for bosch bmi088

if DRIVERS_IMU_BOSCH_BMI088

choice
prompt "BMI088 accelerometer interrupt pin"
default BMI088_ACCELEROMETER_INT1

config BMI088_ACCELEROMETER_INT_NONE
bool "No interrupts"
---help---
No pin on the BMI088 will output accelerometer interrupts

config BMI088_ACCELEROMETER_INT1
bool "INT1"
---help---
Use INT1 pin of the BMI088 to output accelerometer interrupts

config BMI088_ACCELEROMETER_INT2
bool "INT2"
---help---
Use INT2 pin of the BMI088 to output accelerometer interrupts
endchoice

choice
prompt "BMI088 gyroscope interrupt pin"
default BMI088_GYROSCOPE_INT3

config BMI088_GYROSCOPE_INT_NONE
bool "No interrupts"
---help---
No pin on the BMI088 will output gyroscope interrupts

config BMI088_GYROSCOPE_INT3
bool "INT3"
---help---
Use INT3 pin of the BMI088 to output gyroscope interrupts

config BMI088_GYROSCOPE_INT4
bool "INT4"
---help---
Use INT4 pin of the BMI088 to output gyroscope interrupts
endchoice

endif

0 comments on commit c49a57f

Please sign in to comment.