Contiki 2.6

CDC Task

Functions

void uart_usb_init (void)
 Initializes the uart_usb library.
bit uart_usb_tx_ready (void)
 This function checks if the USB emission buffer is ready to accept at at least 1 byte.
int uart_usb_putchar (int data_to_send)
 This function fills the USB transmit buffer with the new data.
bit uart_usb_test_hit (void)
 This function checks if a character has been received on the USB bus.
char uart_usb_getchar (void)
 This function reads one byte from the USB bus.
void uart_usb_flush (void)
 This function sends the data stored in the USB transmit buffer.
void menu_print (void)
 Print debug menu.
void menu_process (char c)
 Process incomming char on debug port.
 PROCESS_THREAD (cdc_process, ev, data_proc)
 Communication Data Class (CDC) Process.
void vcptx_end_led (void)
 This will enable the VCP_TRX_END LED for a period.

Variables

Uchar tx_counter
 Counter for USB Serial port.
U8 tx_counter
 Counter for USB Serial port.
uint8_t led3_timer
 Timers for LEDs.

Function Documentation

PROCESS_THREAD ( cdc_process  ,
ev  ,
data_proc   
)

Communication Data Class (CDC) Process.

This is the link between USB and the "good stuff". In this routine data is received and processed by CDC-ACM Class

Definition at line 141 of file cdc_task.c.

References CLOCK_SECOND, etimer_expired(), etimer_set(), Is_device_enumerated, led3_timer, menu_process(), NULL, PROCESS_BEGIN, PROCESS_END, PROCESS_WAIT_EVENT_UNTIL, tx_counter, uart_usb_flush(), uart_usb_getchar(), uart_usb_init(), uart_usb_test_hit(), and usb_configuration_nb.

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.

Definition at line 299 of file uart_usb_lib.c.

References tx_counter, Usb_select_endpoint, and Usb_send_in.

Referenced by menu_process(), PROCESS_THREAD(), 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:
U8 byte received

Definition at line 270 of file uart_usb_lib.c.

References uart_usb_putchar(), uart_usb_test_hit(), Usb_ack_receive_out, Usb_read_byte, and Usb_select_endpoint.

Referenced by PROCESS_THREAD().

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_sendData to send
Returns:
data_to_send Data that was sent

Definition at line 206 of file uart_usb_lib.c.

References Is_usb_write_enabled, tx_counter, uart_usb_flush(), uart_usb_tx_ready(), Usb_select_endpoint, and Usb_write_byte.

Referenced by menu_process(), and uart_usb_getchar().

bit uart_usb_test_hit ( void  )

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

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

Definition at line 241 of file uart_usb_lib.c.

References Is_usb_receive_out, Usb_ack_receive_out, Usb_byte_counter, and Usb_select_endpoint.

Referenced by PROCESS_THREAD(), and uart_usb_getchar().

bit uart_usb_tx_ready ( void  )

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

Return values:
TRUEif the firmware can write a new byte to transmit.
FALSEotherwise

Definition at line 187 of file uart_usb_lib.c.

References FALSE, Is_usb_write_enabled, TRUE, and Usb_select_endpoint.

Referenced by uart_usb_putchar().