Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add skip_reset bmi270_init, preventing soft reset during init #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

disq
Copy link

@disq disq commented Jan 18, 2024

This PR adds skip_reset option to bmi270_init. 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.

@@ -150,7 +150,7 @@ extern "C" {
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi270_init(struct bmi2_dev *dev);
int8_t bmi270_init(struct bmi2_dev *dev, uint8_t skip_reset);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO you shouldn't modify the API, it will break all examples, and also all applications already using it, and just updating the driver.

Instead add a new API, bmi270_init_opt or smth else then:

int8_t bmi270_init(struct bmi2_dev *dev)
{
 return bmi270_init_opt(dev, false);
}

int8_t bmi270_init_opt(struct bmi2_dev *dev, uint8_t skip_reset) {
....
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants