nRF52840 only: Module with types, definitions and API used by CDC ACM class. More...
Modules | |
USB CDC ACM class configuration | |
USB CDC ACM internals | |
nRF52840 only: Internals of the USB ACM class implementation. | |
CDC class descriptors | |
nRF52840 only: Descriptors used in the USB CDC class implementation.A group of macros used to initialize CDC descriptors | |
CDC class types | |
nRF52840 only: Variable types used by the CDC class implementation. | |
Data Structures | |
struct | app_usbd_cdc_acm_t |
CDC ACM class instance type. More... | |
Macros | |
#define | APP_USBD_CDC_ACM_DEFAULT_DESC(comm_interface,comm_epin,data_interface,data_epin,data_epout) |
Default CDC ACM descriptors. More... | |
#define | APP_USBD_CDC_ACM_GLOBAL_DEF(instance_name,interfaces_configs,user_ev_handler,raw_descriptors) |
Global definition of app_usbd_cdc_acm_t class instance. More... | |
Typedefs | |
typedef enum app_usbd_cdc_acm_user_event_e | app_usbd_cdc_acm_user_event_t |
Events passed to user event handler. More... | |
Enumerations | |
enum | app_usbd_cdc_acm_user_event_e { APP_USBD_CDC_ACM_USER_EVT_RX_DONE, APP_USBD_CDC_ACM_USER_EVT_TX_DONE, APP_USBD_CDC_ACM_USER_EVT_PORT_OPEN, APP_USBD_CDC_ACM_USER_EVT_PORT_CLOSE } |
Events passed to user event handler. More... | |
enum | app_usbd_cdc_acm_serial_state_t { APP_USBD_CDC_ACM_SERIAL_STATE_DCD = (1u << 0), APP_USBD_CDC_ACM_SERIAL_STATE_DSR = (1u << 1), APP_USBD_CDC_ACM_SERIAL_STATE_BREAK = (1u << 2), APP_USBD_CDC_ACM_SERIAL_STATE_RING = (1u << 3), APP_USBD_CDC_ACM_SERIAL_STATE_FRAMING = (1u << 4), APP_USBD_CDC_ACM_SERIAL_STATE_PARITY = (1u << 5), APP_USBD_CDC_ACM_SERIAL_STATE_OVERRUN = (1u << 6) } |
Serial state notifications. More... | |
enum | app_usbd_cdc_acm_line_state_t { APP_USBD_CDC_ACM_LINE_STATE_DTR = (1u << 0), APP_USBD_CDC_ACM_LINE_STATE_RTS = (1u << 1) } |
Serial line state. More... | |
Functions | |
static app_usbd_class_inst_t const * | app_usbd_cdc_acm_class_inst_get (app_usbd_cdc_acm_t const *p_cdc_acm) |
Helper function to get class instance from CDC ACM class. More... | |
static app_usbd_cdc_acm_req_t * | app_usbd_cdc_acm_class_request_get (app_usbd_cdc_acm_t const *p_cdc_acm) |
Helper function to get cdc_acm specific request from cdc_acm class. More... | |
static app_usbd_cdc_acm_t const * | app_usbd_cdc_acm_class_get (app_usbd_class_inst_t const *p_inst) |
Helper function to get cdc_acm from base class instance. More... | |
ret_code_t | app_usbd_cdc_acm_write (app_usbd_cdc_acm_t const *p_cdc_acm, const void *p_buf, size_t length) |
Writes data to CDC ACM serial port. More... | |
size_t | app_usbd_cdc_acm_rx_size (app_usbd_cdc_acm_t const *p_cdc_acm) |
Returns the amount of data to be read. More... | |
ret_code_t | app_usbd_cdc_acm_read (app_usbd_cdc_acm_t const *p_cdc_acm, void *p_buf, size_t length) |
Reads data from CDC ACM serial port. More... | |
ret_code_t | app_usbd_cdc_acm_serial_state_notify (app_usbd_cdc_acm_t const *p_cdc_acm, app_usbd_cdc_acm_serial_state_t serial_state, bool value) |
Serial state notification via IN interrupt endpoint. More... | |
ret_code_t | app_usbd_cdc_acm_line_state_get (app_usbd_cdc_acm_t const *p_cdc_acm, app_usbd_cdc_acm_line_state_t line_state, uint32_t *value) |
Control line value get. More... | |
nRF52840 only: Module with types, definitions and API used by CDC ACM class.
References:
#define APP_USBD_CDC_ACM_DEFAULT_DESC | ( | comm_interface, | |
comm_epin, | |||
data_interface, | |||
data_epin, | |||
data_epout | |||
) |
Default CDC ACM descriptors.
comm_interface | COMM interface number. |
comm_epin | COMM interface IN endpoint. |
data_interface | DATA interface number. |
data_epin | DATA interface IN endpoint. |
data_epout | DATA interface OUT endpoint. |
#define APP_USBD_CDC_ACM_GLOBAL_DEF | ( | instance_name, | |
interfaces_configs, | |||
user_ev_handler, | |||
raw_descriptors | |||
) |
Global definition of app_usbd_cdc_acm_t class instance.
instance_name | Name of global instance. |
interfaces_configs | Interfaces configurations. |
user_ev_handler | User event handler (optional). |
raw_descriptors | Raw descriptor table. |
Events passed to user event handler.
Serial state notifications.
Events passed to user event handler.
|
inlinestatic |
Helper function to get cdc_acm from base class instance.
[in] | p_inst | Base class instance. |
|
inlinestatic |
Helper function to get class instance from CDC ACM class.
[in] | p_cdc_acm | CDC ACM class instance (defined by APP_USBD_CDC_ACM_GLOBAL_DEF). |
|
inlinestatic |
Helper function to get cdc_acm specific request from cdc_acm class.
[in] | p_cdc_acm | CDC ACM class instance (defined by APP_USBD_CDC_ACM_GLOBAL_DEF). |
ret_code_t app_usbd_cdc_acm_line_state_get | ( | app_usbd_cdc_acm_t const * | p_cdc_acm, |
app_usbd_cdc_acm_line_state_t | line_state, | ||
uint32_t * | value | ||
) |
Control line value get.
[in] | p_cdc_acm | CDC ACM class instance (defined by APP_USBD_CDC_ACM_GLOBAL_DEF). |
[in] | line_state | Line control value type. |
[out] | value | Line control value. |
ret_code_t app_usbd_cdc_acm_read | ( | app_usbd_cdc_acm_t const * | p_cdc_acm, |
void * | p_buf, | ||
size_t | length | ||
) |
Reads data from CDC ACM serial port.
[in] | p_cdc_acm | CDC ACM class instance (defined by APP_USBD_CDC_ACM_GLOBAL_DEF). |
[out] | p_buf | Output buffer. |
[in] | length | Output buffer length (must by multiple of NRF_DRV_USBD_EPSIZE). |
size_t app_usbd_cdc_acm_rx_size | ( | app_usbd_cdc_acm_t const * | p_cdc_acm | ) |
Returns the amount of data to be read.
This function should be used on APP_USBD_CDC_ACM_USER_EVT_RX_DONE event to get information how many bytes have been transfered.
[in] | p_cdc_acm | CDC ACM class instance (defined by APP_USBD_CDC_ACM_GLOBAL_DEF). |
ret_code_t app_usbd_cdc_acm_serial_state_notify | ( | app_usbd_cdc_acm_t const * | p_cdc_acm, |
app_usbd_cdc_acm_serial_state_t | serial_state, | ||
bool | value | ||
) |
Serial state notification via IN interrupt endpoint.
[in] | p_cdc_acm | CDC ACM class instance (defined by APP_USBD_CDC_ACM_GLOBAL_DEF). |
[in] | serial_state | Serial state notification type. |
[in] | value | Serial state value. |
ret_code_t app_usbd_cdc_acm_write | ( | app_usbd_cdc_acm_t const * | p_cdc_acm, |
const void * | p_buf, | ||
size_t | length | ||
) |
Writes data to CDC ACM serial port.
This is asynchronous call. User should wait for APP_USBD_CDC_ACM_USER_EVT_TX_DONE event to be sure that all data has been sent and input buffer could be accessed again.
[in] | p_cdc_acm | CDC ACM class instance (defined by APP_USBD_CDC_ACM_GLOBAL_DEF). |
[in] | p_buf | Input buffer. |
[in] | length | Input buffer length. |