Opencv 3.1 project on GR-PEACH board
Fork of gr-peach-opencv-project by
drivers/Timeout.h@167:1657b442184c, 2017-06-29 (annotated)
- Committer:
- thedo
- Date:
- Thu Jun 29 11:01:39 2017 +0000
- Revision:
- 167:1657b442184c
Opencv 3.1 project on GR-PEACH board, 4 apps
Who changed what in which revision?
User | Revision | Line number | New 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_TIMEOUT_H |
thedo | 167:1657b442184c | 17 | #define MBED_TIMEOUT_H |
thedo | 167:1657b442184c | 18 | |
thedo | 167:1657b442184c | 19 | #include "drivers/Ticker.h" |
thedo | 167:1657b442184c | 20 | |
thedo | 167:1657b442184c | 21 | namespace mbed { |
thedo | 167:1657b442184c | 22 | /** \addtogroup drivers */ |
thedo | 167:1657b442184c | 23 | |
thedo | 167:1657b442184c | 24 | /** A Timeout is used to call a function at a point in the future |
thedo | 167:1657b442184c | 25 | * |
thedo | 167:1657b442184c | 26 | * You can use as many seperate Timeout objects as you require. |
thedo | 167:1657b442184c | 27 | * |
thedo | 167:1657b442184c | 28 | * @note Synchronization level: Interrupt safe |
thedo | 167:1657b442184c | 29 | * |
thedo | 167:1657b442184c | 30 | * Example: |
thedo | 167:1657b442184c | 31 | * @code |
thedo | 167:1657b442184c | 32 | * // Blink until timeout. |
thedo | 167:1657b442184c | 33 | * |
thedo | 167:1657b442184c | 34 | * #include "mbed.h" |
thedo | 167:1657b442184c | 35 | * |
thedo | 167:1657b442184c | 36 | * Timeout timeout; |
thedo | 167:1657b442184c | 37 | * DigitalOut led(LED1); |
thedo | 167:1657b442184c | 38 | * |
thedo | 167:1657b442184c | 39 | * int on = 1; |
thedo | 167:1657b442184c | 40 | * |
thedo | 167:1657b442184c | 41 | * void attimeout() { |
thedo | 167:1657b442184c | 42 | * on = 0; |
thedo | 167:1657b442184c | 43 | * } |
thedo | 167:1657b442184c | 44 | * |
thedo | 167:1657b442184c | 45 | * int main() { |
thedo | 167:1657b442184c | 46 | * timeout.attach(&attimeout, 5); |
thedo | 167:1657b442184c | 47 | * while(on) { |
thedo | 167:1657b442184c | 48 | * led = !led; |
thedo | 167:1657b442184c | 49 | * wait(0.2); |
thedo | 167:1657b442184c | 50 | * } |
thedo | 167:1657b442184c | 51 | * } |
thedo | 167:1657b442184c | 52 | * @endcode |
thedo | 167:1657b442184c | 53 | * @ingroup drivers |
thedo | 167:1657b442184c | 54 | */ |
thedo | 167:1657b442184c | 55 | class Timeout : public Ticker { |
thedo | 167:1657b442184c | 56 | |
thedo | 167:1657b442184c | 57 | protected: |
thedo | 167:1657b442184c | 58 | virtual void handler(); |
thedo | 167:1657b442184c | 59 | }; |
thedo | 167:1657b442184c | 60 | |
thedo | 167:1657b442184c | 61 | } // namespace mbed |
thedo | 167:1657b442184c | 62 | |
thedo | 167:1657b442184c | 63 | #endif |
thedo | 167:1657b442184c | 64 |