USBMSD SD card Hello World for Mbed platforms
Dependencies: mbed USBMSD_SD USBDevice
Diff: USBDevice/USBSERIAL/USBCDC.h
- Revision:
- 2:27a7e7f8d399
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice/USBSERIAL/USBCDC.h Fri Nov 11 15:22:53 2011 +0000 @@ -0,0 +1,95 @@ +/* USBCDC.h */ +/* CDC class */ +/* Copyright (c) 2011 ARM Limited. All rights reserved. */ + +#ifndef USBCDC_H +#define USBCDC_H + +/* These headers are included for child class. */ +#include "USBEndpoints.h" +#include "USBDescriptor.h" +#include "USBDevice_Types.h" + +#include "USBDevice.h" + + + +class USBCDC: public USBDevice { +public: + + /* + * Constructor + * + * @param vendor_id Your vendor_id + * @param product_id Your product_id + * @param product_release Your preoduct_release + */ + USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release); + + + /* + * Get device descriptor. Warning: this method has to store the length of the report descriptor in reportLength. + * + * @returns pointer to the device descriptor + */ + virtual uint8_t * deviceDesc(); + + /* + * Get string product descriptor + * + * @returns pointer to the string product descriptor + */ + virtual uint8_t * stringIproductDesc(); + + /* + * Get string interface descriptor + * + * @returns pointer to the string interface descriptor + */ + virtual uint8_t * stringIinterfaceDesc(); + + /* + * Get configuration descriptor + * + * @returns pointer to the configuration descriptor + */ + virtual uint8_t * configurationDesc(); + + /* + * Send a buffer to a certain endpoint + * + * @param endpoint endpoint which will be sent the buffer + * @param buffer buffer to be sent + * @param size length of the buffer + * @returns true if successful + */ + bool send(uint8_t endpoint, uint8_t * buffer, uint16_t size); + + /* + * Read a buffer from a certain endpoint. Warning: blocking + * + * @param endpoint endpoint to read + * @param buffer buffer where will be stored bytes + * @param size the number of bytes read will be stored in *size + * @param maxSize the maximum length that can be read + * @returns true if successful + */ + bool read(uint8_t endpoint, uint8_t * buffer, uint16_t * size, uint16_t maxSize); + + /* + * Read a buffer from a certain endpoint. Warning: non blocking + * + * @param endpoint endpoint to read + * @param buffer buffer where will be stored bytes + * @param size the number of bytes read will be stored in *size + * @param maxSize the maximum length that can be read + * @returns true if successful + */ + bool readNB(uint8_t endpoint, uint8_t * buffer, uint16_t * size, uint16_t maxSize); + + virtual bool USBCallback_request(); + virtual bool USBCallback_setConfiguration(uint8_t configuration); + +}; + +#endif