USBDevice for STM support

Dependents:   Nucleo_Usb_JoyMouse Nucleo_usbmouse ELEC350_1-referral-2018-usb-hid USBJoystick_HelloWorld2_wip ... more

This library contains all mbed usb device library (mbed-os\features\unsupported\USBDevice).

Committer:
frq08711@LMECWL0871.LME.ST.COM
Date:
Tue Mar 28 11:00:57 2017 +0200
Branch:
master
Revision:
4:50ec00aa4515
Parent:
1:2a3ae13b45ef
update for 5.4.2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 2 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 4 * and associated documentation files (the "Software"), to deal in the Software without
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 7 * Software is furnished to do so, subject to the following conditions:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 8 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 9 * The above copyright notice and this permission notice shall be included in all copies or
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 10 * substantial portions of the Software.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 11 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 17 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 18
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 19 #ifndef USBDEVICE_H
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 20 #define USBDEVICE_H
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 21
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 22 #include "mbed.h"
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 23 #include "USBDevice_Types.h"
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 24 #include "USBHAL.h"
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 25
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 26 class USBDevice: public USBHAL
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 27 {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 28 public:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 29 USBDevice(uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 30
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 31 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 32 * Check if the device is configured
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 33 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 34 * @returns true if configured, false otherwise
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 35 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 36 bool configured(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 37
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 38 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 39 * Connect a device
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 40 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 41 * @param blocking: block if not configured
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 42 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 43 void connect(bool blocking = true);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 44
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 45 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 46 * Disconnect a device
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 47 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 48 void disconnect(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 49
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 50 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 51 * Add an endpoint
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 52 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 53 * @param endpoint endpoint which will be added
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 54 * @param maxPacket Maximum size of a packet which can be sent for this endpoint
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 55 * @returns true if successful, false otherwise
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 56 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 57 bool addEndpoint(uint8_t endpoint, uint32_t maxPacket);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 58
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 59 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 60 * Start a reading on a certain endpoint.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 61 * You can access the result of the reading by USBDevice_read
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 62 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 63 * @param endpoint endpoint which will be read
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 64 * @param maxSize the maximum length that can be read
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 65 * @return true if successful
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 66 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 67 bool readStart(uint8_t endpoint, uint32_t maxSize);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 68
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 69 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 70 * Read a certain endpoint. Before calling this function, USBUSBDevice_readStart
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 71 * must be called.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 72 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 73 * Warning: blocking
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 74 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 75 * @param endpoint endpoint which will be read
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 76 * @param buffer buffer will be filled with the data received
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 77 * @param size the number of bytes read will be stored in *size
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 78 * @param maxSize the maximum length that can be read
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 79 * @returns true if successful
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 80 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 81 bool readEP(uint8_t endpoint, uint8_t * buffer, uint32_t * size, uint32_t maxSize);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 82
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 83 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 84 * Read a certain endpoint.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 85 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 86 * Warning: non blocking
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 87 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 88 * @param endpoint endpoint which will be read
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 89 * @param buffer buffer will be filled with the data received (if data are available)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 90 * @param size the number of bytes read will be stored in *size
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 91 * @param maxSize the maximum length that can be read
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 92 * @returns true if successful
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 93 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 94 bool readEP_NB(uint8_t endpoint, uint8_t * buffer, uint32_t * size, uint32_t maxSize);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 95
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 96 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 97 * Write a certain endpoint.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 98 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 99 * Warning: blocking
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 100 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 101 * @param endpoint endpoint to write
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 102 * @param buffer data contained in buffer will be write
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 103 * @param size the number of bytes to write
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 104 * @param maxSize the maximum length that can be written on this endpoint
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 105 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 106 bool write(uint8_t endpoint, uint8_t * buffer, uint32_t size, uint32_t maxSize);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 107
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 108
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 109 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 110 * Write a certain endpoint.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 111 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 112 * Warning: non blocking
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 113 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 114 * @param endpoint endpoint to write
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 115 * @param buffer data contained in buffer will be write
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 116 * @param size the number of bytes to write
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 117 * @param maxSize the maximum length that can be written on this endpoint
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 118 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 119 bool writeNB(uint8_t endpoint, uint8_t * buffer, uint32_t size, uint32_t maxSize);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 120
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 121
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 122 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 123 * Called by USBDevice layer on bus reset. Warning: Called in ISR context
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 124 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 125 * May be used to reset state
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 126 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 127 virtual void USBCallback_busReset(void) {};
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 128
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 129 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 130 * Called by USBDevice on Endpoint0 request. Warning: Called in ISR context
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 131 * This is used to handle extensions to standard requests
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 132 * and class specific requests
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 133 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 134 * @returns true if class handles this request
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 135 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 136 virtual bool USBCallback_request() { return false; };
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 137
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 138 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 139 * Called by USBDevice on Endpoint0 request completion
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 140 * if the 'notify' flag has been set to true. Warning: Called in ISR context
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 141 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 142 * In this case it is used to indicate that a HID report has
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 143 * been received from the host on endpoint 0
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 144 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 145 * @param buf buffer received on endpoint 0
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 146 * @param length length of this buffer
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 147 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 148 virtual void USBCallback_requestCompleted(uint8_t * buf, uint32_t length) {};
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 149
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 150 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 151 * Called by USBDevice layer. Set configuration of the device.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 152 * For instance, you can add all endpoints that you need on this function.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 153 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 154 * @param configuration Number of the configuration
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 155 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 156 virtual bool USBCallback_setConfiguration(uint8_t configuration) { return false; };
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 157
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 158 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 159 * Called by USBDevice layer. Set interface/alternate of the device.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 160 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 161 * @param interface Number of the interface to be configured
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 162 * @param alternate Number of the alternate to be configured
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 163 * @returns true if class handles this request
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 164 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 165 virtual bool USBCallback_setInterface(uint16_t interface, uint8_t alternate) { return false; };
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 166
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 167 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 168 * Get device descriptor. Warning: this method has to store the length of the report descriptor in reportLength.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 169 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 170 * @returns pointer to the device descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 171 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 172 virtual uint8_t * deviceDesc();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 173
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 174 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 175 * Get configuration descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 176 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 177 * @returns pointer to the configuration descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 178 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 179 virtual uint8_t * configurationDesc(){return NULL;};
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 180
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 181 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 182 * Get string lang id descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 183 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 184 * @return pointer to the string lang id descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 185 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 186 virtual uint8_t * stringLangidDesc();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 187
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 188 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 189 * Get string manufacturer descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 190 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 191 * @returns pointer to the string manufacturer descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 192 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 193 virtual uint8_t * stringImanufacturerDesc();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 194
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 195 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 196 * Get string product descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 197 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 198 * @returns pointer to the string product descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 199 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 200 virtual uint8_t * stringIproductDesc();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 201
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 202 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 203 * Get string serial descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 204 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 205 * @returns pointer to the string serial descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 206 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 207 virtual uint8_t * stringIserialDesc();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 208
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 209 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 210 * Get string configuration descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 211 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 212 * @returns pointer to the string configuration descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 213 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 214 virtual uint8_t * stringIConfigurationDesc();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 215
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 216 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 217 * Get string interface descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 218 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 219 * @returns pointer to the string interface descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 220 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 221 virtual uint8_t * stringIinterfaceDesc();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 222
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 223 /*
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 224 * Get the length of the report descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 225 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 226 * @returns length of the report descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 227 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 228 virtual uint16_t reportDescLength() { return 0; };
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 229
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 230
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 231
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 232 protected:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 233 virtual void busReset(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 234 virtual void EP0setupCallback(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 235 virtual void EP0out(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 236 virtual void EP0in(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 237 virtual void connectStateChanged(unsigned int connected);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 238 virtual void suspendStateChanged(unsigned int suspended);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 239 uint8_t * findDescriptor(uint8_t descriptorType);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 240 CONTROL_TRANSFER * getTransferPtr(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 241
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 242 uint16_t VENDOR_ID;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 243 uint16_t PRODUCT_ID;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 244 uint16_t PRODUCT_RELEASE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 245
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 246 private:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 247 bool addRateFeedbackEndpoint(uint8_t endpoint, uint32_t maxPacket);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 248 bool requestGetDescriptor(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 249 bool controlOut(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 250 bool controlIn(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 251 bool requestSetAddress(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 252 bool requestSetConfiguration(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 253 bool requestSetFeature(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 254 bool requestClearFeature(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 255 bool requestGetStatus(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 256 bool requestSetup(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 257 bool controlSetup(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 258 void decodeSetupPacket(uint8_t *data, SETUP_PACKET *packet);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 259 bool requestGetConfiguration(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 260 bool requestGetInterface(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 261 bool requestSetInterface(void);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 262
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 263 CONTROL_TRANSFER transfer;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 264 USB_DEVICE device;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 265
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 266 uint16_t currentInterface;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 267 uint8_t currentAlternate;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 268 };
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 269
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 270
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 271 #endif