Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
Timeout.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_TIMEOUT_H 00017 #define MBED_TIMEOUT_H 00018 00019 #include "drivers/Ticker.h" 00020 #include "platform/NonCopyable.h" 00021 #include "platform/mbed_sleep.h" 00022 00023 namespace mbed { 00024 /** \addtogroup drivers */ 00025 00026 /** A Timeout is used to call a function at a point in the future 00027 * 00028 * You can use as many seperate Timeout objects as you require. 00029 * 00030 * @note Synchronization level: Interrupt safe 00031 * 00032 * Example: 00033 * @code 00034 * // Blink until timeout. 00035 * 00036 * #include "mbed.h" 00037 * 00038 * Timeout timeout; 00039 * DigitalOut led(LED1); 00040 * 00041 * int on = 1; 00042 * 00043 * void attimeout() { 00044 * on = 0; 00045 * } 00046 * 00047 * int main() { 00048 * timeout.attach(&attimeout, 5); 00049 * while(on) { 00050 * led = !led; 00051 * wait(0.2); 00052 * } 00053 * } 00054 * @endcode 00055 * @ingroup drivers 00056 */ 00057 class Timeout : public Ticker, private NonCopyable<Timeout> { 00058 00059 protected: 00060 virtual void handler(); 00061 }; 00062 00063 } // namespace mbed 00064 00065 #endif
Generated on Sun Jul 17 2022 08:25:32 by 1.7.2