Bmag incl gps rettelse

Dependencies:   mbed WDT MODSERIAL BME280

Committer:
gert_lauritsen
Date:
Tue Jul 09 09:54:41 2019 +0000
Branch:
MbedBMAGThrRev
Revision:
64:06b9b8ffd5a6
Parent:
61:52a6d0ffd8e5
dataline version to 4 and fw til 1.0.0.7

Who changed what in which revision?

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