MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / stop

Function stop

Drivers/bmi270-module/source/bmi270.cpp:133–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133static error_t stop(Device* device) {
134 auto* i2c_controller = device_get_parent(device);
135 if (device_get_type(i2c_controller) != &I2C_CONTROLLER_TYPE) {
136 LOG_E(TAG, "Parent is not an I2C controller");
137 return ERROR_RESOURCE;
138 }
139
140 auto address = GET_CONFIG(device)->address;
141
142 // Disable accelerometer and gyroscope (clear bit1=gyr_en, bit2=acc_en)
143 if (i2c_controller_register8_set(i2c_controller, address, REG_PWR_CTRL, 0x00, I2C_TIMEOUT_TICKS) != ERROR_NONE) {
144 LOG_E(TAG, "Failed to put BMI270 to sleep");
145 return ERROR_RESOURCE;
146 }
147
148 return ERROR_NONE;
149}
150
151// endregion
152

Callers

nothing calls this directly

Calls 3

device_get_parentFunction · 0.85
device_get_typeFunction · 0.85

Tested by

no test coverage detected