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_BUSOUT_H
thedo 167:1657b442184c 17 #define MBED_BUSOUT_H
thedo 167:1657b442184c 18
thedo 167:1657b442184c 19 #include "drivers/DigitalOut.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 output bus, used for setting the state of a collection of pins
thedo 167:1657b442184c 26 * @ingroup drivers
thedo 167:1657b442184c 27 */
thedo 167:1657b442184c 28 class BusOut {
thedo 167:1657b442184c 29
thedo 167:1657b442184c 30 public:
thedo 167:1657b442184c 31
thedo 167:1657b442184c 32 /** Create an BusOut, connected to the specified pins
thedo 167:1657b442184c 33 *
thedo 167:1657b442184c 34 * @param p0 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 35 * @param p1 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 36 * @param p2 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 37 * @param p3 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 38 * @param p4 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 39 * @param p5 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 40 * @param p6 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 41 * @param p7 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 42 * @param p8 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 43 * @param p9 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 44 * @param p10 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 45 * @param p11 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 46 * @param p12 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 47 * @param p13 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 48 * @param p14 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 49 * @param p15 DigitalOut pin to connect to bus bit
thedo 167:1657b442184c 50 *
thedo 167:1657b442184c 51 * @note Synchronization level: Thread safe
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 BusOut(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 BusOut, connected to the specified pins
thedo 167:1657b442184c 63 *
thedo 167:1657b442184c 64 * @param pins An array of pins to connect to bus the bit
thedo 167:1657b442184c 65 */
thedo 167:1657b442184c 66 BusOut(PinName pins[16]);
thedo 167:1657b442184c 67
thedo 167:1657b442184c 68 virtual ~BusOut();
thedo 167:1657b442184c 69
thedo 167:1657b442184c 70 /** Write the value to the output bus
thedo 167:1657b442184c 71 *
thedo 167:1657b442184c 72 * @param value An integer specifying a bit to write for every corresponding DigitalOut pin
thedo 167:1657b442184c 73 */
thedo 167:1657b442184c 74 void write(int value);
thedo 167:1657b442184c 75
thedo 167:1657b442184c 76 /** Read the value currently output on the bus
thedo 167:1657b442184c 77 *
thedo 167:1657b442184c 78 * @returns
thedo 167:1657b442184c 79 * An integer with each bit corresponding to associated DigitalOut pin setting
thedo 167:1657b442184c 80 */
thedo 167:1657b442184c 81 int read();
thedo 167:1657b442184c 82
thedo 167:1657b442184c 83 /** Binary mask of bus pins connected to actual pins (not NC pins)
thedo 167:1657b442184c 84 * 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 85 *
thedo 167:1657b442184c 86 * @returns
thedo 167:1657b442184c 87 * Binary mask of connected pins
thedo 167:1657b442184c 88 */
thedo 167:1657b442184c 89 int mask() {
thedo 167:1657b442184c 90 // No lock needed since _nc_mask is not modified outside the constructor
thedo 167:1657b442184c 91 return _nc_mask;
thedo 167:1657b442184c 92 }
thedo 167:1657b442184c 93
thedo 167:1657b442184c 94 /** A shorthand for write()
thedo 167:1657b442184c 95 */
thedo 167:1657b442184c 96 BusOut& operator= (int v);
thedo 167:1657b442184c 97 BusOut& operator= (BusOut& rhs);
thedo 167:1657b442184c 98
thedo 167:1657b442184c 99 /** Access to particular bit in random-iterator fashion
thedo 167:1657b442184c 100 */
thedo 167:1657b442184c 101 DigitalOut& operator[] (int index);
thedo 167:1657b442184c 102
thedo 167:1657b442184c 103 /** A shorthand for read()
thedo 167:1657b442184c 104 */
thedo 167:1657b442184c 105 operator int();
thedo 167:1657b442184c 106
thedo 167:1657b442184c 107 protected:
thedo 167:1657b442184c 108 virtual void lock();
thedo 167:1657b442184c 109 virtual void unlock();
thedo 167:1657b442184c 110 DigitalOut* _pin[16];
thedo 167:1657b442184c 111
thedo 167:1657b442184c 112 /* Mask of bus's NC pins
thedo 167:1657b442184c 113 * If bit[n] is set to 1 - pin is connected
thedo 167:1657b442184c 114 * if bit[n] is cleared - pin is not connected (NC)
thedo 167:1657b442184c 115 */
thedo 167:1657b442184c 116 int _nc_mask;
thedo 167:1657b442184c 117
thedo 167:1657b442184c 118 PlatformMutex _mutex;
thedo 167:1657b442184c 119
thedo 167:1657b442184c 120 /* disallow copy constructor and assignment operators */
thedo 167:1657b442184c 121 private:
thedo 167:1657b442184c 122 BusOut(const BusOut&);
thedo 167:1657b442184c 123 BusOut & operator = (const BusOut&);
thedo 167:1657b442184c 124 };
thedo 167:1657b442184c 125
thedo 167:1657b442184c 126 } // namespace mbed
thedo 167:1657b442184c 127
thedo 167:1657b442184c 128 #endif
thedo 167:1657b442184c 129