Bmag incl gps rettelse

Dependencies:   mbed WDT MODSERIAL BME280

Committer:
gert_lauritsen
Date:
Thu Jun 20 07:13:18 2019 +0000
Revision:
56:df9052e3808c
change date stamp from gps, reads serialnumb from file.

Who changed what in which revision?

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