Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1 /* IUSBHostSerial.h */
switches 0:5c4d7b2438d3 2 /* Copyright (c) 2010-2012 mbed.org, MIT License
switches 0:5c4d7b2438d3 3 *
switches 0:5c4d7b2438d3 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
switches 0:5c4d7b2438d3 5 * and associated documentation files (the "Software"), to deal in the Software without
switches 0:5c4d7b2438d3 6 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
switches 0:5c4d7b2438d3 7 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
switches 0:5c4d7b2438d3 8 * Software is furnished to do so, subject to the following conditions:
switches 0:5c4d7b2438d3 9 *
switches 0:5c4d7b2438d3 10 * The above copyright notice and this permission notice shall be included in all copies or
switches 0:5c4d7b2438d3 11 * substantial portions of the Software.
switches 0:5c4d7b2438d3 12 *
switches 0:5c4d7b2438d3 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
switches 0:5c4d7b2438d3 14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
switches 0:5c4d7b2438d3 15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
switches 0:5c4d7b2438d3 16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
switches 0:5c4d7b2438d3 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
switches 0:5c4d7b2438d3 18 */
switches 0:5c4d7b2438d3 19
switches 0:5c4d7b2438d3 20 #ifndef IUSBHOSTSERIAL_H_
switches 0:5c4d7b2438d3 21 #define IUSBHOSTSERIAL_H_
switches 0:5c4d7b2438d3 22
switches 0:5c4d7b2438d3 23 /**
switches 0:5c4d7b2438d3 24 * Generic interface to abstract 3G dongles' impl
switches 0:5c4d7b2438d3 25 */
switches 0:5c4d7b2438d3 26
switches 0:5c4d7b2438d3 27 #include "USBHostConf.h"
switches 0:5c4d7b2438d3 28
switches 0:5c4d7b2438d3 29 #ifdef USBHOST_3GMODULE
switches 0:5c4d7b2438d3 30
switches 0:5c4d7b2438d3 31 #include "IUSBHostSerialListener.h"
switches 0:5c4d7b2438d3 32
switches 0:5c4d7b2438d3 33 // This is needed by some versions of GCC
switches 0:5c4d7b2438d3 34 #undef putc
switches 0:5c4d7b2438d3 35 #undef getc
switches 0:5c4d7b2438d3 36
switches 0:5c4d7b2438d3 37 class IUSBHostSerial {
switches 0:5c4d7b2438d3 38 public:
switches 0:5c4d7b2438d3 39
switches 0:5c4d7b2438d3 40 enum IrqType {
switches 0:5c4d7b2438d3 41 RxIrq,
switches 0:5c4d7b2438d3 42 TxIrq
switches 0:5c4d7b2438d3 43 };
switches 0:5c4d7b2438d3 44
switches 0:5c4d7b2438d3 45 /*
switches 0:5c4d7b2438d3 46 * Get a char from the dongle's serial interface
switches 0:5c4d7b2438d3 47 */
switches 0:5c4d7b2438d3 48 virtual int getc() = 0;
switches 0:5c4d7b2438d3 49
switches 0:5c4d7b2438d3 50 /*
switches 0:5c4d7b2438d3 51 * Put a char to the dongle's serial interface
switches 0:5c4d7b2438d3 52 */
switches 0:5c4d7b2438d3 53 virtual int putc(int c) = 0;
switches 0:5c4d7b2438d3 54
switches 0:5c4d7b2438d3 55 /*
switches 0:5c4d7b2438d3 56 * Read a packet from the dongle's serial interface, to be called after multiple getc() calls
switches 0:5c4d7b2438d3 57 */
switches 0:5c4d7b2438d3 58 virtual int readPacket() = 0;
switches 0:5c4d7b2438d3 59
switches 0:5c4d7b2438d3 60 /*
switches 0:5c4d7b2438d3 61 * Write a packet to the dongle's serial interface, to be called after multiple putc() calls
switches 0:5c4d7b2438d3 62 */
switches 0:5c4d7b2438d3 63 virtual int writePacket() = 0;
switches 0:5c4d7b2438d3 64
switches 0:5c4d7b2438d3 65 /**
switches 0:5c4d7b2438d3 66 * Check the number of bytes available.
switches 0:5c4d7b2438d3 67 *
switches 0:5c4d7b2438d3 68 * @returns the number of bytes available
switches 0:5c4d7b2438d3 69 */
switches 0:5c4d7b2438d3 70 virtual int readable() = 0;
switches 0:5c4d7b2438d3 71
switches 0:5c4d7b2438d3 72 /**
switches 0:5c4d7b2438d3 73 * Check the free space in output.
switches 0:5c4d7b2438d3 74 *
switches 0:5c4d7b2438d3 75 * @returns the number of bytes available
switches 0:5c4d7b2438d3 76 */
switches 0:5c4d7b2438d3 77 virtual int writeable() = 0;
switches 0:5c4d7b2438d3 78
switches 0:5c4d7b2438d3 79 /**
switches 0:5c4d7b2438d3 80 * Attach a handler to call when a packet is received / when a packet has been transmitted.
switches 0:5c4d7b2438d3 81 *
switches 0:5c4d7b2438d3 82 * @param pListener instance of the listener deriving from the IUSBHostSerialListener
switches 0:5c4d7b2438d3 83 */
switches 0:5c4d7b2438d3 84 virtual void attach(IUSBHostSerialListener* pListener) = 0;
switches 0:5c4d7b2438d3 85
switches 0:5c4d7b2438d3 86 /**
switches 0:5c4d7b2438d3 87 * Enable or disable readable/writeable callbacks
switches 0:5c4d7b2438d3 88 */
switches 0:5c4d7b2438d3 89 virtual void setupIrq(bool en, IrqType irq = RxIrq) = 0;
switches 0:5c4d7b2438d3 90
switches 0:5c4d7b2438d3 91 };
switches 0:5c4d7b2438d3 92
switches 0:5c4d7b2438d3 93 #endif /* USBHOST_3GMODULE */
switches 0:5c4d7b2438d3 94
switches 0:5c4d7b2438d3 95 #endif /* IUSBHOSTSERIAL_H_ */