Naze32 clone with Frysky receiver
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

rtc_time.h 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #include <time.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /** Implementation of the C time.h functions
  21. *
  22. * Provides mechanisms to set and read the current time, based
  23. * on the microcontroller Real-Time Clock (RTC), plus some
  24. * standard C manipulation and formating functions.
  25. *
  26. * Example:
  27. * @code
  28. * #include "mbed.h"
  29. *
  30. * int main() {
  31. * set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
  32. *
  33. * while(1) {
  34. * time_t seconds = time(NULL);
  35. *
  36. * printf("Time as seconds since January 1, 1970 = %d\n", seconds);
  37. *
  38. * printf("Time as a basic string = %s", ctime(&seconds));
  39. *
  40. * char buffer[32];
  41. * strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
  42. * printf("Time as a custom formatted string = %s", buffer);
  43. *
  44. * wait(1);
  45. * }
  46. * }
  47. * @endcode
  48. */
  49. /** Set the current time
  50. *
  51. * Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
  52. * to the time represented by the number of seconds since January 1, 1970
  53. * (the UNIX timestamp).
  54. *
  55. * @param t Number of seconds since January 1, 1970 (the UNIX timestamp)
  56. *
  57. * Example:
  58. * @code
  59. * #include "mbed.h"
  60. *
  61. * int main() {
  62. * set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
  63. * }
  64. * @endcode
  65. */
  66. void set_time(time_t t);
  67. /** Attach an external RTC to be used for the C time functions
  68. *
  69. * Do not call this function from an interrupt while an RTC read/write operation may be occurring
  70. *
  71. * @param read_rtc pointer to function which returns current UNIX timestamp
  72. * @param write_rtc pointer to function which sets current UNIX timestamp, can be NULL
  73. * @param init_rtc pointer to funtion which initializes RTC, can be NULL
  74. * @param isenabled_rtc pointer to function wich returns if the rtc is enabled, can be NULL
  75. */
  76. void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void));
  77. #ifdef __cplusplus
  78. }
  79. #endif