1 /* 2 * Copyright (c) 2020 Google LLC 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief Public APIs for the CDC ACM class driver 10 */ 11 12 #ifndef ZEPHYR_INCLUDE_DRIVERS_UART_CDC_ACM_H_ 13 #define ZEPHYR_INCLUDE_DRIVERS_UART_CDC_ACM_H_ 14 15 #include <errno.h> 16 17 #include <zephyr/device.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif /* __cplusplus */ 22 23 /** 24 * @typedef cdc_dte_rate_callback_t 25 * @brief A function that is called when the USB host changes the baud 26 * rate. 27 * 28 * @param dev Device struct for the CDC ACM device. 29 * @param rate New USB baud rate 30 */ 31 typedef void (*cdc_dte_rate_callback_t)(const struct device *dev, 32 uint32_t rate); 33 34 /** 35 * @brief Set the callback for dwDTERate SetLineCoding requests. 36 * 37 * The callback is invoked when the USB host changes the baud rate. 38 * 39 * @note This function is available only when 40 * CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT is enabled. 41 * 42 * @param dev CDC ACM device structure. 43 * @param callback Event handler. 44 * 45 * @return 0 on success. 46 */ 47 int cdc_acm_dte_rate_callback_set(const struct device *dev, 48 cdc_dte_rate_callback_t callback); 49 50 #ifdef __cplusplus 51 } 52 #endif /* __cplusplus */ 53 54 #endif /* ZEPHYR_INCLUDE_DRIVERS_UART_CDC_ACM_H_ */ 55