17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

usb_kbhit(endpoint)<br />

usb_get_packet<br />

(endpoint, ptr, max)<br />

Returns TRUE if the specified endpoint has data in it's receive buffer<br />

Reads up to max bytes from the specified endpoint buffer and saves it<br />

to the pointer ptr. Returns the number of bytes saved to ptr.<br />

usb_gets(endpoint, ptr,<br />

max, timeout)<br />

Reads a message from the specified endpoint. The difference<br />

usb_get_packet() and usb_gets() is that usb_gets() will wait until a full<br />

message has received, which a message may contain more than one<br />

packet. Returns the number of bytes received.<br />

Relevant CDC<br />

Functions:<br />

A CDC USB device will emulate an RS-232 device, and will appear on your PC as a COM port.<br />

The follow functions provide you this virtual RS-232/serial interface<br />

Note: When using the CDC library, you can use the same functions above, but do not use the<br />

packet related function such as<br />

usb_kbhit(), usb_get_packet(), etc.<br />

usb_cdc_kbhit()<br />

usb_cdc_getc()<br />

usb_cdc_putc(c)<br />

usb_cdc_putc_fast(c)<br />

usb_cdc_puts(*str)<br />

usb_cdc_putready()<br />

The same as kbhit(), returns TRUE if there is 1 or more character in the<br />

receive buffer.<br />

The same as getc(), reads and returns a character from the receive<br />

buffer. If there is no data in the receive buffer it will wait indefinitely until<br />

there a character has been received.<br />

The same as putc(), sends a character. It actually puts a character into<br />

the transmit buffer, and if the transmit buffer is full will wait indefinitely<br />

until there is space for the character.<br />

The same as usb_cdc_putc(), but will not wait indefinitely until there is<br />

space for the character in the transmit buffer. In that situation the<br />

character is lost.<br />

Sends a character string (null terminated) to the USB CDC port. Will<br />

return FALSE if the buffer is busy, TRUE if buffer is string was put into<br />

buffer for sending. Entire string must fit into endpoint, if string is longer<br />

than endpoint buffer then excess characters will be ignored.<br />

Returns TRUE if there is space in the transmit buffer for another<br />

character.<br />

Relevant<br />

Preporcessor:<br />

None<br />

76

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!