Opencv 3.1 project on GR-PEACH board

Fork of gr-peach-opencv-project by the do

Committer:
thedo
Date:
Tue Jul 04 06:23:13 2017 +0000
Revision:
170:54ff26da7eb6
Parent:
167:1657b442184c
project opencv 3.1 on GR PEACH board, no use SD card.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thedo 167:1657b442184c 1 /* mbed Microcontroller Library
thedo 167:1657b442184c 2 * Copyright (c) 2006-2013 ARM Limited
thedo 167:1657b442184c 3 *
thedo 167:1657b442184c 4 * Licensed under the Apache License, Version 2.0 (the "License");
thedo 167:1657b442184c 5 * you may not use this file except in compliance with the License.
thedo 167:1657b442184c 6 * You may obtain a copy of the License at
thedo 167:1657b442184c 7 *
thedo 167:1657b442184c 8 * http://www.apache.org/licenses/LICENSE-2.0
thedo 167:1657b442184c 9 *
thedo 167:1657b442184c 10 * Unless required by applicable law or agreed to in writing, software
thedo 167:1657b442184c 11 * distributed under the License is distributed on an "AS IS" BASIS,
thedo 167:1657b442184c 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
thedo 167:1657b442184c 13 * See the License for the specific language governing permissions and
thedo 167:1657b442184c 14 * limitations under the License.
thedo 167:1657b442184c 15 */
thedo 167:1657b442184c 16 #ifndef MBED_SERIAL_H
thedo 167:1657b442184c 17 #define MBED_SERIAL_H
thedo 167:1657b442184c 18
thedo 167:1657b442184c 19 #include "platform/platform.h"
thedo 167:1657b442184c 20
thedo 167:1657b442184c 21 #if defined (DEVICE_SERIAL) || defined(DOXYGEN_ONLY)
thedo 167:1657b442184c 22
thedo 167:1657b442184c 23 #include "Stream.h"
thedo 167:1657b442184c 24 #include "SerialBase.h"
thedo 167:1657b442184c 25 #include "PlatformMutex.h"
thedo 167:1657b442184c 26 #include "serial_api.h"
thedo 167:1657b442184c 27
thedo 167:1657b442184c 28 namespace mbed {
thedo 167:1657b442184c 29 /** \addtogroup drivers */
thedo 167:1657b442184c 30
thedo 167:1657b442184c 31 /** A serial port (UART) for communication with other serial devices
thedo 167:1657b442184c 32 *
thedo 167:1657b442184c 33 * Can be used for Full Duplex communication, or Simplex by specifying
thedo 167:1657b442184c 34 * one pin as NC (Not Connected)
thedo 167:1657b442184c 35 *
thedo 167:1657b442184c 36 * @note Synchronization level: Thread safe
thedo 167:1657b442184c 37 *
thedo 167:1657b442184c 38 * Example:
thedo 167:1657b442184c 39 * @code
thedo 167:1657b442184c 40 * // Print "Hello World" to the PC
thedo 167:1657b442184c 41 *
thedo 167:1657b442184c 42 * #include "mbed.h"
thedo 167:1657b442184c 43 *
thedo 167:1657b442184c 44 * Serial pc(USBTX, USBRX);
thedo 167:1657b442184c 45 *
thedo 167:1657b442184c 46 * int main() {
thedo 167:1657b442184c 47 * pc.printf("Hello World\n");
thedo 167:1657b442184c 48 * }
thedo 167:1657b442184c 49 * @endcode
thedo 167:1657b442184c 50 * @ingroup drivers
thedo 167:1657b442184c 51 */
thedo 167:1657b442184c 52 class Serial : public SerialBase, public Stream {
thedo 167:1657b442184c 53
thedo 167:1657b442184c 54 public:
thedo 167:1657b442184c 55 #if DEVICE_SERIAL_ASYNCH
thedo 167:1657b442184c 56 using SerialBase::read;
thedo 167:1657b442184c 57 using SerialBase::write;
thedo 167:1657b442184c 58 #endif
thedo 167:1657b442184c 59
thedo 167:1657b442184c 60 /** Create a Serial port, connected to the specified transmit and receive pins
thedo 167:1657b442184c 61 *
thedo 167:1657b442184c 62 * @param tx Transmit pin
thedo 167:1657b442184c 63 * @param rx Receive pin
thedo 167:1657b442184c 64 * @param name The name of the stream associated with this serial port (optional)
thedo 167:1657b442184c 65 * @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE)
thedo 167:1657b442184c 66 *
thedo 167:1657b442184c 67 * @note
thedo 167:1657b442184c 68 * Either tx or rx may be specified as NC if unused
thedo 167:1657b442184c 69 */
thedo 167:1657b442184c 70 Serial(PinName tx, PinName rx, const char *name=NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
thedo 167:1657b442184c 71
thedo 167:1657b442184c 72
thedo 167:1657b442184c 73 /** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
thedo 167:1657b442184c 74 *
thedo 167:1657b442184c 75 * @param tx Transmit pin
thedo 167:1657b442184c 76 * @param rx Receive pin
thedo 167:1657b442184c 77 * @param baud The baud rate of the serial port
thedo 167:1657b442184c 78 *
thedo 167:1657b442184c 79 * @note
thedo 167:1657b442184c 80 * Either tx or rx may be specified as NC if unused
thedo 167:1657b442184c 81 */
thedo 167:1657b442184c 82 Serial(PinName tx, PinName rx, int baud);
thedo 167:1657b442184c 83
thedo 167:1657b442184c 84 /* Stream gives us a FileHandle with non-functional poll()/readable()/writable. Pass through
thedo 167:1657b442184c 85 * the calls from the SerialBase instead for backwards compatibility. This problem is
thedo 167:1657b442184c 86 * part of why Stream and Serial should be deprecated.
thedo 167:1657b442184c 87 */
thedo 167:1657b442184c 88 bool readable()
thedo 167:1657b442184c 89 {
thedo 167:1657b442184c 90 return SerialBase::readable();
thedo 167:1657b442184c 91 }
thedo 167:1657b442184c 92 bool writable()
thedo 167:1657b442184c 93 {
thedo 167:1657b442184c 94 return SerialBase::writeable();
thedo 167:1657b442184c 95 }
thedo 167:1657b442184c 96 bool writeable()
thedo 167:1657b442184c 97 {
thedo 167:1657b442184c 98 return SerialBase::writeable();
thedo 167:1657b442184c 99 }
thedo 167:1657b442184c 100
thedo 167:1657b442184c 101 protected:
thedo 167:1657b442184c 102 virtual int _getc();
thedo 167:1657b442184c 103 virtual int _putc(int c);
thedo 167:1657b442184c 104 virtual void lock();
thedo 167:1657b442184c 105 virtual void unlock();
thedo 167:1657b442184c 106
thedo 167:1657b442184c 107 PlatformMutex _mutex;
thedo 167:1657b442184c 108 };
thedo 167:1657b442184c 109
thedo 167:1657b442184c 110 } // namespace mbed
thedo 167:1657b442184c 111
thedo 167:1657b442184c 112 #endif
thedo 167:1657b442184c 113
thedo 167:1657b442184c 114 #endif
thedo 167:1657b442184c 115