USBMSD SD card Hello World for Mbed platforms
Dependencies: mbed USBMSD_SD USBDevice
USBDevice/USBSERIAL/USBCDC.h@2:27a7e7f8d399, 2011-11-11 (annotated)
- Committer:
- samux
- Date:
- Fri Nov 11 15:22:53 2011 +0000
- Revision:
- 2:27a7e7f8d399
we have 2MB with the sdcard!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux |
2:27a7e7f8d399 | 1 | /* USBCDC.h */ |
samux |
2:27a7e7f8d399 | 2 | /* CDC class */ |
samux |
2:27a7e7f8d399 | 3 | /* Copyright (c) 2011 ARM Limited. All rights reserved. */ |
samux |
2:27a7e7f8d399 | 4 | |
samux |
2:27a7e7f8d399 | 5 | #ifndef USBCDC_H |
samux |
2:27a7e7f8d399 | 6 | #define USBCDC_H |
samux |
2:27a7e7f8d399 | 7 | |
samux |
2:27a7e7f8d399 | 8 | /* These headers are included for child class. */ |
samux |
2:27a7e7f8d399 | 9 | #include "USBEndpoints.h" |
samux |
2:27a7e7f8d399 | 10 | #include "USBDescriptor.h" |
samux |
2:27a7e7f8d399 | 11 | #include "USBDevice_Types.h" |
samux |
2:27a7e7f8d399 | 12 | |
samux |
2:27a7e7f8d399 | 13 | #include "USBDevice.h" |
samux |
2:27a7e7f8d399 | 14 | |
samux |
2:27a7e7f8d399 | 15 | |
samux |
2:27a7e7f8d399 | 16 | |
samux |
2:27a7e7f8d399 | 17 | class USBCDC: public USBDevice { |
samux |
2:27a7e7f8d399 | 18 | public: |
samux |
2:27a7e7f8d399 | 19 | |
samux |
2:27a7e7f8d399 | 20 | /* |
samux |
2:27a7e7f8d399 | 21 | * Constructor |
samux |
2:27a7e7f8d399 | 22 | * |
samux |
2:27a7e7f8d399 | 23 | * @param vendor_id Your vendor_id |
samux |
2:27a7e7f8d399 | 24 | * @param product_id Your product_id |
samux |
2:27a7e7f8d399 | 25 | * @param product_release Your preoduct_release |
samux |
2:27a7e7f8d399 | 26 | */ |
samux |
2:27a7e7f8d399 | 27 | USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release); |
samux |
2:27a7e7f8d399 | 28 | |
samux |
2:27a7e7f8d399 | 29 | |
samux |
2:27a7e7f8d399 | 30 | /* |
samux |
2:27a7e7f8d399 | 31 | * Get device descriptor. Warning: this method has to store the length of the report descriptor in reportLength. |
samux |
2:27a7e7f8d399 | 32 | * |
samux |
2:27a7e7f8d399 | 33 | * @returns pointer to the device descriptor |
samux |
2:27a7e7f8d399 | 34 | */ |
samux |
2:27a7e7f8d399 | 35 | virtual uint8_t * deviceDesc(); |
samux |
2:27a7e7f8d399 | 36 | |
samux |
2:27a7e7f8d399 | 37 | /* |
samux |
2:27a7e7f8d399 | 38 | * Get string product descriptor |
samux |
2:27a7e7f8d399 | 39 | * |
samux |
2:27a7e7f8d399 | 40 | * @returns pointer to the string product descriptor |
samux |
2:27a7e7f8d399 | 41 | */ |
samux |
2:27a7e7f8d399 | 42 | virtual uint8_t * stringIproductDesc(); |
samux |
2:27a7e7f8d399 | 43 | |
samux |
2:27a7e7f8d399 | 44 | /* |
samux |
2:27a7e7f8d399 | 45 | * Get string interface descriptor |
samux |
2:27a7e7f8d399 | 46 | * |
samux |
2:27a7e7f8d399 | 47 | * @returns pointer to the string interface descriptor |
samux |
2:27a7e7f8d399 | 48 | */ |
samux |
2:27a7e7f8d399 | 49 | virtual uint8_t * stringIinterfaceDesc(); |
samux |
2:27a7e7f8d399 | 50 | |
samux |
2:27a7e7f8d399 | 51 | /* |
samux |
2:27a7e7f8d399 | 52 | * Get configuration descriptor |
samux |
2:27a7e7f8d399 | 53 | * |
samux |
2:27a7e7f8d399 | 54 | * @returns pointer to the configuration descriptor |
samux |
2:27a7e7f8d399 | 55 | */ |
samux |
2:27a7e7f8d399 | 56 | virtual uint8_t * configurationDesc(); |
samux |
2:27a7e7f8d399 | 57 | |
samux |
2:27a7e7f8d399 | 58 | /* |
samux |
2:27a7e7f8d399 | 59 | * Send a buffer to a certain endpoint |
samux |
2:27a7e7f8d399 | 60 | * |
samux |
2:27a7e7f8d399 | 61 | * @param endpoint endpoint which will be sent the buffer |
samux |
2:27a7e7f8d399 | 62 | * @param buffer buffer to be sent |
samux |
2:27a7e7f8d399 | 63 | * @param size length of the buffer |
samux |
2:27a7e7f8d399 | 64 | * @returns true if successful |
samux |
2:27a7e7f8d399 | 65 | */ |
samux |
2:27a7e7f8d399 | 66 | bool send(uint8_t endpoint, uint8_t * buffer, uint16_t size); |
samux |
2:27a7e7f8d399 | 67 | |
samux |
2:27a7e7f8d399 | 68 | /* |
samux |
2:27a7e7f8d399 | 69 | * Read a buffer from a certain endpoint. Warning: blocking |
samux |
2:27a7e7f8d399 | 70 | * |
samux |
2:27a7e7f8d399 | 71 | * @param endpoint endpoint to read |
samux |
2:27a7e7f8d399 | 72 | * @param buffer buffer where will be stored bytes |
samux |
2:27a7e7f8d399 | 73 | * @param size the number of bytes read will be stored in *size |
samux |
2:27a7e7f8d399 | 74 | * @param maxSize the maximum length that can be read |
samux |
2:27a7e7f8d399 | 75 | * @returns true if successful |
samux |
2:27a7e7f8d399 | 76 | */ |
samux |
2:27a7e7f8d399 | 77 | bool read(uint8_t endpoint, uint8_t * buffer, uint16_t * size, uint16_t maxSize); |
samux |
2:27a7e7f8d399 | 78 | |
samux |
2:27a7e7f8d399 | 79 | /* |
samux |
2:27a7e7f8d399 | 80 | * Read a buffer from a certain endpoint. Warning: non blocking |
samux |
2:27a7e7f8d399 | 81 | * |
samux |
2:27a7e7f8d399 | 82 | * @param endpoint endpoint to read |
samux |
2:27a7e7f8d399 | 83 | * @param buffer buffer where will be stored bytes |
samux |
2:27a7e7f8d399 | 84 | * @param size the number of bytes read will be stored in *size |
samux |
2:27a7e7f8d399 | 85 | * @param maxSize the maximum length that can be read |
samux |
2:27a7e7f8d399 | 86 | * @returns true if successful |
samux |
2:27a7e7f8d399 | 87 | */ |
samux |
2:27a7e7f8d399 | 88 | bool readNB(uint8_t endpoint, uint8_t * buffer, uint16_t * size, uint16_t maxSize); |
samux |
2:27a7e7f8d399 | 89 | |
samux |
2:27a7e7f8d399 | 90 | virtual bool USBCallback_request(); |
samux |
2:27a7e7f8d399 | 91 | virtual bool USBCallback_setConfiguration(uint8_t configuration); |
samux |
2:27a7e7f8d399 | 92 | |
samux |
2:27a7e7f8d399 | 93 | }; |
samux |
2:27a7e7f8d399 | 94 | |
samux |
2:27a7e7f8d399 | 95 | #endif |