Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
timer1.h
00001 /****************************************************************************** 00002 * @attention 00003 * 00004 * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2> 00005 * 00006 * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License"); 00007 * You may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at: 00009 * 00010 * http://www.st.com/myliberty 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 00015 * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY, 00016 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. 00017 * See the License for the specific language governing permissions and 00018 * limitations under the License. 00019 * 00020 ******************************************************************************/ 00021 /* 00022 * PROJECT: ST25R391x firmware 00023 * $Revision: $ 00024 * LANGUAGE: ANSI C 00025 */ 00026 00027 /*! \file timer.h 00028 * 00029 * \brief SW Timer implementation header file 00030 * 00031 * This module makes use of a System Tick in millisconds and provides 00032 * an abstraction for SW timers 00033 * 00034 */ 00035 00036 00037 /* 00038 ****************************************************************************** 00039 * INCLUDES 00040 ****************************************************************************** 00041 */ 00042 #include "platform1.h" 00043 00044 /* 00045 ****************************************************************************** 00046 * GLOBAL MACROS 00047 ****************************************************************************** 00048 */ 00049 #define timerIsRunning(t) (!timerIsExpired(t)) 00050 00051 /* 00052 ****************************************************************************** 00053 * GLOBAL DEFINES 00054 ****************************************************************************** 00055 */ 00056 00057 /*! 00058 ***************************************************************************** 00059 * \brief Calculate Timer 00060 * 00061 * This method calculates when the timer will be expired given the amount 00062 * time in milliseconds /a tOut. 00063 * Once the timer has been calculated it will then be used to check when 00064 * it expires. 00065 * 00066 * \see timersIsExpired 00067 * 00068 * \param[in] time : time/duration in Milliseconds for the timer 00069 * 00070 * \return u32 : The new timer calculated based on the given time 00071 ***************************************************************************** 00072 */ 00073 uint32_t timerCalculateTimer( uint16_t time ); 00074 00075 00076 /*! 00077 ***************************************************************************** 00078 * \brief Checks if a Timer is Expired 00079 * 00080 * This method checks if a timer has already expired. 00081 * Based on the given timer previously calculated it checks if this timer 00082 * has already elapsed 00083 * 00084 * \see timersCalculateTimer 00085 * 00086 * \param[in] timer : the timer to check 00087 * 00088 * \return true : timer has already expired 00089 * \return false : timer is still running 00090 ***************************************************************************** 00091 */ 00092 bool timerIsExpired( uint32_t timer ); 00093 00094 00095 /*! 00096 ***************************************************************************** 00097 * \brief Performs a Delay 00098 * 00099 * This method performs a delay for the given amount of time in Milliseconds 00100 * 00101 * \param[in] time : time/duration in Milliseconds of the delay 00102 * 00103 ***************************************************************************** 00104 */ 00105 void timerDelay( uint16_t time ); 00106 00107 00108 /*! 00109 ***************************************************************************** 00110 * \brief Stopwatch start 00111 * 00112 * This method initiates the stopwatch to later measure the time in ms 00113 * 00114 ***************************************************************************** 00115 */ 00116 void timerStopwatchStart( void ); 00117 00118 00119 /*! 00120 ***************************************************************************** 00121 * \brief Stopwatch Measure 00122 * 00123 * This method returns the elapsed time in ms since the stopwatch was initiated 00124 * 00125 * \return The time in ms since the stopwatch was started 00126 ***************************************************************************** 00127 */ 00128 uint32_t timerStopwatchMeasure( void );
Generated on Tue Jul 12 2022 18:07:56 by
1.7.2