Naze32 clone with Frysky receiver
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Timeout.h 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* mbed Microcontroller Library
  2. * Copyright (c) 2006-2013 ARM Limited
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef MBED_TIMEOUT_H
  17. #define MBED_TIMEOUT_H
  18. #include "Ticker.h"
  19. namespace mbed {
  20. /** A Timeout is used to call a function at a point in the future
  21. *
  22. * You can use as many seperate Timeout objects as you require.
  23. *
  24. * Example:
  25. * @code
  26. * // Blink until timeout.
  27. *
  28. * #include "mbed.h"
  29. *
  30. * Timeout timeout;
  31. * DigitalOut led(LED1);
  32. *
  33. * int on = 1;
  34. *
  35. * void attimeout() {
  36. * on = 0;
  37. * }
  38. *
  39. * int main() {
  40. * timeout.attach(&attimeout, 5);
  41. * while(on) {
  42. * led = !led;
  43. * wait(0.2);
  44. * }
  45. * }
  46. * @endcode
  47. */
  48. class Timeout : public Ticker {
  49. protected:
  50. virtual void handler();
  51. };
  52. } // namespace mbed
  53. #endif