Fork of Smoothie to port to mbed non-LPC targets.

Dependencies:   mbed

Fork of Smoothie by Stéphane Cachat

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers USBCDC.h Source File

USBCDC.h

00001 /* Copyright (c) 2010-2011 mbed.org, MIT License
00002 *
00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00004 * and associated documentation files (the "Software"), to deal in the Software without
00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
00007 * Software is furnished to do so, subject to the following conditions:
00008 *
00009 * The above copyright notice and this permission notice shall be included in all copies or
00010 * substantial portions of the Software.
00011 *
00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00017 */
00018 
00019 #ifndef USBCDC_H
00020 #define USBCDC_H
00021 
00022 #include "USB.h"
00023 
00024 /* These headers are included for child class. */
00025 #include "USBEndpoints.h"
00026 #include "USBDescriptor.h"
00027 #include "USBDevice_Types.h"
00028 
00029 #include "descriptor_cdc.h"
00030 
00031 class USBCDC: public USB_Endpoint_Receiver {
00032 public:
00033     USBCDC(USB *);
00034 
00035 protected:
00036     bool send(uint8_t * buffer, uint32_t size);
00037 
00038     bool readEP(uint8_t * buffer, uint32_t * size);
00039     bool readEP_NB(uint8_t * buffer, uint32_t * size);
00040 
00041     virtual bool USBEvent_Request(CONTROL_TRANSFER&);
00042     virtual bool USBEvent_RequestComplete(CONTROL_TRANSFER&, uint8_t*, uint32_t);
00043 
00044     virtual void on_attach(void);
00045     virtual void on_detach(void);
00046 
00047     USB *usb;
00048 
00049     // USB Descriptors
00050     usbdesc_iad         CDC_iad;
00051     usbdesc_interface   CDC_if;
00052     usbcdc_header       CDC_header;
00053     usbcdc_callmgmt     CDC_callmgmt;
00054     usbcdc_acm          CDC_acm;
00055     usbcdc_union        CDC_union;
00056 
00057     usbdesc_interface   CDC_slaveif;
00058 
00059     usbdesc_endpoint    CDC_intep;
00060     usbdesc_endpoint    CDC_BulkIn;
00061     usbdesc_endpoint    CDC_BulkOut;
00062 
00063     usbdesc_string_l(15) CDC_string;
00064 
00065     usbcdc_line_coding  cdc_line_coding;
00066 };
00067 
00068 #endif