SRD Standelone programmation box: tick.h File Reference

| SRD Standelone programmation box 2.0 (16/11/15 10:00:00) Documentation of the SRD standelone programmation box

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Enumerations Enumerator Macros Pages
Data Structures | Macros | Functions | Variables
tick.h File Reference

Headerfile for tick. More...

`#include "pit.h"`
Include dependency graph for tick.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | tTickCtrl
| Structure used to control ticks. More...

## Macros

#define | TICK_USE_PIT_MODULE (PIT_MODULE0)
| Define the PIT module used by the Tick object. More...
#define | TICK_BASE_FREQ (1000)
| Define the tick base frequency (in Hz). More...
#define | TICK_1MIN_COUNT (TICK_1S_COUNT * 60)
| Define the counter count for the 1 min tick. More...
#define | TICK_10MS_FREQ (100)
| Define the Tick frequency generated by the Tick module. More...
#define | TICK_100MS_FREQ (10)
| Define the Tick frequency generated by the Tick module. More...
#define | TICK_1S_FREQ (1)
| Define the Tick frequency generated by the Tick module. More...
#define | TICK_10MS_COUNT (TICK_BASE_FREQ / TICK_10MS_FREQ)
| Define the counter count for each tick. More...
#define | TICK_100MS_COUNT (TICK_BASE_FREQ / TICK_100MS_FREQ)
| Define the counter count for each tick. More...
#define | TICK_1S_COUNT (TICK_BASE_FREQ / TICK_1S_FREQ)
| Define the counter count for each tick. More...
#define | TickEnable() PitEnable(TICK_USE_PIT_MODULE)
| Macro used to enable or disable the tick. More...
#define | TickDisable() PitDisable(TICK_USE_PIT_MODULE)
| Macro used to enable or disable the tick. More...

## Functions

void | TickInit (void)
| Function used to initialize the Tick module . More...
unsigned long | TickGetMsCounter (void)
| Get the milliseconds counter. More...
unsigned long | TickMilliSecElapsedFrom (unsigned long refTimeMs)
| Get the milliseconds counter. More...

## Variables

tTickCtrl | TickCtrl
| Tick control variable. More...

## Detailed Description

Headerfile for tick.

Author
  Thibaut LALUQUE 3D-Ouest

Date
  26/09/2014

Version
  1.0

All Right Reserved.

Definition in file tick.h.

## Macro Definition Documentation

#define TICK_100MS_COUNT (TICK_BASE_FREQ / TICK_100MS_FREQ)

Define the counter count for each tick.

Definition at line 63 of file tick.h.

Referenced by TickCallBack(), and TickInit().

#define TICK_100MS_FREQ (10)

Define the Tick frequency generated by the Tick module.

Definition at line 52 of file tick.h.

#define TICK_10MS_COUNT (TICK_BASE_FREQ / TICK_10MS_FREQ)

Define the counter count for each tick.

Definition at line 62 of file tick.h.

Referenced by TickCallBack(), and TickInit().

#define TICK_10MS_FREQ (100)

Define the Tick frequency generated by the Tick module.

Definition at line 51 of file tick.h.

#define TICK_1MIN_COUNT (TICK_1S_COUNT * 60)

Define the counter count for the 1 min tick.

Definition at line 73 of file tick.h.

Referenced by TickCallBack(), and TickInit().

#define TICK_1S_COUNT (TICK_BASE_FREQ / TICK_1S_FREQ)

Define the counter count for each tick.

Definition at line 64 of file tick.h.

Referenced by TickCallBack(), and TickInit().

#define TICK_1S_FREQ (1)

Define the Tick frequency generated by the Tick module.

Definition at line 53 of file tick.h.

#define TICK_BASE_FREQ (1000)

Define the tick base frequency (in Hz).

Definition at line 43 of file tick.h.

Referenced by TickInit().

#define TICK_USE_PIT_MODULE (PIT_MODULE0)

Define the PIT module used by the Tick object.

Definition at line 35 of file tick.h.

Referenced by TickInit().

#define TickDisable | ( |  | ) | PitDisable(TICK_USE_PIT_MODULE)

Macro used to enable or disable the tick.

Definition at line 146 of file tick.h.

#define TickEnable | ( |  | ) | PitEnable(TICK_USE_PIT_MODULE)

Macro used to enable or disable the tick.

Definition at line 145 of file tick.h.

Referenced by StartScheduling().

## Function Documentation

unsigned long TickGetMsCounter | ( | void |  | ) |

inline

Get the milliseconds counter.

Returns
  (unsigned long) : Return the current value of the milliseconds counter.

Definition at line 137 of file tick.c.

