EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #499 background imageLoading...
Page #499 background image
Chapter 2. API Reference
API Reference
The API of the USB Host Library is separated into the following header files. However, it is sufficient for applications
to only #include "usb/usb_host.h" and all of USB Host Library headers will also be included.
usb/include/usb/usb_host.h contains the functions and types of the USB Host Library
usb/include/usb/usb_helpers.h contains various helper functions that are related to the USB protocol such as
descriptor parsing.
usb/include/usb/usb_types_stack.h contains types that are are used across multiple layers of the USB Host
stack.
usb/include/usb/usb_types_ch9.h contains types and macros related to Chapter 9 of the USB2.0 specification
(i.e., descriptors and standard requests).
Header File
components/usb/include/usb/usb_host.h
Functions
esp_err_t usb_host_install(const usb_host_config_t *config)
Install the USB Host Library.
This function should only once to install the USB Host Library
This function should be called before any other USB Host Library functions are called
Return esp_err_t
Parameters
[in] config: USB Host Library configuration
esp_err_t usb_host_uninstall(void)
Uninstall the USB Host Library.
This function should be called to uninstall the USB Host Library, thereby freeing its resources
All clients must have been deregistered before calling this function
All devices must have been freed by calling usb_host_device_free_all() and receiving the
USB_HOST_LIB_EVENT_FLAGS_ALL_FREE event flag
Return esp_err_t
esp_err_t usb_host_lib_handle_events(TickType_t timeout_ticks, uint32_t *event_flags_ret)
Handle USB Host Library events.
This function handles all of the USB Host Librarys processing and should be called repeatedly in a loop
Check event_flags_ret to see if an flags are set indicating particular USB Host Library events
Note This function can block
Return esp_err_t
Parameters
[in] timeout_ticks: Timeout in ticks to wait for an event to occur
[out] event_flags_ret: Event flags that indicate what USB Host Library event occurred
esp_err_t usb_host_lib_unblock(void)
Unblock the USB Host Library handler.
This function simply unblocks the USB Host Library event handling function
(usb_host_lib_handle_events())
Return esp_err_t
esp_err_t usb_host_client_register(const usb_host_client_config_t *client_config,
usb_host_client_handle_t *client_hdl_ret)
Register a client of the USB Host Library.
This function registers a client of the USB Host Library
Once a client is registered, its processing function usb_host_client_handle_events() should be called re-
peatedly
Espressif Systems 488
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish