Final 350 project

Dependencies:   uzair Camera_LS_Y201 F7_Ethernet LCD_DISCO_F746NG NetworkAPI SDFileSystem mbed

Committer:
shoaib_ahmed
Date:
Mon Jul 31 09:16:35 2017 +0000
Revision:
0:791a779d6220
final project;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shoaib_ahmed 0:791a779d6220 1 /* mbed Microcontroller Library
shoaib_ahmed 0:791a779d6220 2 * Copyright (c) 2006-2012 ARM Limited
shoaib_ahmed 0:791a779d6220 3 *
shoaib_ahmed 0:791a779d6220 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
shoaib_ahmed 0:791a779d6220 5 * of this software and associated documentation files (the "Software"), to deal
shoaib_ahmed 0:791a779d6220 6 * in the Software without restriction, including without limitation the rights
shoaib_ahmed 0:791a779d6220 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
shoaib_ahmed 0:791a779d6220 8 * copies of the Software, and to permit persons to whom the Software is
shoaib_ahmed 0:791a779d6220 9 * furnished to do so, subject to the following conditions:
shoaib_ahmed 0:791a779d6220 10 *
shoaib_ahmed 0:791a779d6220 11 * The above copyright notice and this permission notice shall be included in
shoaib_ahmed 0:791a779d6220 12 * all copies or substantial portions of the Software.
shoaib_ahmed 0:791a779d6220 13 *
shoaib_ahmed 0:791a779d6220 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
shoaib_ahmed 0:791a779d6220 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
shoaib_ahmed 0:791a779d6220 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
shoaib_ahmed 0:791a779d6220 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
shoaib_ahmed 0:791a779d6220 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
shoaib_ahmed 0:791a779d6220 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
shoaib_ahmed 0:791a779d6220 20 * SOFTWARE.
shoaib_ahmed 0:791a779d6220 21 */
shoaib_ahmed 0:791a779d6220 22 #ifndef RTOS_TIMER_H
shoaib_ahmed 0:791a779d6220 23 #define RTOS_TIMER_H
shoaib_ahmed 0:791a779d6220 24
shoaib_ahmed 0:791a779d6220 25 #include <stdint.h>
shoaib_ahmed 0:791a779d6220 26 #include "cmsis_os.h"
shoaib_ahmed 0:791a779d6220 27
shoaib_ahmed 0:791a779d6220 28 namespace rtos {
shoaib_ahmed 0:791a779d6220 29
shoaib_ahmed 0:791a779d6220 30 /** The RtosTimer class allow creating and and controlling of timer functions in the system.
shoaib_ahmed 0:791a779d6220 31 A timer function is called when a time period expires whereby both on-shot and
shoaib_ahmed 0:791a779d6220 32 periodic timers are possible. A timer can be started, restarted, or stopped.
shoaib_ahmed 0:791a779d6220 33
shoaib_ahmed 0:791a779d6220 34 Timers are handled in the thread osTimerThread.
shoaib_ahmed 0:791a779d6220 35 Callback functions run under control of this thread and may use CMSIS-RTOS API calls.
shoaib_ahmed 0:791a779d6220 36 */
shoaib_ahmed 0:791a779d6220 37 class RtosTimer {
shoaib_ahmed 0:791a779d6220 38 public:
shoaib_ahmed 0:791a779d6220 39 /** Create and Start timer.
shoaib_ahmed 0:791a779d6220 40 @param task name of the timer call back function.
shoaib_ahmed 0:791a779d6220 41 @param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic)
shoaib_ahmed 0:791a779d6220 42 @param argument argument to the timer call back function. (default: NULL)
shoaib_ahmed 0:791a779d6220 43 */
shoaib_ahmed 0:791a779d6220 44 RtosTimer(void (*task)(void const *argument),
shoaib_ahmed 0:791a779d6220 45 os_timer_type type=osTimerPeriodic,
shoaib_ahmed 0:791a779d6220 46 void *argument=NULL);
shoaib_ahmed 0:791a779d6220 47
shoaib_ahmed 0:791a779d6220 48 /** Stop the timer.
shoaib_ahmed 0:791a779d6220 49 @return status code that indicates the execution status of the function.
shoaib_ahmed 0:791a779d6220 50 */
shoaib_ahmed 0:791a779d6220 51 osStatus stop(void);
shoaib_ahmed 0:791a779d6220 52
shoaib_ahmed 0:791a779d6220 53 /** start a timer.
shoaib_ahmed 0:791a779d6220 54 @param millisec time delay value of the timer.
shoaib_ahmed 0:791a779d6220 55 @return status code that indicates the execution status of the function.
shoaib_ahmed 0:791a779d6220 56 */
shoaib_ahmed 0:791a779d6220 57 osStatus start(uint32_t millisec);
shoaib_ahmed 0:791a779d6220 58
shoaib_ahmed 0:791a779d6220 59 ~RtosTimer();
shoaib_ahmed 0:791a779d6220 60
shoaib_ahmed 0:791a779d6220 61 private:
shoaib_ahmed 0:791a779d6220 62 osTimerId _timer_id;
shoaib_ahmed 0:791a779d6220 63 osTimerDef_t _timer;
shoaib_ahmed 0:791a779d6220 64 #if defined(CMSIS_OS_RTX) && !defined(__MBED_CMSIS_RTOS_CM)
shoaib_ahmed 0:791a779d6220 65 uint32_t _timer_data[5];
shoaib_ahmed 0:791a779d6220 66 #else
shoaib_ahmed 0:791a779d6220 67 uint32_t _timer_data[6];
shoaib_ahmed 0:791a779d6220 68 #endif
shoaib_ahmed 0:791a779d6220 69 };
shoaib_ahmed 0:791a779d6220 70
shoaib_ahmed 0:791a779d6220 71 }
shoaib_ahmed 0:791a779d6220 72
shoaib_ahmed 0:791a779d6220 73 #endif