tusb_tasks.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include "esp_err.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /**
  12. * @brief This helper function creates and starts a task which wraps `tud_task()`.
  13. *
  14. * The wrapper function basically wraps tud_task and some log.
  15. * Default parameters: stack size and priority as configured, argument = NULL, not pinned to any core.
  16. * If you have more requirements for this task, you can create your own task which calls tud_task as the last step.
  17. *
  18. * @retval ESP_OK run tinyusb main task successfully
  19. * @retval ESP_FAIL run tinyusb main task failed of internal error
  20. * @retval ESP_ERR_INVALID_STATE tinyusb main task has been created before
  21. */
  22. esp_err_t tusb_run_task(void);
  23. /**
  24. * @brief This helper function stops and destroys the task created by `tusb_run_task()`
  25. *
  26. * @retval ESP_OK stop and destory tinyusb main task successfully
  27. * @retval ESP_ERR_INVALID_STATE tinyusb main task hasn't been created yet
  28. */
  29. esp_err_t tusb_stop_task(void);
  30. #ifdef __cplusplus
  31. }
  32. #endif