FreeHIL
Loading...
Searching...
No Matches
FH_GlobalTimerCount.c
Go to the documentation of this file.
1/**
2 * @file
3 * @brief
4 * <b>File Map:</b>\n
5 * <b>FH_Root</b>, Section <b>FH_General</b>, <b>FH_GlobalTimerCount</b> \n
6 * There are a diverse range of different situations where a precise timing is a necessity\n
7 * To have a general heart beat (1 mili-second) for all different parts of the code, a timer in the micro-controller on which <b>FH</b> source code is ported, shall be utilized\n
8 * <b>FH_GlobalTimeCounter</b> here shall be incremented every <b>1 mili-second</b> in an interested timer <b>ISR</b> (Interrupt Service Routine) by <b>FH</b> user\n
9 * For this to happen, <b>FH_GlobalTimerCount.h</b> shall be included in the interested timer <b>ISR</b> (Interrupt Service Routine) file
10 *
11 * @warning If <b>FH</b> user would not increment the <b>FH_GlobalTimeCounter</b> in a timer <b>ISR</b> (Interrupt Service Routine) every 1 mili-second, the related commands (which require timing) will have malfunction
12 *
13 * @attention <b>FH</b> user could left this file intact but shall include <b>FH_GlobalTimerCount.h</b> in the interested timer <b>ISR</b> (Interrupt Service Routine) file
14 *
15 *******************************************************************************
16 * SPDX-License-Identifier: Apache-2.0
17 *
18 * Copyright 2026 Vahid Hasirchi
19 *
20 * Licensed under the Apache License, Version 2.0 (the "License");
21 * you may not use this file except in compliance with the License.
22 * You may obtain a copy of the License at
23 *
24 * http://www.apache.org/licenses/LICENSE-2.0
25 *
26 * Unless required by applicable law or agreed to in writing, software
27 * distributed under the License is distributed on an "AS IS" BASIS,
28 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 * See the License for the specific language governing permissions and
30 * limitations under the License.
31 ********************************************************************************
32
33 *
34 * <b>For more information refer to FreeHIL.com</b>
35 *
36*/
37/* Includes ------------------------------------------------------------------*/
39
40/*!
41 There are a diverse range of different situations where a precise timing is a necessity\n
42 To have a general heart beat (1 mili-second) for all different parts of the code, a timer in the micro-controller on which <b>FH</b> source code is ported, shall be utilized\n
43 <b>FH_GlobalTimeCounter</b> here shall be incremented every <b>1 mili-second</b> in an interested timer <b>ISR</b> (Interrupt Service Routine) by <b>FH</b> user\n
44 For this to happen, <b>FH_GlobalTimerCount.h</b> shall be included in the interested timer <b>ISR</b> (Interrupt Service Routine) file
45
46 @warning If <b>FH</b> user would not increment the <b>FH_GlobalTimeCounter</b> in a timer <b>ISR</b> (Interrupt Service Routine) every 1 mili-second, the related commands (which require timing) will have malfunction
47*/
48volatile uint32_t FH_GlobalTimeCounter = 0;
49
50/**
51 * @brief This function resets the <b>FH_GlobalTimeCounter</b> if need be\n
52 * <b>FH_GlobalTimeCounter</b> here shall be incremented every <b>1 mili-second</b> in an interested timer <b>ISR</b> (Interrupt Service Routine) by <b>FH</b> user\n
53 * For this to happen, <b>FH_GlobalTimerCount.h</b> shall be included in the interested timer <b>ISR</b> (Interrupt Service Routine) file
54 *
55 * @param None
56 *
57 * @return None
58 *
59 * @note
60 * Since the mere heart beat of the <b>FH</b> code is <b>FH_GlobalTimeCounter</b> and it is getting incremented every 1 mili-second, it is normally required to reset it to start a new time calculation
61 *
62
63*/
65{
66 FH_GlobalTimeCounter = 0; // The mere heart beat of <b>FH</b> code is reset here
67}