|
ECRobot C++ API for LEGO MINDSTORMS NXT
1.0.10
|
USB communication class. More...
#include <Usb.h>
Public Member Functions | |
| Usb (void) | |
| Constructor. | |
| ~Usb (void) | |
| Destructor (shut down USB). | |
| void | commHandler (void) |
| USB communication handler which must be invoked every 1msec while application is running. | |
| bool | isConnected (void) const |
| Check connection status. | |
| U32 | send (U8 *data, U32 offset, U32 length) |
| Send data to the host device. | |
| U32 | receive (U8 *data, U32 offset, U32 length) const |
| Receive data from the host device. | |
| bool | close (void) |
| Close the existing connection. | |
Static Public Attributes | |
| static const U32 | MAX_USB_DATA_LENGTH = 64 |
| Maximum length of data in byte for send/receive. | |
USB communication class.
| ecrobot::Usb::Usb | ( | void | ) |
Constructor.
Note:
This class must be constructed as a global object. Otherwise, a device assertion will be displayed
in the LCD when the object is constructed as a non global object. When the object is destructed while the system is shut down, USB is shut down automatically.
| - |
| ecrobot::Usb::~Usb | ( | void | ) |
Destructor (shut down USB).
| - |
| bool ecrobot::Usb::close | ( | void | ) |
Close the existing connection.
| - |
| void ecrobot::Usb::commHandler | ( | void | ) |
USB communication handler which must be invoked every 1msec while application is running.
| - |
| bool ecrobot::Usb::isConnected | ( | void | ) | const |
Check connection status.
| - |
| U32 ecrobot::Usb::receive | ( | U8 * | data, |
| U32 | offset, | ||
| U32 | length | ||
| ) | const |
Receive data from the host device.
| data | Data to be received |
| offset | Offset of data to be received |
| length | Length of data to be received |
| U32 ecrobot::Usb::send | ( | U8 * | data, |
| U32 | offset, | ||
| U32 | length | ||
| ) |
Send data to the host device.
| data | Data to be sent |
| offset | Offset of data to be sent |
| length | Length of data to be sent |