Bmag incl gps rettelse

Dependencies:   mbed WDT MODSERIAL BME280

Committer:
gert_lauritsen
Date:
Thu Jun 20 07:13:18 2019 +0000
Revision:
56:df9052e3808c
change date stamp from gps, reads serialnumb from file.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gert_lauritsen 56:df9052e3808c 1 /* mbed Microcontroller Library
gert_lauritsen 56:df9052e3808c 2 * Copyright (c) 2006-2012 ARM Limited
gert_lauritsen 56:df9052e3808c 3 *
gert_lauritsen 56:df9052e3808c 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
gert_lauritsen 56:df9052e3808c 5 * of this software and associated documentation files (the "Software"), to deal
gert_lauritsen 56:df9052e3808c 6 * in the Software without restriction, including without limitation the rights
gert_lauritsen 56:df9052e3808c 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
gert_lauritsen 56:df9052e3808c 8 * copies of the Software, and to permit persons to whom the Software is
gert_lauritsen 56:df9052e3808c 9 * furnished to do so, subject to the following conditions:
gert_lauritsen 56:df9052e3808c 10 *
gert_lauritsen 56:df9052e3808c 11 * The above copyright notice and this permission notice shall be included in
gert_lauritsen 56:df9052e3808c 12 * all copies or substantial portions of the Software.
gert_lauritsen 56:df9052e3808c 13 *
gert_lauritsen 56:df9052e3808c 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
gert_lauritsen 56:df9052e3808c 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
gert_lauritsen 56:df9052e3808c 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
gert_lauritsen 56:df9052e3808c 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
gert_lauritsen 56:df9052e3808c 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
gert_lauritsen 56:df9052e3808c 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
gert_lauritsen 56:df9052e3808c 20 * SOFTWARE.
gert_lauritsen 56:df9052e3808c 21 */
gert_lauritsen 56:df9052e3808c 22 #ifndef RTOS_TIMER_H
gert_lauritsen 56:df9052e3808c 23 #define RTOS_TIMER_H
gert_lauritsen 56:df9052e3808c 24
gert_lauritsen 56:df9052e3808c 25 #include <stdint.h>
gert_lauritsen 56:df9052e3808c 26 #include "cmsis_os.h"
gert_lauritsen 56:df9052e3808c 27 #include "platform/Callback.h"
gert_lauritsen 56:df9052e3808c 28 #include "platform/toolchain.h"
gert_lauritsen 56:df9052e3808c 29
gert_lauritsen 56:df9052e3808c 30 namespace rtos {
gert_lauritsen 56:df9052e3808c 31 /** \addtogroup rtos */
gert_lauritsen 56:df9052e3808c 32 /** @{*/
gert_lauritsen 56:df9052e3808c 33
gert_lauritsen 56:df9052e3808c 34 /** The RtosTimer class allow creating and and controlling of timer functions in the system.
gert_lauritsen 56:df9052e3808c 35 A timer function is called when a time period expires whereby both on-shot and
gert_lauritsen 56:df9052e3808c 36 periodic timers are possible. A timer can be started, restarted, or stopped.
gert_lauritsen 56:df9052e3808c 37
gert_lauritsen 56:df9052e3808c 38 Timers are handled in the thread osTimerThread.
gert_lauritsen 56:df9052e3808c 39 Callback functions run under control of this thread and may use CMSIS-RTOS API calls.
gert_lauritsen 56:df9052e3808c 40 */
gert_lauritsen 56:df9052e3808c 41 class RtosTimer {
gert_lauritsen 56:df9052e3808c 42 public:
gert_lauritsen 56:df9052e3808c 43 /** Create timer.
gert_lauritsen 56:df9052e3808c 44 @param func function to be executed by this timer.
gert_lauritsen 56:df9052e3808c 45 @param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic)
gert_lauritsen 56:df9052e3808c 46 @param argument argument to the timer call back function. (default: NULL)
gert_lauritsen 56:df9052e3808c 47 @deprecated Replaced with RtosTimer(Callback<void()>, os_timer_type)
gert_lauritsen 56:df9052e3808c 48 */
gert_lauritsen 56:df9052e3808c 49 MBED_DEPRECATED_SINCE("mbed-os-5.1",
gert_lauritsen 56:df9052e3808c 50 "Replaced with RtosTimer(Callback<void()>, os_timer_type)")
gert_lauritsen 56:df9052e3808c 51 RtosTimer(void (*func)(void const *argument), os_timer_type type=osTimerPeriodic, void *argument=NULL) {
gert_lauritsen 56:df9052e3808c 52 constructor(mbed::callback((void (*)(void *))func, argument), type);
gert_lauritsen 56:df9052e3808c 53 }
gert_lauritsen 56:df9052e3808c 54
gert_lauritsen 56:df9052e3808c 55 /** Create timer.
gert_lauritsen 56:df9052e3808c 56 @param func function to be executed by this timer.
gert_lauritsen 56:df9052e3808c 57 @param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic)
gert_lauritsen 56:df9052e3808c 58 */
gert_lauritsen 56:df9052e3808c 59 RtosTimer(mbed::Callback<void()> func, os_timer_type type=osTimerPeriodic) {
gert_lauritsen 56:df9052e3808c 60 constructor(func, type);
gert_lauritsen 56:df9052e3808c 61 }
gert_lauritsen 56:df9052e3808c 62
gert_lauritsen 56:df9052e3808c 63 /** Create timer.
gert_lauritsen 56:df9052e3808c 64 @param obj pointer to the object to call the member function on.
gert_lauritsen 56:df9052e3808c 65 @param method member function to be executed by this timer.
gert_lauritsen 56:df9052e3808c 66 @param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic)
gert_lauritsen 56:df9052e3808c 67 @deprecated
gert_lauritsen 56:df9052e3808c 68 The RtosTimer constructor does not support cv-qualifiers. Replaced by
gert_lauritsen 56:df9052e3808c 69 RtosTimer(callback(obj, method), os_timer_type).
gert_lauritsen 56:df9052e3808c 70 */
gert_lauritsen 56:df9052e3808c 71 template <typename T, typename M>
gert_lauritsen 56:df9052e3808c 72 MBED_DEPRECATED_SINCE("mbed-os-5.1",
gert_lauritsen 56:df9052e3808c 73 "The RtosTimer constructor does not support cv-qualifiers. Replaced by "
gert_lauritsen 56:df9052e3808c 74 "RtosTimer(callback(obj, method), os_timer_type).")
gert_lauritsen 56:df9052e3808c 75 RtosTimer(T *obj, M method, os_timer_type type=osTimerPeriodic) {
gert_lauritsen 56:df9052e3808c 76 constructor(mbed::callback(obj, method), type);
gert_lauritsen 56:df9052e3808c 77 }
gert_lauritsen 56:df9052e3808c 78
gert_lauritsen 56:df9052e3808c 79 /** Stop the timer.
gert_lauritsen 56:df9052e3808c 80 @return status code that indicates the execution status of the function.
gert_lauritsen 56:df9052e3808c 81 */
gert_lauritsen 56:df9052e3808c 82 osStatus stop(void);
gert_lauritsen 56:df9052e3808c 83
gert_lauritsen 56:df9052e3808c 84 /** Start the timer.
gert_lauritsen 56:df9052e3808c 85 @param millisec time delay value of the timer.
gert_lauritsen 56:df9052e3808c 86 @return status code that indicates the execution status of the function.
gert_lauritsen 56:df9052e3808c 87 */
gert_lauritsen 56:df9052e3808c 88 osStatus start(uint32_t millisec);
gert_lauritsen 56:df9052e3808c 89
gert_lauritsen 56:df9052e3808c 90 ~RtosTimer();
gert_lauritsen 56:df9052e3808c 91
gert_lauritsen 56:df9052e3808c 92 private:
gert_lauritsen 56:df9052e3808c 93 // Required to share definitions without
gert_lauritsen 56:df9052e3808c 94 // delegated constructors
gert_lauritsen 56:df9052e3808c 95 void constructor(mbed::Callback<void()> func, os_timer_type type);
gert_lauritsen 56:df9052e3808c 96
gert_lauritsen 56:df9052e3808c 97 mbed::Callback<void()> _function;
gert_lauritsen 56:df9052e3808c 98 osTimerId _timer_id;
gert_lauritsen 56:df9052e3808c 99 osTimerDef_t _timer;
gert_lauritsen 56:df9052e3808c 100 #if defined(CMSIS_OS_RTX) && !defined(__MBED_CMSIS_RTOS_CM)
gert_lauritsen 56:df9052e3808c 101 uint32_t _timer_data[5];
gert_lauritsen 56:df9052e3808c 102 #else
gert_lauritsen 56:df9052e3808c 103 uint32_t _timer_data[6];
gert_lauritsen 56:df9052e3808c 104 #endif
gert_lauritsen 56:df9052e3808c 105 };
gert_lauritsen 56:df9052e3808c 106
gert_lauritsen 56:df9052e3808c 107 }
gert_lauritsen 56:df9052e3808c 108
gert_lauritsen 56:df9052e3808c 109 #endif
gert_lauritsen 56:df9052e3808c 110
gert_lauritsen 56:df9052e3808c 111 /** @}*/