Base station firmware

Committer:
Perijah
Date:
Tue May 24 13:16:55 2016 +0000
Revision:
0:ecc3925d3f8c
Base station firmware

Who changed what in which revision?

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