Lucas Lim / Mbed 2 deprecated HSP_Temperature_Barometer_CS3237

Dependencies:   mbed

Committer:
lucaslwl
Date:
Mon Aug 26 08:11:41 2019 +0000
Revision:
22:5c07298d3383
add library folder

Who changed what in which revision?

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