SerialUSB: Unterschied zwischen den Versionen

Aus LaborWiki
Wechseln zu: Navigation, Suche
(serial USB description)
 
K
Zeile 31: Zeile 31:
 
return read bytes on success, 0 otherwise<br>
 
return read bytes on success, 0 otherwise<br>
 
on success buf contains the read characters
 
on success buf contains the read characters
 +
 +
[[Category:Microcontroller]]

Version vom 29. März 2013, 10:46 Uhr

Code Example for STM32F4xx

To checkout use Subversion:

svn co https://www.das-labor.org/svn/microcontroller/src-stm32f4xx/serialUSB

To build simply type

make

Virtual Com Port

void VCP_send_str(uint8_t* buf)

will sent a string to host
note: too long strings may cause buffer overrun

void VCP_put_char(uint8_t buf)

will sent a single char to host

uint8_t VCP_get_char(uint8_t *buf)

nonblocking:
return 1 on success, 0 otherwise
on success buf contains the read character

uint8_t VCP_get_string(uint8_t *buf)

nonblocking:
return read bytes on success, 0 otherwise
on success buf contains the read characters