sparkfun / SparkFun_BMI270_Arduino_Library

Other
10 stars 4 forks source link

Add `skip_reset` option to `BMI270::begin*` methods, preventing soft reset during init #4

Closed disq closed 8 months ago

disq commented 8 months ago

This PR adds skip_reset to the following methods:

int8_t beginI2C(uint8_t address = BMI2_I2C_PRIM_ADDR, TwoWire& wirePort = Wire, bool skip_reset = false);
int8_t beginSPI(uint8_t csPin, uint32_t clockFrequency = 100000, bool skip_reset = false);

Useful when waking up from sleep and the IMU has already initialized. Preventing the soft reset lets us read IMU regs to get activity data (such as step count) while we were asleep.

sfe-SparkFro commented 8 months ago

Hi there, thanks for your contribution!

Unfortunately, I don't think we'll accept this PR as it is, because it modifies the underlying BMI270 API from Bosch. We're reluctant to modify their API, because if they roll out an update that we want to merge, then it's very likely to lead to merge conflicts.

I do think this is a good feature though, so I would suggest creating a similar PR in the Bosch BMI270 repo. If they accept it and roll out a new release, then we can bring in those changes and update the Arduino library to match.

disq commented 8 months ago

Opened https://github.com/boschsensortec/BMI270-Sensor-API/pull/24 we'll see how it goes.

sfe-SparkFro commented 8 months ago

Great!

I think I'll close this PR for now. If and when Bosch adds that feature, then please follow up and we can add that feature here too.

Thanks again!