File syn_usb_host_cdc.h¶
FileList > drivers > syn_usb_host_cdc.h
Go to the source code of this file
Zero-Heap USB 2.0 Host CDC ACM Class Driver. More...
#include "syntropic/common/syn_defs.h"#include "syntropic/drivers/syn_usb_cdc.h"#include "syntropic/drivers/syn_usb_host.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "syntropic/pt/syn_pt.h"
Classes¶
| Type | Name |
|---|---|
| struct | SYN_USB_HostCDC |
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_usb_host_cdc_init (SYN_USB_HostCDC * hcdc) Initialize USB Host CDC instance with defaults (115200 8N1). |
| SYN_Status | syn_usb_host_cdc_read (SYN_USB_HostCDC * hcdc, void * buf, size_t max_len, size_t * out_len) Read bytes from USB Host CDC RX buffer. |
| SYN_Status | syn_usb_host_cdc_register (SYN_USB_Host * host, SYN_USB_HostCDC * hcdc) Register USB Host CDC class driver with USB Host Core. |
| bool | syn_usb_host_cdc_rx_available (const SYN_USB_HostCDC * hcdc) Check if receive data is available. |
| bool | syn_usb_host_cdc_tx_ready (const SYN_USB_HostCDC * hcdc) Check if transmit buffer is ready. |
| SYN_Status | syn_usb_host_cdc_write (SYN_USB_HostCDC * hcdc, const void * data, size_t len) Write bytes to USB Host CDC TX buffer. |
Macros¶
| Type | Name |
|---|---|
| define | PT_USB_HOST_CDC_WAIT_RX (pt, hcdc) [**PT\_WAIT\_UNTIL**](syn__pt_8h.md#define-pt_wait_until)(pt, [**syn\_usb\_host\_cdc\_rx\_available**](syn__usb__host__cdc_8c.md#function-syn_usb_host_cdc_rx_available)(hcdc))Block a protothread coroutine until Host CDC RX data is available. |
| define | PT_USB_HOST_CDC_WAIT_TX_READY (pt, hcdc) [**PT\_WAIT\_UNTIL**](syn__pt_8h.md#define-pt_wait_until)(pt, [**syn\_usb\_host\_cdc\_tx\_ready**](syn__usb__host__cdc_8c.md#function-syn_usb_host_cdc_tx_ready)(hcdc))Block a protothread coroutine until Host CDC TX buffer is ready. |
| define | SYN_USB_HOST_CDC_BUF_SIZE 128U |
Detailed Description¶
Connects to downstream USB CDC ACM devices (serial adapters, modems, other MCUs in Device mode). Provides read/write buffers and protothread coroutine macros.
Public Functions Documentation¶
function syn_usb_host_cdc_init¶
Initialize USB Host CDC instance with defaults (115200 8N1).
Parameters:
hcdcPointer to USB Host CDC instance.
Returns:
SYN_OK on success.
function syn_usb_host_cdc_read¶
Read bytes from USB Host CDC RX buffer.
SYN_Status syn_usb_host_cdc_read (
SYN_USB_HostCDC * hcdc,
void * buf,
size_t max_len,
size_t * out_len
)
Parameters:
hcdcPointer to USB Host CDC instance.bufPointer to destination buffer.max_lenMax capacity.out_lenPointer to receive read byte count.
Returns:
SYN_OK on success.
function syn_usb_host_cdc_register¶
Register USB Host CDC class driver with USB Host Core.
Parameters:
hostPointer to USB Host instance.hcdcPointer to USB Host CDC instance.
Returns:
SYN_OK on success.
function syn_usb_host_cdc_rx_available¶
Check if receive data is available.
Parameters:
hcdcPointer to USB Host CDC instance.
Returns:
true if unread data is present.
function syn_usb_host_cdc_tx_ready¶
Check if transmit buffer is ready.
Parameters:
hcdcPointer to USB Host CDC instance.
Returns:
true if transmit buffer is available.
function syn_usb_host_cdc_write¶
Write bytes to USB Host CDC TX buffer.
Parameters:
hcdcPointer to USB Host CDC instance.dataPointer to data bytes.lenByte length.
Returns:
SYN_OK on success.
Macro Definition Documentation¶
define PT_USB_HOST_CDC_WAIT_RX¶
Block a protothread coroutine until Host CDC RX data is available.
#define PT_USB_HOST_CDC_WAIT_RX (
pt,
hcdc
) `PT_WAIT_UNTIL (pt, syn_usb_host_cdc_rx_available (hcdc))`
Parameters:
ptProtothread context.hcdcPointer to USB Host CDC instance.
define PT_USB_HOST_CDC_WAIT_TX_READY¶
Block a protothread coroutine until Host CDC TX buffer is ready.
#define PT_USB_HOST_CDC_WAIT_TX_READY (
pt,
hcdc
) `PT_WAIT_UNTIL (pt, syn_usb_host_cdc_tx_ready (hcdc))`
Parameters:
ptProtothread context.hcdcPointer to USB Host CDC instance.
define SYN_USB_HOST_CDC_BUF_SIZE¶
RX/TX buffer size
The documentation for this class was generated from the following file src/syntropic/drivers/syn_usb_host_cdc.h