add keycode2 at USBKeyboard

Dependents:   USBKeyboard_HelloWorld

Fork of USBDevice by Samuel Mokrani

Committer:
yueee_yt
Date:
Fri Oct 05 11:56:43 2012 +0000
Revision:
1:4c0daa716c71
Parent:
0:140cdf8e2d60
add keycode2 at USBKeyboard

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 0:140cdf8e2d60 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
samux 0:140cdf8e2d60 2 *
samux 0:140cdf8e2d60 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
samux 0:140cdf8e2d60 4 * and associated documentation files (the "Software"), to deal in the Software without
samux 0:140cdf8e2d60 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
samux 0:140cdf8e2d60 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
samux 0:140cdf8e2d60 7 * Software is furnished to do so, subject to the following conditions:
samux 0:140cdf8e2d60 8 *
samux 0:140cdf8e2d60 9 * The above copyright notice and this permission notice shall be included in all copies or
samux 0:140cdf8e2d60 10 * substantial portions of the Software.
samux 0:140cdf8e2d60 11 *
samux 0:140cdf8e2d60 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
samux 0:140cdf8e2d60 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
samux 0:140cdf8e2d60 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
samux 0:140cdf8e2d60 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
samux 0:140cdf8e2d60 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
samux 0:140cdf8e2d60 17 */
samux 0:140cdf8e2d60 18
samux 0:140cdf8e2d60 19 #ifndef USBCDC_H
samux 0:140cdf8e2d60 20 #define USBCDC_H
samux 0:140cdf8e2d60 21
samux 0:140cdf8e2d60 22 /* These headers are included for child class. */
samux 0:140cdf8e2d60 23 #include "USBEndpoints.h"
samux 0:140cdf8e2d60 24 #include "USBDescriptor.h"
samux 0:140cdf8e2d60 25 #include "USBDevice_Types.h"
samux 0:140cdf8e2d60 26
samux 0:140cdf8e2d60 27 #include "USBDevice.h"
samux 0:140cdf8e2d60 28
samux 0:140cdf8e2d60 29 class USBCDC: public USBDevice {
samux 0:140cdf8e2d60 30 public:
samux 0:140cdf8e2d60 31
samux 0:140cdf8e2d60 32 /*
samux 0:140cdf8e2d60 33 * Constructor
samux 0:140cdf8e2d60 34 *
samux 0:140cdf8e2d60 35 * @param vendor_id Your vendor_id
samux 0:140cdf8e2d60 36 * @param product_id Your product_id
samux 0:140cdf8e2d60 37 * @param product_release Your preoduct_release
samux 0:140cdf8e2d60 38 */
samux 0:140cdf8e2d60 39 USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
samux 0:140cdf8e2d60 40
samux 0:140cdf8e2d60 41 protected:
samux 0:140cdf8e2d60 42
samux 0:140cdf8e2d60 43 /*
samux 0:140cdf8e2d60 44 * Get device descriptor. Warning: this method has to store the length of the report descriptor in reportLength.
samux 0:140cdf8e2d60 45 *
samux 0:140cdf8e2d60 46 * @returns pointer to the device descriptor
samux 0:140cdf8e2d60 47 */
samux 0:140cdf8e2d60 48 virtual uint8_t * deviceDesc();
samux 0:140cdf8e2d60 49
samux 0:140cdf8e2d60 50 /*
samux 0:140cdf8e2d60 51 * Get string product descriptor
samux 0:140cdf8e2d60 52 *
samux 0:140cdf8e2d60 53 * @returns pointer to the string product descriptor
samux 0:140cdf8e2d60 54 */
samux 0:140cdf8e2d60 55 virtual uint8_t * stringIproductDesc();
samux 0:140cdf8e2d60 56
samux 0:140cdf8e2d60 57 /*
samux 0:140cdf8e2d60 58 * Get string interface descriptor
samux 0:140cdf8e2d60 59 *
samux 0:140cdf8e2d60 60 * @returns pointer to the string interface descriptor
samux 0:140cdf8e2d60 61 */
samux 0:140cdf8e2d60 62 virtual uint8_t * stringIinterfaceDesc();
samux 0:140cdf8e2d60 63
samux 0:140cdf8e2d60 64 /*
samux 0:140cdf8e2d60 65 * Get configuration descriptor
samux 0:140cdf8e2d60 66 *
samux 0:140cdf8e2d60 67 * @returns pointer to the configuration descriptor
samux 0:140cdf8e2d60 68 */
samux 0:140cdf8e2d60 69 virtual uint8_t * configurationDesc();
samux 0:140cdf8e2d60 70
samux 0:140cdf8e2d60 71 /*
samux 0:140cdf8e2d60 72 * Send a buffer
samux 0:140cdf8e2d60 73 *
samux 0:140cdf8e2d60 74 * @param endpoint endpoint which will be sent the buffer
samux 0:140cdf8e2d60 75 * @param buffer buffer to be sent
samux 0:140cdf8e2d60 76 * @param size length of the buffer
samux 0:140cdf8e2d60 77 * @returns true if successful
samux 0:140cdf8e2d60 78 */
samux 0:140cdf8e2d60 79 bool send(uint8_t * buffer, uint32_t size);
samux 0:140cdf8e2d60 80
samux 0:140cdf8e2d60 81 /*
samux 0:140cdf8e2d60 82 * Read a buffer from a certain endpoint. Warning: blocking
samux 0:140cdf8e2d60 83 *
samux 0:140cdf8e2d60 84 * @param endpoint endpoint to read
samux 0:140cdf8e2d60 85 * @param buffer buffer where will be stored bytes
samux 0:140cdf8e2d60 86 * @param size the number of bytes read will be stored in *size
samux 0:140cdf8e2d60 87 * @param maxSize the maximum length that can be read
samux 0:140cdf8e2d60 88 * @returns true if successful
samux 0:140cdf8e2d60 89 */
samux 0:140cdf8e2d60 90 bool readEP(uint8_t * buffer, uint32_t * size);
samux 0:140cdf8e2d60 91
samux 0:140cdf8e2d60 92 /*
samux 0:140cdf8e2d60 93 * Read a buffer from a certain endpoint. Warning: non blocking
samux 0:140cdf8e2d60 94 *
samux 0:140cdf8e2d60 95 * @param endpoint endpoint to read
samux 0:140cdf8e2d60 96 * @param buffer buffer where will be stored bytes
samux 0:140cdf8e2d60 97 * @param size the number of bytes read will be stored in *size
samux 0:140cdf8e2d60 98 * @param maxSize the maximum length that can be read
samux 0:140cdf8e2d60 99 * @returns true if successful
samux 0:140cdf8e2d60 100 */
samux 0:140cdf8e2d60 101 bool readEP_NB(uint8_t * buffer, uint32_t * size);
samux 0:140cdf8e2d60 102
samux 0:140cdf8e2d60 103 virtual bool USBCallback_request();
samux 0:140cdf8e2d60 104 virtual bool USBCallback_setConfiguration(uint8_t configuration);
samux 0:140cdf8e2d60 105
samux 0:140cdf8e2d60 106 };
samux 0:140cdf8e2d60 107
samux 0:140cdf8e2d60 108 #endif