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.
Dependencies: mbed USBMSD_SD USBDevice
USBDevice/USBSERIAL/USBCDC.h
- Committer:
- samux
- Date:
- 2011-11-11
- Revision:
- 2:27a7e7f8d399
File content as of revision 2:27a7e7f8d399:
/* 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