References msCounter.

Referenced by ButtonManager(), ButtonManagerDealer(), CR95HFWriteCommand(), RFIDBridgeStateMachine(), RFIDReadStateMachine(), RFIDWriteStateMachine(), TickMilliSecElapsedFrom(), and UsbManager().

137 {
138 return msCounter;
139 }
msCounter
unsigned long msCounter
Definition: tick.c:61

Here is the caller graph for this function:

void TickInit | ( | void |  | ) |

Function used to initialize the Tick module .

Definition at line 123 of file tick.c.

References tTickCtrl::all, tTickCtrl::counter100ms, tTickCtrl::counter10ms, tTickCtrl::counter1min, tTickCtrl::counter1s, tTickCtrl::flags, PitEnableInterrupt, PitInit(), TICK_100MS_COUNT, TICK_10MS_COUNT, TICK_1MIN_COUNT, TICK_1S_COUNT, TICK_BASE_FREQ, TICK_USE_PIT_MODULE, and TickCallBack().

Referenced by Setup().

123 {
124
125 /*-- Initialize structure --*/
126 TickCtrl.flags.all = 0;
127 TickCtrl.counter10ms = TICK_10MS_COUNT;
128 TickCtrl.counter100ms = TICK_100MS_COUNT;
129 TickCtrl.counter1s = TICK_1S_COUNT;
130 TickCtrl.counter1min = TICK_1MIN_COUNT;
131
132 /*-- initialize PIT module --*/
133 PitInit(TICK_USE_PIT_MODULE,TICK_BASE_FREQ,TickCallBack);
134 PitEnableInterrupt(TICK_USE_PIT_MODULE);
135 }
TICK_10MS_COUNT
#define TICK_10MS_COUNT
Define the counter count for each tick.
Definition: tick.h:62
TICK_1S_COUNT
#define TICK_1S_COUNT
Define the counter count for each tick.
Definition: tick.h:64
TICK_BASE_FREQ
#define TICK_BASE_FREQ
Define the tick base frequency (in Hz).
Definition: tick.h:43
TickCallBack
void TickCallBack(void)
Definition: tick.c:70
tTickCtrl::counter1s
unsigned long counter1s
Definition: tick.h:103
PitInit
void PitInit(tPitModuleId moduleId, unsigned long freq, void(*ISRCallBack)(void))
Initialize a PIT module.
Definition: pit.c:105
tTickCtrl::all
unsigned long all
Definition: tick.h:99
tTickCtrl::flags
union tTickCtrl::@19 flags
TICK_1MIN_COUNT
#define TICK_1MIN_COUNT
Define the counter count for the 1 min tick.
Definition: tick.h:73
TICK_USE_PIT_MODULE
#define TICK_USE_PIT_MODULE
Define the PIT module used by the Tick object.
Definition: tick.h:35
tTickCtrl::counter100ms
unsigned long counter100ms
Definition: tick.h:102
tTickCtrl::counter10ms
unsigned long counter10ms
Definition: tick.h:101
TICK_100MS_COUNT
#define TICK_100MS_COUNT
Define the counter count for each tick.
Definition: tick.h:63
TickCtrl
tTickCtrl TickCtrl
Tick control variable.
Definition: tick.c:60
tTickCtrl::counter1min
unsigned long counter1min
Definition: tick.h:104
PitEnableInterrupt
#define PitEnableInterrupt(moduleId)
Enable / Disable interrupt of the PIT module.
Definition: pit.h:103

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned long TickMilliSecElapsedFrom | ( | unsigned long | refTimeMs | ) |

Get the milliseconds counter.

Parameters

  [in] | refTimeMs | (unsigned long) : reference time in milliseconds.

Returns
  (unsigned long) : Return the milliseconds ellapsed since the refTimeMs.

Definition at line 141 of file tick.c.

References TickGetMsCounter().

Referenced by ButtonManager(), ButtonManagerDealer(), CR95HFManager(), RFIDBridgeStateMachine(), RFIDManager(), RFIDReadStateMachine(), RFIDWriteStateMachine(), and UsbManager().

141 {
142 unsigned long current = TickGetMsCounter();
143 if(refTimeMs <= current) {
144 return current - refTimeMs;
145 } else {
146 return (0xFFFFFFFF - refTimeMs) + current;
147 }
148 }
TickGetMsCounter
unsigned long TickGetMsCounter(void)
Get the milliseconds counter.
Definition: tick.c:137

Here is the call graph for this function:

Here is the caller graph for this function:

## Variable Documentation

tTickCtrl TickCtrl

Tick control variable.

Definition at line 60 of file tick.c.

Referenced by main().