B. H. / Mbed 2 deprecated trolololol

Dependencies:   mbed

Revision:
0:505207de8566
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice/USBSERIAL/.svn/text-base/USBCDC.h.svn-base	Tue Nov 29 21:26:20 2011 +0000
@@ -0,0 +1,102 @@
+/* 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"
+
+#define DEFAULT_CONFIGURATION (1)
+
+#define CDC_SET_LINE_CODING        0x20
+#define CDC_GET_LINE_CODING        0x21
+#define CDC_SET_CONTROL_LINE_STATE 0x22
+
+#define MAX_CDC_REPORT_SIZE (64)
+
+
+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