Suppose we would like to do something periodically in our embedded system.
Without Timer Function:
1. Add a time variable
2. Compare time variable with system time in a main loop.
3. If timeout happens, then do something; if not, go to step 2.
...
lousy...又臭又長
With aTimerRepeatStart function:
Simply one line code to achieve it :
aTimerRepeatStart(Id, 3000, Do_Something_Function_Pointer);
The advantage by using Timer Library is that
1. Code is clear and simple
2. Code is not spread everywhere.
3. Easy to do platform porting
不過前提就是要有加這些Timer fucntion了...廢話...。
Keyword: Scaler, Monitor Firmware, Timer.