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_TIMER_H
thedo 167:1657b442184c 17 #define MBED_TIMER_H
thedo 167:1657b442184c 18
thedo 167:1657b442184c 19 #include "platform/platform.h"
thedo 167:1657b442184c 20 #include "hal/ticker_api.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 general purpose timer
thedo 167:1657b442184c 26 *
thedo 167:1657b442184c 27 * @note Synchronization level: Interrupt safe
thedo 167:1657b442184c 28 *
thedo 167:1657b442184c 29 * Example:
thedo 167:1657b442184c 30 * @code
thedo 167:1657b442184c 31 * // Count the time to toggle a LED
thedo 167:1657b442184c 32 *
thedo 167:1657b442184c 33 * #include "mbed.h"
thedo 167:1657b442184c 34 *
thedo 167:1657b442184c 35 * Timer timer;
thedo 167:1657b442184c 36 * DigitalOut led(LED1);
thedo 167:1657b442184c 37 * int begin, end;
thedo 167:1657b442184c 38 *
thedo 167:1657b442184c 39 * int main() {
thedo 167:1657b442184c 40 * timer.start();
thedo 167:1657b442184c 41 * begin = timer.read_us();
thedo 167:1657b442184c 42 * led = !led;
thedo 167:1657b442184c 43 * end = timer.read_us();
thedo 167:1657b442184c 44 * printf("Toggle the led takes %d us", end - begin);
thedo 167:1657b442184c 45 * }
thedo 167:1657b442184c 46 * @endcode
thedo 167:1657b442184c 47 * @ingroup drivers
thedo 167:1657b442184c 48 */
thedo 167:1657b442184c 49 class Timer {
thedo 167:1657b442184c 50
thedo 167:1657b442184c 51 public:
thedo 167:1657b442184c 52 Timer();
thedo 167:1657b442184c 53 Timer(const ticker_data_t *data);
thedo 167:1657b442184c 54
thedo 167:1657b442184c 55 /** Start the timer
thedo 167:1657b442184c 56 */
thedo 167:1657b442184c 57 void start();
thedo 167:1657b442184c 58
thedo 167:1657b442184c 59 /** Stop the timer
thedo 167:1657b442184c 60 */
thedo 167:1657b442184c 61 void stop();
thedo 167:1657b442184c 62
thedo 167:1657b442184c 63 /** Reset the timer to 0.
thedo 167:1657b442184c 64 *
thedo 167:1657b442184c 65 * If it was already counting, it will continue
thedo 167:1657b442184c 66 */
thedo 167:1657b442184c 67 void reset();
thedo 167:1657b442184c 68
thedo 167:1657b442184c 69 /** Get the time passed in seconds
thedo 167:1657b442184c 70 */
thedo 167:1657b442184c 71 float read();
thedo 167:1657b442184c 72
thedo 167:1657b442184c 73 /** Get the time passed in mili-seconds
thedo 167:1657b442184c 74 */
thedo 167:1657b442184c 75 int read_ms();
thedo 167:1657b442184c 76
thedo 167:1657b442184c 77 /** Get the time passed in micro-seconds
thedo 167:1657b442184c 78 */
thedo 167:1657b442184c 79 int read_us();
thedo 167:1657b442184c 80
thedo 167:1657b442184c 81 /** An operator shorthand for read()
thedo 167:1657b442184c 82 */
thedo 167:1657b442184c 83 operator float();
thedo 167:1657b442184c 84
thedo 167:1657b442184c 85 /** Get in a high resolution type the time passed in micro-seconds.
thedo 167:1657b442184c 86 */
thedo 167:1657b442184c 87 us_timestamp_t read_high_resolution_us();
thedo 167:1657b442184c 88
thedo 167:1657b442184c 89 protected:
thedo 167:1657b442184c 90 us_timestamp_t slicetime();
thedo 167:1657b442184c 91 int _running; // whether the timer is running
thedo 167:1657b442184c 92 us_timestamp_t _start; // the start time of the latest slice
thedo 167:1657b442184c 93 us_timestamp_t _time; // any accumulated time from previous slices
thedo 167:1657b442184c 94 const ticker_data_t *_ticker_data;
thedo 167:1657b442184c 95 };
thedo 167:1657b442184c 96
thedo 167:1657b442184c 97 } // namespace mbed
thedo 167:1657b442184c 98
thedo 167:1657b442184c 99 #endif
thedo 167:1657b442184c 100