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

Function close

Platforms/platform-esp32/source/drivers/esp32_uart.cpp:321–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319}
320
321static error_t close(Device* device) {
322 ESP_LOGI(TAG, "%s close", device->name);
323 if (xPortInIsrContext()) return ERROR_ISR_STATUS;
324 auto* driver_data = GET_DATA(device);
325 auto* dts_config = GET_CONFIG(device);
326
327 lock(driver_data);
328 if (!driver_data->is_open) {
329 unlock(driver_data);
330 LOG_W(TAG, "Already closed");
331 return ERROR_INVALID_STATE;
332 }
333 uart_driver_delete(dts_config->port);
334 driver_data->cleanup_pins();
335 driver_data->is_open = false;
336 unlock(driver_data);
337
338 return ERROR_NONE;
339}
340
341static bool is_open(Device* device) {
342 auto* driver_data = GET_DATA(device);

Callers 1

~ObjectFileWriterMethod · 0.85

Calls 3

lockFunction · 0.70
unlockFunction · 0.70
cleanup_pinsMethod · 0.45

Tested by

no test coverage detected