-
Notifications
You must be signed in to change notification settings - Fork 0
/
Timer.h
80 lines (73 loc) · 2.22 KB
/
Timer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* File: timer.h
* Author: mo
*
* Created on 12 ?????, 2020, 09:46 ?
*/
#ifndef TIMER_H
#define TIMER_H
/*INCLUDES**/
#include "Timer_Config.h"
#define ZERO 0x00
#define SIXTEEN_BIT_FULL 0xFFFF
#define EIGHT_BIT_FULL 0xFF
/************************************************************************/
/* TIMER FUNCTIONS' PROTOTYPES */
/************************************************************************/
/**
* Input: Pointer to a structure contains the information needed to initialize the timer.
* Output:
* In/Out:
* Return: The error status of the function.
* Description: Initiates the module.
*
*/
ERROR_STATUS Timer_Init(Timer_cfg_s* Timer_cfg);
void global_int_enable(void);
/**
* Input:
* Timer_CH_NO: The channel number of the timer needed to be started.
* Timer_Count: The start value of the timer.
* Output:
* In/Out:
* Return: The error status of the function.
* Description: This function strats the needed timer.
*
*/
ERROR_STATUS Timer_Start(uint8_t Timer_CH_NO, uint16_t Timer_Count);
extern void timer0_interrupt_ovfRoutine(void);
extern void timer1_interrupt_ovfRoutine(void);
extern void timer2_interrupt_ovfRoutine(void);
/**
* Input:
* Timer_CH_NO: The channel number of the timer needed to be stopped.
* Output:
* In/Out:
* Return: The error status of the function.
* Description: This function stops the needed timer.
*
*/
ERROR_STATUS Timer_Stop(uint8_t Timer_CH_NO);
/**
* Input:
* Timer_CH_NO: The channel number of the timer needed to get its status.
* Output:
* Data: A variable of type bool returns if the flag of the timer is raised or not.
* In/Out:
* Return: The error status of the function.
* Description: This function is used to return if the flag of the timer is raised or not.
*
*/
ERROR_STATUS Timer_GetStatus(uint8_t Timer_CH_NO, uint8_t* Data);
/**
* Input:
* Timer_CH_NO: The channel number of the timer needed to get its value.
* Output:
* Data: This is the output variable of the function which holds the value of the timer.
* In/Out:
* Return: The error status of the function.
* Description: This function is used to return the value of the timer.
*
*/
ERROR_STATUS Timer_GetValue(uint8_t Timer_CH_NO, uint16_t* Data);
#endif /* TIMER_H */