Microchip® Advanced Software Framework

uart_usb_lib.h File Reference

Functions

void uart_usb_flush (void)
 This function sends the data stored in the USB transmit buffer. More...
 
char uart_usb_getchar (void)
 This function reads one byte from the USB bus. More...
 
void uart_usb_init (void)
 This function initializes the UART over USB emulation driver. More...
 
int uart_usb_putchar (int data_to_send)
 This function fills the USB transmit buffer with the new data. More...
 
bool uart_usb_test_hit (void)
 This function checks if a character has been received on the USB bus. More...
 
bool uart_usb_tx_ready (void)
 This function checks if the USB emission buffer is ready to accept at at least 1 byte. More...
 

void uart_usb_flush ( void  )

This function sends the data stored in the USB transmit buffer.

This function does nothing if there is no data in the buffer.

References b_tx_new, Is_usb_write_enabled, TX_EP, and Usb_ack_in_ready_send.

Referenced by device_cdc_task(), and uart_usb_putchar().

char uart_usb_getchar ( void  )

This function reads one byte from the USB bus.

If one byte is present in the USB fifo, this byte is returned. If no data is present in the USB fifo, this function waits for USB data.

Returns
uint8_t byte received

References b_rx_new, RX_EP, uart_usb_test_hit(), Usb_ack_out_received_free, Usb_byte_count, and Usb_read_endpoint_data.

Referenced by device_cdc_task().

void uart_usb_init ( void  )

This function initializes the UART over USB emulation driver.

References b_rx_new, and b_tx_new.

Referenced by device_cdc_task_init().

int uart_usb_putchar ( int  data_to_send)

This function fills the USB transmit buffer with the new data.

This buffer is sent if complete. To flush this buffer before waiting full, launch the uart_usb_flush() function.

Parameters
data_to_send
Returns

References Is_usb_write_enabled, TX_EP, uart_usb_flush(), uart_usb_tx_ready(), and Usb_write_endpoint_data.

Referenced by device_cdc_task().

bool uart_usb_test_hit ( void  )

This function checks if a character has been received on the USB bus.

Returns
bool (true if a byte is ready to be read)

References b_rx_new, Is_usb_out_received, RX_EP, Usb_ack_out_received_free, Usb_byte_count, and Usb_reset_endpoint_fifo_access.

Referenced by device_cdc_task(), and uart_usb_getchar().

bool uart_usb_tx_ready ( void  )

This function checks if the USB emission buffer is ready to accept at at least 1 byte.

Returns
Boolean. true if the firmware can write a new byte to transmit.

References b_tx_new, Is_usb_write_enabled, TX_EP, and Usb_reset_endpoint_fifo_access.

Referenced by device_cdc_task(), and uart_usb_putchar().