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

Function stop

Drivers/qmi8658-module/source/qmi8658.cpp:74–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74static 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

Callers

nothing calls this directly

Calls 3

device_get_parentFunction · 0.85
device_get_typeFunction · 0.85

Tested by

no test coverage detected