Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: ton_demo ton_template
USBTon Class Reference
#include <USBTon.h>
Public Member Functions | |
| USBTon (uint16_t vendor_id=0x1f00, uint16_t product_id=0x2012, uint16_t product_release=0x0001, bool connect_blocking=true) | |
| Constructor. | |
| virtual int | _putc (int c) |
| Send a character. | |
| virtual int | _getc () |
| Read a character: blocking. | |
| uint8_t | available () |
| Check the number of bytes available. | |
| int | readable () |
| Determine if there is a character available to read. | |
| int | writeable () |
| Determine if there is space available to write a character. | |
Detailed Description
USBTon example.
#include "mbed.h" #include "USBTon.h" //Virtual serial port over USB USBTon usb; int main(void) { while(1) { usb.printf("I am a virtual serial port\n"); wait(1); } }
Definition at line 28 of file USBTon.h.
Constructor & Destructor Documentation
| USBTon | ( | uint16_t | vendor_id = 0x1f00, |
| uint16_t | product_id = 0x2012, |
||
| uint16_t | product_release = 0x0001, |
||
| bool | connect_blocking = true |
||
| ) |
Member Function Documentation
| int _getc | ( | ) | [virtual] |
| int _putc | ( | int | c ) | [virtual] |
Send a character.
You can use puts, printf.
- Parameters:
-
c character to be sent
- Returns:
- true if there is no error, false otherwise
Definition at line 4 of file USBTon.cpp.
| uint8_t available | ( | ) |
Check the number of bytes available.
- Returns:
- the number of bytes available
Definition at line 15 of file USBTon.cpp.
| int readable | ( | ) |
Generated on Tue Jul 12 2022 20:52:33 by
1.7.2