| 131 | } |
| 132 | |
| 133 | static 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 |
nothing calls this directly
no test coverage detected