This fork re-enables FRDM boards and adds WebUSB CDC functionality

Fork of USBDevice_STM32F103 by Devan Lai

Committer:
Lars Knudsen
Date:
Tue Jul 11 21:02:39 2017 +0200
Revision:
72:1d8a6665d607
Parent:
67:39396cc073f2
Adding MS OS 2.0 support

Who changed what in which revision?

UserRevisionLine numberNew contents of line
devanlai 67:39396cc073f2 1 /*
devanlai 67:39396cc073f2 2 * Copyright 2016 Devan Lai
devanlai 67:39396cc073f2 3 *
devanlai 67:39396cc073f2 4 * Licensed under the Apache License, Version 2.0 (the "License");
devanlai 67:39396cc073f2 5 * you may not use this file except in compliance with the License.
devanlai 67:39396cc073f2 6 * You may obtain a copy of the License at
devanlai 67:39396cc073f2 7 *
devanlai 67:39396cc073f2 8 * http://www.apache.org/licenses/LICENSE-2.0
devanlai 67:39396cc073f2 9 *
devanlai 67:39396cc073f2 10 * Unless required by applicable law or agreed to in writing, software
devanlai 67:39396cc073f2 11 * distributed under the License is distributed on an "AS IS" BASIS,
devanlai 67:39396cc073f2 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
devanlai 67:39396cc073f2 13 * See the License for the specific language governing permissions and
devanlai 67:39396cc073f2 14 * limitations under the License.
devanlai 67:39396cc073f2 15 */
devanlai 67:39396cc073f2 16
devanlai 67:39396cc073f2 17 #ifndef WEBUSB_DEVICE_H
devanlai 67:39396cc073f2 18 #define WEBUSB_DEVICE_H
devanlai 67:39396cc073f2 19
devanlai 67:39396cc073f2 20 #include "USBDevice.h"
devanlai 67:39396cc073f2 21
devanlai 67:39396cc073f2 22 class WebUSBDevice: public USBDevice
devanlai 67:39396cc073f2 23 {
devanlai 67:39396cc073f2 24 public:
devanlai 67:39396cc073f2 25 WebUSBDevice(uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
devanlai 67:39396cc073f2 26
devanlai 67:39396cc073f2 27 /*
devanlai 67:39396cc073f2 28 * Called by USBDevice on Endpoint0 request. Warning: Called in ISR context
devanlai 67:39396cc073f2 29 * This is used to handle extensions to standard requests
devanlai 67:39396cc073f2 30 * and class specific requests
devanlai 67:39396cc073f2 31 *
devanlai 67:39396cc073f2 32 * @returns true if class handles this request
devanlai 67:39396cc073f2 33 */
devanlai 67:39396cc073f2 34 virtual bool USBCallback_request();
devanlai 67:39396cc073f2 35
devanlai 67:39396cc073f2 36 /*
devanlai 67:39396cc073f2 37 * Get device descriptor. Warning: this method has to store the length of the report descriptor in reportLength.
devanlai 67:39396cc073f2 38 *
devanlai 67:39396cc073f2 39 * @returns pointer to the device descriptor
devanlai 67:39396cc073f2 40 */
devanlai 67:39396cc073f2 41 virtual uint8_t * deviceDesc();
devanlai 67:39396cc073f2 42
devanlai 67:39396cc073f2 43 /*
devanlai 67:39396cc073f2 44 * Get binary object store descriptor
devanlai 67:39396cc073f2 45 *
devanlai 67:39396cc073f2 46 * @returns pointer to the binary object store descriptor
devanlai 67:39396cc073f2 47 */
devanlai 67:39396cc073f2 48 virtual uint8_t * binaryObjectStoreDesc();
devanlai 67:39396cc073f2 49
devanlai 67:39396cc073f2 50 /*
devanlai 67:39396cc073f2 51 * Get the WebUSB allowed origin descriptor
devanlai 67:39396cc073f2 52 *
devanlai 67:39396cc073f2 53 * @returns pointer to the WebUSB allowed origin descriptor
devanlai 67:39396cc073f2 54 */
devanlai 67:39396cc073f2 55 virtual uint8_t * allowedOriginsDesc() = 0;
devanlai 67:39396cc073f2 56
devanlai 67:39396cc073f2 57 /*
devanlai 67:39396cc073f2 58 * Get WebUSB landing page URL descriptor
devanlai 67:39396cc073f2 59 *
devanlai 67:39396cc073f2 60 * @returns pointer to the landing page URL descriptor
devanlai 67:39396cc073f2 61 */
devanlai 67:39396cc073f2 62 virtual uint8_t * urlIlandingPage() = 0;
devanlai 67:39396cc073f2 63
devanlai 67:39396cc073f2 64 /*
devanlai 67:39396cc073f2 65 * Get WebUSB allowed origin URL descriptor
devanlai 67:39396cc073f2 66 *
devanlai 67:39396cc073f2 67 * @returns pointer to the allowed origin URL descriptor
devanlai 67:39396cc073f2 68 */
devanlai 67:39396cc073f2 69 virtual uint8_t * urlIallowedOrigin() = 0;
devanlai 67:39396cc073f2 70
devanlai 67:39396cc073f2 71 protected:
devanlai 67:39396cc073f2 72 virtual bool requestGetDescriptor(void);
devanlai 67:39396cc073f2 73 virtual bool requestWebUSB(void);
devanlai 67:39396cc073f2 74
devanlai 67:39396cc073f2 75 private:
devanlai 67:39396cc073f2 76
devanlai 67:39396cc073f2 77 };
devanlai 67:39396cc073f2 78
devanlai 67:39396cc073f2 79 #endif