espressif_idf-extra-components/usb/esp_modem_usb_dte
Daniel Paul 458086bb45 Added badges with version to the README files of components 2022-12-14 12:16:40 +01:00
..
include usb: esp_modem biding 2022-10-01 15:59:55 +02:00
private_include usb: esp_modem biding 2022-10-01 15:59:55 +02:00
CMakeLists.txt usb: esp_modem biding 2022-10-01 15:59:55 +02:00
LICENSE usb: esp_modem biding 2022-10-01 15:59:55 +02:00
README.md Added badges with version to the README files of components 2022-12-14 12:16:40 +01:00
esp_modem_usb.cpp usb: esp_modem biding 2022-10-01 15:59:55 +02:00
esp_modem_usb_api_target.cpp usb: esp_modem biding 2022-10-01 15:59:55 +02:00
esp_modem_usb_c_api.cpp usb: esp_modem biding 2022-10-01 15:59:55 +02:00
idf_component.yml usb: esp_modem biding 2022-10-01 15:59:55 +02:00

README.md

USB DTE plugin for esp_modem

Component Registry

⚠️ Experimental feature: USB DTE is under development!

This component extends esp_modem with USB DTE.

Examples

For example usage see esp_modem examples:

USB hotplugging and reconnection

USB DTE supports device reconnection and hot-plugging. You must only register callback function for DEVICE_GONE event and react accordingly:

C++ with lambda callback:

auto dte = create_usb_dte(&dte_config);
dte->set_error_cb([&](terminal_error err) {
    if (err == terminal_error::DEVICE_GONE) {
        // Signal your application that USB modem device has been disconnected
    }
});

C:

static void usb_terminal_error_handler(esp_modem_terminal_error_t err) {
    if (err == ESP_MODEM_TERMINAL_DEVICE_GONE) {
        // Signal your application that USB modem device has been disconnected
    }
}
esp_modem_dce_t *dce = esp_modem_new_dev_usb(ESP_MODEM_DCE_BG96, &dte_usb_config, &dce_config, esp_netif);
esp_modem_set_error_cb(dce, usb_terminal_error_handler);