Skip to content

Commit

Permalink
Add pull-up registers configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
deiteris committed Oct 8, 2022
1 parent b0c53b0 commit 11d1b18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/bmi160/BMI160.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ void BMI160::initialize(uint8_t addr)
setRegister(BMI160_RA_CMD, BMI160_CMD_MAG_MODE_NORMAL);
delay(60);

setRegister(BMI160_RA_CMD, BMI160_EN_PULL_UP_REG_1);
setRegister(BMI160_RA_CMD, BMI160_EN_PULL_UP_REG_2);
setRegister(BMI160_RA_CMD, BMI160_EN_PULL_UP_REG_3);
setRegister(BMI160_7F, BMI160_EN_PULL_UP_REG_4);
setRegister(BMI160_7F, BMI160_EN_PULL_UP_REG_5);

/* Set MAG I2C address */
setRegister(BMI160_MAG_IF_0, 0x0D >> 1); // 0 bit of address is reserved and needs to be shited

Expand Down
8 changes: 8 additions & 0 deletions lib/bmi160/BMI160.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ THE SOFTWARE.

#define BMI160_CMD_MAG_MODE_NORMAL 0x19

#define BMI160_EN_PULL_UP_REG_1 0x37
#define BMI160_EN_PULL_UP_REG_2 0x9A
#define BMI160_EN_PULL_UP_REG_3 0xC0
#define BMI160_EN_PULL_UP_REG_4 0x90
#define BMI160_EN_PULL_UP_REG_5 0x80

#define BMI160_7F 0x7F

#define BMI160_ACC_PMU_STATUS_BIT 4
#define BMI160_ACC_PMU_STATUS_LEN 2
#define BMI160_GYR_PMU_STATUS_BIT 2
Expand Down

0 comments on commit 11d1b18

Please sign in to comment.