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.
abcc_timer.h
00001 /******************************************************************************* 00002 ******************************************************************************** 00003 ** ** 00004 ** ABCC Driver version 4.01.01 (2015-12-14) ** 00005 ** ** 00006 ** Delivered with: ** 00007 ** ABP 7.16.01 (2015-10-14) ** 00008 ** */ 00009 /******************************************************************************* 00010 ******************************************************************************** 00011 ** COPYRIGHT NOTIFICATION (c) 2013 HMS Industrial Networks AB ** 00012 ** ** 00013 ** This program is the property of HMS Industrial Networks AB. ** 00014 ** It may not be reproduced, distributed, or used without permission ** 00015 ** of an authorized company official. ** 00016 ******************************************************************************** 00017 ******************************************************************************** 00018 ** Implements abcc timer service. 00019 ******************************************************************************** 00020 ******************************************************************************** 00021 ** Services: 00022 ** ABCC_TimerInit() - Init internal 00023 ** ABCC_TimerCreate() - Start Timer 00024 ** ABCC_TimerStart() - Start Timer 00025 ** ABCC_TimerStop() - Stop timer 00026 ** ABCC_TimerTick() - Tick 00027 ** ABCC_TimerDisable() - Disable tick action 00028 ** 00029 ******************************************************************************** 00030 ******************************************************************************** 00031 */ 00032 00033 #ifndef ABCC_TIMER_H_ 00034 #define ABCC_TIMER_H_ 00035 00036 #include "abcc_drv_cfg.h" 00037 #include "abcc_td.h" 00038 #include "abcc_sys_adapt.h" 00039 00040 /******************************************************************************* 00041 ** Constants 00042 ******************************************************************************** 00043 */ 00044 00045 #define ABCC_TIMER_NO_HANDLE ( 0xff ) 00046 00047 /******************************************************************************* 00048 ** Typedefs 00049 ******************************************************************************** 00050 */ 00051 00052 /* 00053 ** Timeout callback function type. 00054 */ 00055 typedef void (*ABCC_TimerTimeoutCallbackType)( void ); 00056 00057 00058 /* 00059 ** Type for identifying timer 00060 */ 00061 typedef UINT8 ABCC_TimerHandle; 00062 00063 00064 /******************************************************************************* 00065 ** Public Globals 00066 ******************************************************************************** 00067 */ 00068 00069 /******************************************************************************* 00070 ** Public Services 00071 ******************************************************************************** 00072 */ 00073 00074 00075 /*------------------------------------------------------------------------------ 00076 ** void ABCC_TimerInit( void ); 00077 ** Need to called before the timer is used 00078 **------------------------------------------------------------------------------ 00079 ** Arguments: 00080 ** None 00081 ** Returns: 00082 ** None 00083 **------------------------------------------------------------------------------ 00084 */ 00085 EXTFUNC void ABCC_TimerInit( void ); 00086 00087 00088 /*------------------------------------------------------------------------------ 00089 ** Allocates a timer resource and returns a handle. 00090 **------------------------------------------------------------------------------ 00091 ** Arguments: 00092 ** pnHandleTimeout: Function to call if timeout. 00093 ** Returns: 00094 ** ABCC_TimerHandle ( Used as identifier when using timer functions. ) 00095 ** TIMER_NO_HANDLE is returned if no timer was available 00096 **------------------------------------------------------------------------------ 00097 */ 00098 EXTFUNC ABCC_TimerHandle ABCC_TimerCreate( ABCC_TimerTimeoutCallbackType pnHandleTimeout ); 00099 00100 00101 /*------------------------------------------------------------------------------ 00102 ** Start timer. 00103 ** When the timeout is reached, the registered callback function is called. 00104 ** Note!! This function is dependent on that ABCC_TimerTick() is called 00105 ** on regular basis. 00106 **------------------------------------------------------------------------------ 00107 ** Arguments: 00108 ** xHandle: Identifier of timer to be started. 00109 ** lTimeoutMs: Timeout in ms. 00110 ** 00111 ** Returns: 00112 ** TRUE if the timer had expired before re-start. 00113 ** FALSE Timer had not expired before re-start. 00114 **------------------------------------------------------------------------------ 00115 */ 00116 EXTFUNC BOOL ABCC_TimerStart( ABCC_TimerHandle xHandle, 00117 UINT32 lTimeoutMs ); 00118 00119 00120 /*------------------------------------------------------------------------------ 00121 ** Stop timer. 00122 **------------------------------------------------------------------------------ 00123 ** Arguments: 00124 ** xHandle: Identifier of timer to be stopped. 00125 ** Returns: 00126 ** FALSE If timeout is already reached 00127 ** TRUE: Timer stopped OK 00128 **------------------------------------------------------------------------------ 00129 */ 00130 EXTFUNC BOOL ABCC_TimerStop( ABCC_TimerHandle xHandle ); 00131 00132 00133 00134 /*------------------------------------------------------------------------------ 00135 ** ABCC_TimerTick(). Provides delta time since last timer tick call. 00136 ** Typically called from timer interrupt. 00137 **------------------------------------------------------------------------------ 00138 ** Arguments: 00139 ** iDeltaTimeMs: Time in ms since last timerTick call 00140 ** Returns: 00141 ** None 00142 **------------------------------------------------------------------------------ 00143 */ 00144 EXTFUNC void ABCC_TimerTick(const INT16 iDeltaTimeMs); 00145 00146 00147 /*------------------------------------------------------------------------------ 00148 ** ABCC_TimerDisable(). Disable tick action 00149 **------------------------------------------------------------------------------ 00150 ** Arguments: 00151 ** None 00152 ** Returns: 00153 ** None 00154 **------------------------------------------------------------------------------ 00155 */ 00156 EXTFUNC void ABCC_TimerDisable( void ); 00157 00158 00159 #endif /* inclusion lock */
Generated on Tue Jul 12 2022 15:51:56 by
