software_APIs  1.0.0
timer0.h
Go to the documentation of this file.
1 
4 #ifndef TIMER0_C_HEADER_FILE
5 #define TIMER0_C_HEADER_FILE
6 
7 // timer
14 void timer0_configureOneShot(unsigned int count){
15  timer0_enable(0); // disable
16  reg_timer0_data = count;
17  timer0_enable(1); // enable
18 }
26 void timer0_configurePeriodic(unsigned int count){
27  timer0_enable(0); // disable
28  reg_timer0_data = 0;
29  reg_timer0_data_periodic = count;
30  timer0_enable(1); // enable
31 }
38 void timer0_enable(bool is_enable){
39  if (is_enable)
40  reg_timer0_config = reg_timer0_config | 1;// enable
41  else
42  reg_timer0_config = reg_timer0_config & 0xFFFFFFFE; // disable counter
43 }
44 
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 void timer0_updateValue(){
47  #ifdef ARM // arm update the register automatically
48  return;
49  #else
50  reg_timer0_update = 1;
51  #endif
52 }
53 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
54 
58 unsigned int timer0_readValue(){
59  #ifdef ARM
60  return reg_timer0_data;
61  #else
62  timer0_updateValue();
63  return reg_timer0_value;
64  #endif
65 }
66 
67 #endif // TIMER0_C_HEADER_FILE
void timer0_configureOneShot(unsigned int count)
Definition: timer0.h:14
void timer0_enable(bool is_enable)
Definition: timer0.h:38
void timer0_configurePeriodic(unsigned int count)
Definition: timer0.h:26
unsigned int timer0_readValue()
Definition: timer0.h:58