|
EFR32 Blue Gecko 1 Software Documentation
efr32bg1-doc-5.1.2
|
Implements USB Communication Device Class (CDC).
The source code of the CDC implementation resides in kits/common/drivers/cdc.c and cdc.h. This driver implements a basic USB to RS232 bridge.
This section contains a description of the configuration options for the driver. The options are #define's which are expected to be found in the application "usbconfig.h" header file. The values shown below are from the Giant Gecko DK3750 CDC example.
// USB interface numbers. Interfaces are numbered from zero to one less than
// the number of concurrent interfaces supported by the configuration. A CDC
// device is by itself a composite device and has two interfaces.
// The interface numbers must be 0 and 1 for a standalone CDC device, for a
// composite device which includes a CDC interface it must not be in conflict
// with other device interfaces.
#define CDC_CTRL_INTERFACE_NO ( 0 )
#define CDC_DATA_INTERFACE_NO ( 1 )
// Endpoint address for CDC data reception.
#define CDC_EP_DATA_OUT ( 0x01 )
// Endpoint address for CDC data transmission.
#define CDC_EP_DATA_IN ( 0x81 )
// Endpoint address for the notification endpoint (not used).
#define CDC_EP_NOTIFY ( 0x82 )
// Timer id, see USBTIMER in the USB device stack documentation.
// The CDC driver has a Rx timeout functionality which require a timer.
#define CDC_TIMER_ID ( 0 )
// DMA related macros, select DMA channels and DMA request signals.
#define CDC_UART_TX_DMA_CHANNEL ( 0 )
#define CDC_UART_RX_DMA_CHANNEL ( 1 )
#define CDC_TX_DMA_SIGNAL DMAREQ_UART1_TXBL
#define CDC_RX_DMA_SIGNAL DMAREQ_UART1_RXDATAV
// UART/USART selection macros.
#define CDC_UART UART1
#define CDC_UART_CLOCK cmuClock_UART1
#define CDC_UART_ROUTE ( UART_ROUTE_RXPEN | UART_ROUTE_TXPEN | \
UART_ROUTE_LOCATION_LOC2 )
#define CDC_UART_TX_PORT gpioPortB
#define CDC_UART_TX_PIN 9
#define CDC_UART_RX_PORT gpioPortB
#define CDC_UART_RX_PIN 10
// Activate the RS232 switch on DK's.
#define CDC_ENABLE_DK_UART_SWITCH() BSP_PeripheralAccess(BSP_RS232_UART, true)
// No RS232 switch on STK's. Leave the definition "empty".
#define CDC_ENABLE_DK_UART_SWITCH() Functions | |
| void | CDC_Init (void) |
| CDC device initialization. | |
| int | CDC_SetupCmd (const USB_Setup_TypeDef *setup) |
| Handle USB setup commands. Implements CDC class specific commands. More... | |
| void | CDC_StateChangeEvent (USBD_State_TypeDef oldState, USBD_State_TypeDef newState) |
| Callback function called each time the USB device state is changed. Starts CDC operation when device has been configured by USB host. More... | |
| int CDC_SetupCmd | ( | const USB_Setup_TypeDef * | setup | ) |
Handle USB setup commands. Implements CDC class specific commands.
| [in] | setup | Pointer to the setup packet received. |
| void CDC_StateChangeEvent | ( | USBD_State_TypeDef | oldState, |
| USBD_State_TypeDef | newState | ||
| ) |