Pinscape Controller version 1 fork. This is a fork to allow for ongoing bug fixes to the original controller version, from before the major changes for the expansion board project.

Dependencies:   FastIO FastPWM SimpleDMA mbed

Fork of Pinscape_Controller by Mike R

Committer:
mjr
Date:
Thu Feb 11 18:12:52 2016 +0000
Revision:
52:63f0a9b45f0c
Convert FastAnalogIn and USBDevice libraries to folders

Who changed what in which revision?

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