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_BUSINOUT_H
thedo 167:1657b442184c 17 #define MBED_BUSINOUT_H
thedo 167:1657b442184c 18
thedo 167:1657b442184c 19 #include "drivers/DigitalInOut.h"
thedo 167:1657b442184c 20 #include "platform/PlatformMutex.h"
thedo 167:1657b442184c 21
thedo 167:1657b442184c 22 namespace mbed {
thedo 167:1657b442184c 23 /** \addtogroup drivers */
thedo 167:1657b442184c 24
thedo 167:1657b442184c 25 /** A digital input output bus, used for setting the state of a collection of pins
thedo 167:1657b442184c 26 *
thedo 167:1657b442184c 27 * @note Synchronization level: Thread safe
thedo 167:1657b442184c 28 * @ingroup drivers
thedo 167:1657b442184c 29 */
thedo 167:1657b442184c 30 class BusInOut {
thedo 167:1657b442184c 31
thedo 167:1657b442184c 32 public:
thedo 167:1657b442184c 33
thedo 167:1657b442184c 34 /** Create an BusInOut, connected to the specified pins
thedo 167:1657b442184c 35 *
thedo 167:1657b442184c 36 * @param p0 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 37 * @param p1 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 38 * @param p2 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 39 * @param p3 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 40 * @param p4 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 41 * @param p5 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 42 * @param p6 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 43 * @param p7 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 44 * @param p8 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 45 * @param p9 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 46 * @param p10 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 47 * @param p11 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 48 * @param p12 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 49 * @param p13 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 50 * @param p14 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 51 * @param p15 DigitalInOut pin to connect to bus bit
thedo 167:1657b442184c 52 *
thedo 167:1657b442184c 53 * @note
thedo 167:1657b442184c 54 * It is only required to specify as many pin variables as is required
thedo 167:1657b442184c 55 * for the bus; the rest will default to NC (not connected)
thedo 167:1657b442184c 56 */
thedo 167:1657b442184c 57 BusInOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
thedo 167:1657b442184c 58 PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
thedo 167:1657b442184c 59 PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
thedo 167:1657b442184c 60 PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC);
thedo 167:1657b442184c 61
thedo 167:1657b442184c 62 /** Create an BusInOut, connected to the specified pins
thedo 167:1657b442184c 63 *
thedo 167:1657b442184c 64 * @param pins An array of pins to construct a BusInOut from
thedo 167:1657b442184c 65 */
thedo 167:1657b442184c 66 BusInOut(PinName pins[16]);
thedo 167:1657b442184c 67
thedo 167:1657b442184c 68 virtual ~BusInOut();
thedo 167:1657b442184c 69
thedo 167:1657b442184c 70 /* Group: Access Methods */
thedo 167:1657b442184c 71
thedo 167:1657b442184c 72 /** Write the value to the output bus
thedo 167:1657b442184c 73 *
thedo 167:1657b442184c 74 * @param value An integer specifying a bit to write for every corresponding DigitalInOut pin
thedo 167:1657b442184c 75 */
thedo 167:1657b442184c 76 void write(int value);
thedo 167:1657b442184c 77
thedo 167:1657b442184c 78 /** Read the value currently output on the bus
thedo 167:1657b442184c 79 *
thedo 167:1657b442184c 80 * @returns
thedo 167:1657b442184c 81 * An integer with each bit corresponding to associated DigitalInOut pin setting
thedo 167:1657b442184c 82 */
thedo 167:1657b442184c 83 int read();
thedo 167:1657b442184c 84
thedo 167:1657b442184c 85 /** Set as an output
thedo 167:1657b442184c 86 */
thedo 167:1657b442184c 87 void output();
thedo 167:1657b442184c 88
thedo 167:1657b442184c 89 /** Set as an input
thedo 167:1657b442184c 90 */
thedo 167:1657b442184c 91 void input();
thedo 167:1657b442184c 92
thedo 167:1657b442184c 93 /** Set the input pin mode
thedo 167:1657b442184c 94 *
thedo 167:1657b442184c 95 * @param pull PullUp, PullDown, PullNone
thedo 167:1657b442184c 96 */
thedo 167:1657b442184c 97 void mode(PinMode pull);
thedo 167:1657b442184c 98
thedo 167:1657b442184c 99 /** Binary mask of bus pins connected to actual pins (not NC pins)
thedo 167:1657b442184c 100 * If bus pin is in NC state make corresponding bit will be cleared (set to 0), else bit will be set to 1
thedo 167:1657b442184c 101 *
thedo 167:1657b442184c 102 * @returns
thedo 167:1657b442184c 103 * Binary mask of connected pins
thedo 167:1657b442184c 104 */
thedo 167:1657b442184c 105 int mask() {
thedo 167:1657b442184c 106 // No lock needed since _nc_mask is not modified outside the constructor
thedo 167:1657b442184c 107 return _nc_mask;
thedo 167:1657b442184c 108 }
thedo 167:1657b442184c 109
thedo 167:1657b442184c 110 /** A shorthand for write()
thedo 167:1657b442184c 111 */
thedo 167:1657b442184c 112 BusInOut& operator= (int v);
thedo 167:1657b442184c 113 BusInOut& operator= (BusInOut& rhs);
thedo 167:1657b442184c 114
thedo 167:1657b442184c 115 /** Access to particular bit in random-iterator fashion
thedo 167:1657b442184c 116 */
thedo 167:1657b442184c 117 DigitalInOut& operator[] (int index);
thedo 167:1657b442184c 118
thedo 167:1657b442184c 119 /** A shorthand for read()
thedo 167:1657b442184c 120 */
thedo 167:1657b442184c 121 operator int();
thedo 167:1657b442184c 122
thedo 167:1657b442184c 123 protected:
thedo 167:1657b442184c 124 virtual void lock();
thedo 167:1657b442184c 125 virtual void unlock();
thedo 167:1657b442184c 126 DigitalInOut* _pin[16];
thedo 167:1657b442184c 127
thedo 167:1657b442184c 128 /* Mask of bus's NC pins
thedo 167:1657b442184c 129 * If bit[n] is set to 1 - pin is connected
thedo 167:1657b442184c 130 * if bit[n] is cleared - pin is not connected (NC)
thedo 167:1657b442184c 131 */
thedo 167:1657b442184c 132 int _nc_mask;
thedo 167:1657b442184c 133
thedo 167:1657b442184c 134 PlatformMutex _mutex;
thedo 167:1657b442184c 135
thedo 167:1657b442184c 136 /* disallow copy constructor and assignment operators */
thedo 167:1657b442184c 137 private:
thedo 167:1657b442184c 138 BusInOut(const BusInOut&);
thedo 167:1657b442184c 139 BusInOut & operator = (const BusInOut&);
thedo 167:1657b442184c 140 };
thedo 167:1657b442184c 141
thedo 167:1657b442184c 142 } // namespace mbed
thedo 167:1657b442184c 143
thedo 167:1657b442184c 144 #endif
thedo 167:1657b442184c 145