File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,21 @@ void BoschSensorClass::oneShotMode() {
142142 continuousMode.end ();
143143}
144144
145+ // default value is 1 (aps_on). power saving may prevent high odr setting to work properly
146+ bool BoschSensorClass::setAdvPowerSaveMode (uint8_t enable)
147+ {
148+ int8_t rslt = bmi2_set_adv_power_save (enable ? BMI2_ENABLE : BMI2_DISABLE, &bmi2);
149+ return (rslt == BMI2_OK);
150+ }
151+
152+ uint8_t BoschSensorClass::getAdvPowerSaveMode ()
153+ {
154+ uint8_t status = 0 ;
155+ if (bmi2_get_adv_power_save (&status, &bmi2) == BMI2_OK) {
156+ return status;
157+ }
158+ return 0 ;
159+ }
145160// default range is +-4G, so conversion factor is (((1 << 15)/4.0f))
146161#define INT16_to_G (8192 .0f )
147162
Original file line number Diff line number Diff line change @@ -135,7 +135,8 @@ class BoschSensorClass {
135135
136136 void setContinuousMode ();
137137 void oneShotMode ();
138-
138+ bool setAdvPowerSaveMode (uint8_t enable);
139+ uint8_t getAdvPowerSaveMode ();
139140 int begin (CfgBoshSensor_t cfg = BOSCH_ACCEL_AND_MAGN);
140141 void end ();
141142
You can’t perform that action at this time.
0 commit comments