USB ACM/UART¶
Defines¶
MIRA_IODEF_USB¶
Types¶
mira_usb_uart_input_callback_t¶
Structs¶
mira_usb_config_t¶
Name | Type | Description |
---|---|---|
vendor_id |
unsigned short |
USB Vendor ID from USB-IF register |
product_id |
unsigned short |
Product ID |
Functions¶
mira_usb_uart_init¶
Initialize a USB uart module.
The custom config is passed as a parameter (NULL for platform default).
Note
this might start a higher resolution clock in the CPU, which can significantly increase the power consumption until CPU is restarted.
Parameters¶
Name | Description |
---|---|
config | Pointer to a configuration to setup. |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | USB was successfully initialized. |
MIRA_USB_ERROR_INIT | USB could not initialize. |
MIRA_ERROR_NOT_SUPPORTED | Invalid USB id. |
mira_usb_uart_set_input_callback¶
Set a callback to be called on usb byte input.
Parameters¶
Name | Description |
---|---|
cb | The callback to call. |
storage | Storage pointer which is used to store optional information to be used by the callback function. E.g. it could be used as an identifier or to pass on a configuration struct. |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | The callback was successfully set. |
mira_usb_uart_is_connected¶
Is the uart open?
Return value¶
true when the host has the uart open.