ClearCore Library
|
USB manager Class.
Generates a mask for all of the items in the USB_STATUS_REG_LIST. Appends the text "Mask" to the item in the list.
e.g. The mask for TimeoutRead is TimeoutReadMask
Implements a CDC (Communications Device Class) USB device. The CDC uses an abstract control model (ACM) to emulate a serial port.
Reading: Upon receiving data (interrupt based), the data is copied into a circular buffer. When the buffer is full, the receipt of data is acknowledged, but not copied into the buffer. Data is drained from the buffer via the Read function. To Query the number of available bytes call Available().
Writing: Small transfers (less than a packet size) are copied into a buffer and sent in the background. Larger transfers are still sent in the background, but are not buffered. This means that the pointer to the data must remain valid during the sending procedure.
USB manager Class. More...
#include <UsbManager.h>
Public Member Functions | |
bool | Speed (uint32_t bitsPerSecond) |
Change the baud rate for the port. | |
uint32_t | Speed () |
Get current port speed. | |
bool | PortIsOpen () |
Return whether or not the USB port is open. | |
void | PortOpen () |
void | PortClose () |
void | FlushInput () |
void | WaitForWriteFinish () |
int32_t | AvailableForRead () |
int32_t | AvailableForWrite () |
Determines the number of characters available in the transmit buffer. | |
int16_t | CharGet () |
Attempt to read the next character from serial channel. | |
int16_t | CharPeek () |
Attempt to get the next character from the serial channel without pulling the character out of the buffer. | |
bool | SendChar (uint8_t charToSend) |
Send an ascii character on the serial channel. | |
operator bool () | |
Returns whether USB is connected and operational. | |
const volatile usb_cdc_control_signal_t & | LineState () |
int32_t ClearCore::UsbManager::AvailableForRead | ( | ) |
Returns number of characters waiting in the receive buffer.
int32_t ClearCore::UsbManager::AvailableForWrite | ( | ) |
Determines the number of characters available in the transmit buffer.
int16_t ClearCore::UsbManager::CharGet | ( | ) |
Attempt to read the next character from serial channel.
int16_t ClearCore::UsbManager::CharPeek | ( | ) |
Attempt to get the next character from the serial channel without pulling the character out of the buffer.
bool ClearCore::UsbManager::PortIsOpen | ( | ) |
Return whether or not the USB port is open.
bool ClearCore::UsbManager::SendChar | ( | uint8_t | charToSend | ) |
Send an ascii character on the serial channel.
[in] | charToSend | The character to be sent |
uint32_t ClearCore::UsbManager::Speed | ( | ) |
Get current port speed.
bool ClearCore::UsbManager::Speed | ( | uint32_t | bitsPerSecond | ) |
Change the baud rate for the port.
[in] | bitsPerSecond | The new speed setting |