File syn_usb_cdc.c¶
FileList > drivers > syn_usb_cdc.c
Go to the source code of this file
Zero-Heap USB 2.0 CDC ACM Virtual COM Port Class Engine Implementation.
#include "syntropic/drivers/syn_usb_cdc.h"#include <string.h>
Public Static Attributes¶
| Type | Name |
|---|---|
| const uint8_t | CDC_INTERFACE_DESC = /* multi line expression */ |
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_usb_cdc_handle_setup (SYN_USB_CDC * cdc, const SYN_USB_SetupPacket * setup, uint8_t * resp, size_t * rlen) Handle Control Setup Request from host (EP0). |
| SYN_Status | syn_usb_cdc_init (SYN_USB_CDC * cdc) Initialize USB CDC Class instance with defaults (115200 baud, 8N1). |
| SYN_Status | syn_usb_cdc_read (SYN_USB_CDC * cdc, void * buf, size_t max_len, size_t * out_len) Read bytes from USB CDC Bulk OUT receive buffer. |
| SYN_Status | syn_usb_cdc_register (SYN_USB_Device * dev, SYN_USB_CDC * cdc) Register USB CDC ACM class driver with USB device core. |
| bool | syn_usb_cdc_rx_available (const SYN_USB_CDC * cdc) Check if receive data is available. |
| bool | syn_usb_cdc_tx_ready (const SYN_USB_CDC * cdc) Check if transmit buffer is ready. |
| SYN_Status | syn_usb_cdc_write (SYN_USB_CDC * cdc, const void * data, size_t len) Write bytes to USB CDC Bulk IN transmit buffer. |
Public Static Functions¶
| Type | Name |
|---|---|
| SYN_Status | cdc_class_configured (void * ctx, uint8_t config) Configured callback wrapper for CDC class. |
| SYN_Status | cdc_class_setup (void * ctx, const SYN_USB_SetupPacket * pkt, uint8_t * resp, uint16_t * rlen) Setup request callback wrapper for CDC class requests. |
Public Static Attributes Documentation¶
variable CDC_INTERFACE_DESC¶
Standard CDC Interface Descriptor Assembly (2 interfaces, 3 endpoints, 67 bytes)
Public Functions Documentation¶
function syn_usb_cdc_handle_setup¶
Handle Control Setup Request from host (EP0).
SYN_Status syn_usb_cdc_handle_setup (
SYN_USB_CDC * cdc,
const SYN_USB_SetupPacket * setup,
uint8_t * resp,
size_t * rlen
)
Parameters:
cdcPointer to USB CDC instance.setupPointer to setup packet.respPointer to response buffer.rlenPointer to receive response length.
Returns:
SYN_OK on success.
function syn_usb_cdc_init¶
Initialize USB CDC Class instance with defaults (115200 baud, 8N1).
Parameters:
cdcPointer to USB CDC instance.
Returns:
SYN_OK on success.
function syn_usb_cdc_read¶
Read bytes from USB CDC Bulk OUT receive buffer.
Parameters:
cdcPointer to USB CDC instance.bufPointer to destination buffer.max_lenMax capacity.out_lenPointer to receive read byte count.
Returns:
SYN_OK on success.
function syn_usb_cdc_register¶
Register USB CDC ACM class driver with USB device core.
Parameters:
devPointer to USB device core context.cdcPointer to USB CDC instance.
Returns:
SYN_OK on success.
function syn_usb_cdc_rx_available¶
Check if receive data is available.
Parameters:
cdcPointer to USB CDC instance.
Returns:
true if unread data is present in rx_buf.
function syn_usb_cdc_tx_ready¶
Check if transmit buffer is ready.
Parameters:
cdcPointer to USB CDC instance.
Returns:
true if transmit buffer is available.
function syn_usb_cdc_write¶
Write bytes to USB CDC Bulk IN transmit buffer.
Parameters:
cdcPointer to USB CDC instance.dataPointer to data bytes.lenByte length.
Returns:
SYN_OK on success.
Public Static Functions Documentation¶
function cdc_class_configured¶
Configured callback wrapper for CDC class.
Parameters:
ctxPointer to SYN_USB_CDC instance.configConfiguration index (0 = unconfigured).
Returns:
SYN_OK on success.
function cdc_class_setup¶
Setup request callback wrapper for CDC class requests.
static SYN_Status cdc_class_setup (
void * ctx,
const SYN_USB_SetupPacket * pkt,
uint8_t * resp,
uint16_t * rlen
)
Parameters:
ctxPointer to SYN_USB_CDC instance.pktPointer to received Setup Packet.respOutput buffer for data stage response.rlenPointer to receive response length.
Returns:
SYN_OK on success.
The documentation for this class was generated from the following file src/syntropic/drivers/syn_usb_cdc.c