james kain / Mbed 2 deprecated GPS_Incremental

Dependencies:   mbed

Fork of GPS_Incremental by Dan Matthews

Committer:
dannyman939
Date:
Tue Mar 19 02:17:40 2013 +0000
Revision:
0:c746ee34feae
Basic functionality, Chris Version 0.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dannyman939 0:c746ee34feae 1 /* Copyright (c) 2012 mbed.org */
dannyman939 0:c746ee34feae 2 #ifndef TIMER_H
dannyman939 0:c746ee34feae 3 #define TIMER_H
dannyman939 0:c746ee34feae 4
dannyman939 0:c746ee34feae 5 #include <stdint.h>
dannyman939 0:c746ee34feae 6 #include "cmsis_os.h"
dannyman939 0:c746ee34feae 7
dannyman939 0:c746ee34feae 8 namespace rtos {
dannyman939 0:c746ee34feae 9
dannyman939 0:c746ee34feae 10 /*! The RtosTimer class allow creating and and controlling of timer functions in the system.
dannyman939 0:c746ee34feae 11 A timer function is called when a time period expires whereby both on-shot and
dannyman939 0:c746ee34feae 12 periodic timers are possible. A timer can be started, restarted, or stopped.
dannyman939 0:c746ee34feae 13
dannyman939 0:c746ee34feae 14 Timers are handled in the thread osTimerThread.
dannyman939 0:c746ee34feae 15 Callback functions run under control of this thread and may use CMSIS-RTOS API calls.
dannyman939 0:c746ee34feae 16 */
dannyman939 0:c746ee34feae 17 class RtosTimer {
dannyman939 0:c746ee34feae 18 public:
dannyman939 0:c746ee34feae 19 /*! Create and Start timer.
dannyman939 0:c746ee34feae 20 \param task name of the timer call back function.
dannyman939 0:c746ee34feae 21 \param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic)
dannyman939 0:c746ee34feae 22 \param argument argument to the timer call back function. (default: NULL)
dannyman939 0:c746ee34feae 23 */
dannyman939 0:c746ee34feae 24 RtosTimer(void (*task)(void const *argument),
dannyman939 0:c746ee34feae 25 os_timer_type type=osTimerPeriodic,
dannyman939 0:c746ee34feae 26 void *argument=NULL);
dannyman939 0:c746ee34feae 27
dannyman939 0:c746ee34feae 28 /*! Stop the timer.
dannyman939 0:c746ee34feae 29 \return status code that indicates the execution status of the function.
dannyman939 0:c746ee34feae 30 */
dannyman939 0:c746ee34feae 31 osStatus stop(void);
dannyman939 0:c746ee34feae 32
dannyman939 0:c746ee34feae 33 /*! start a timer.
dannyman939 0:c746ee34feae 34 \param millisec time delay value of the timer.
dannyman939 0:c746ee34feae 35 \return status code that indicates the execution status of the function.
dannyman939 0:c746ee34feae 36 */
dannyman939 0:c746ee34feae 37 osStatus start(uint32_t millisec);
dannyman939 0:c746ee34feae 38
dannyman939 0:c746ee34feae 39 ~RtosTimer();
dannyman939 0:c746ee34feae 40
dannyman939 0:c746ee34feae 41 private:
dannyman939 0:c746ee34feae 42 osTimerId _timer_id;
dannyman939 0:c746ee34feae 43 osTimerDef_t _timer;
dannyman939 0:c746ee34feae 44 #ifdef CMSIS_OS_RTX
dannyman939 0:c746ee34feae 45 uint32_t _timer_data[5];
dannyman939 0:c746ee34feae 46 #endif
dannyman939 0:c746ee34feae 47 };
dannyman939 0:c746ee34feae 48
dannyman939 0:c746ee34feae 49 }
dannyman939 0:c746ee34feae 50
dannyman939 0:c746ee34feae 51 #endif