#ifndef SERIAL_USB_HOST_H #define SERIAL_USB_HOST_H #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" #include "freertos/task.h" #include "usb/cdc_acm_host.h" #include "usb/vcp_ch34x.hpp" #include "usb/vcp_cp210x.hpp" #include "usb/vcp_ftdi.hpp" #include "usb/vcp.hpp" #include "usb/usb_host.h" #include class SerialUSBHost { public: SerialUSBHost() = delete; static void init(uint32_t baudrate, uint8_t stop_bits, uint8_t parity, uint8_t dataBits); private: /** * @brief Device event callback * * Apart from handling device disconnection it doesn't do anything useful * * @param[in] event Device event type and data * @param[in] user_ctx Argument we passed to the device open function */ static void handle_event(const cdc_acm_host_dev_event_data_t *event, void *user_ctx); /** * @brief Data received callback * * Just pass received data to stdout * * @param[in] data Pointer to received data * @param[in] data_len Length of received data in bytes * @param[in] arg Argument we passed to the device open function * @return * true: We have processed the received data * false: We expect more data */ static bool handle_rx(const uint8_t *data, size_t data_len, void *arg); /** * @brief USB Host library handling task * * @param arg unused but required for task */ static void usb_lib_task(void* arg); static void mainTask(void* arg); }; #endif