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