| 72 | } |
| 73 | |
| 74 | static error_t stop(Device* device) { |
| 75 | auto* i2c_controller = device_get_parent(device); |
| 76 | if (device_get_type(i2c_controller) != &I2C_CONTROLLER_TYPE) { |
| 77 | LOG_E(TAG, "Parent is not an I2C controller"); |
| 78 | return ERROR_RESOURCE; |
| 79 | } |
| 80 | |
| 81 | auto address = GET_CONFIG(device)->address; |
| 82 | |
| 83 | // Put device to sleep |
| 84 | if (i2c_controller_register8_set(i2c_controller, address, REG_CTRL7, 0x00, I2C_TIMEOUT_TICKS) != ERROR_NONE) { |
| 85 | LOG_E(TAG, "Failed to put QMI8658 to sleep"); |
| 86 | return ERROR_RESOURCE; |
| 87 | } |
| 88 | |
| 89 | return ERROR_NONE; |
| 90 | } |
| 91 | |
| 92 | // endregion |
| 93 |
nothing calls this directly
no test coverage detected