aboutsummaryrefslogtreecommitdiff
path: root/Source/Timer.c
diff options
context:
space:
mode:
authorXaviDCR92 <xavi.dcr@gmail.com>2017-09-16 01:44:42 +0200
committerXaviDCR92 <xavi.dcr@gmail.com>2017-09-16 01:44:42 +0200
commit0d7af34486f15d8f31f8474f17cad698923cadcb (patch)
treea8489b916733589bbf90f25f3d654ade9353e4a1 /Source/Timer.c
parentf2a6798f1da7231facec93305f8c157f1a56f072 (diff)
downloadairport-0d7af34486f15d8f31f8474f17cad698923cadcb.tar.gz
* Trimmed ending whitespaces.
* Makefile now generates output TIM files automatically, using 'cat whatever.flags' files as flags for bmp2tim.
Diffstat (limited to 'Source/Timer.c')
-rw-r--r--Source/Timer.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/Source/Timer.c b/Source/Timer.c
index d49e698..85ae267 100644
--- a/Source/Timer.c
+++ b/Source/Timer.c
@@ -23,9 +23,9 @@ static TYPE_TIMER timer_array[MAX_TIMERS];
* *************************************/
/* ********************************************************************************************
- *
+ *
* @name TYPE_TIMER* TimerCreate(uint32_t t, bool rf, void (*timer_callback)(void) )
- *
+ *
* @author: Xavier Del Campo
*
* @brief: fills a TYPE_TIMER structure with input parameters
@@ -35,23 +35,23 @@ static TYPE_TIMER timer_array[MAX_TIMERS];
* bool rf:
* Repeat flag
* void (*timer_callback)(void)
- * Function to be called on timeout
- *
+ * Function to be called on timeout
+ *
* @return: pointer to TYPE_TIMER structure if filled correctly, NULL pointer otherwise.
- *
+ *
* ********************************************************************************************/
TYPE_TIMER* TimerCreate(uint32_t t, bool rf, void (*timer_callback)(void) )
{
bool success = false;
uint8_t i;
-
+
if (t == 0)
{
Serial_printf("Cannot create timer with time == 0!\n");
return NULL;
}
-
+
for (i = 0; i < MAX_TIMERS; i++)
{
if (timer_array[i].busy == false)
@@ -65,30 +65,30 @@ TYPE_TIMER* TimerCreate(uint32_t t, bool rf, void (*timer_callback)(void) )
break;
}
}
-
+
if (success == false)
{
Serial_printf("Could not find any free timer!\n");
return NULL;
}
-
+
return &timer_array[i];
}
/* *******************************************
- *
+ *
* @name void TimerReset(void)
- *
+ *
* @author: Xavier Del Campo
*
* @brief: reportedly, removes all timers.
- *
+ *
* *******************************************/
void TimerReset(void)
{
uint8_t i;
-
+
for (i = 0; i < MAX_TIMERS; i++)
{
TimerRemove(&timer_array[i]);
@@ -96,21 +96,21 @@ void TimerReset(void)
}
/* *****************************************************
- *
+ *
* @name void TimerHandler(void)
- *
+ *
* @author: Xavier Del Campo
*
* @brief: reportedly, handles all available timers.
*
* @remarks: calls callback on timeout.
- *
+ *
* *****************************************************/
void TimerHandler(void)
{
uint8_t i;
-
+
for (i = 0; i < MAX_TIMERS; i++)
{
if (timer_array[i].busy == true)
@@ -118,11 +118,11 @@ void TimerHandler(void)
if (System100msTick() == true)
{
timer_array[i].time--;
-
+
if (timer_array[i].time == 0)
{
timer_array[i].Timeout_Callback();
-
+
if (timer_array[i].repeat_flag == true)
{
timer_array[i].time = timer_array[i].orig_time;
@@ -134,15 +134,15 @@ void TimerHandler(void)
}
/* *********************************************************************
- *
+ *
* @name void TimerRestart(TYPE_TIMER* timer)
- *
+ *
* @author: Xavier Del Campo
*
* @brief: sets time left for TYPE_TIMER instance to initial value.
*
* @remarks: specially used when TYPE_TIMER.rf is enabled.
- *
+ *
* *********************************************************************/
void TimerRestart(TYPE_TIMER* timer)
@@ -151,16 +151,16 @@ void TimerRestart(TYPE_TIMER* timer)
}
/* *********************************************************************
- *
+ *
* @name void TimerRemove(TYPE_TIMER* timer)
- *
+ *
* @author: Xavier Del Campo
*
* @brief: Resets timer parameters to default values so timer instance
- * can be recycled.
+ * can be recycled.
*
* @remarks:
- *
+ *
* *********************************************************************/
void TimerRemove(TYPE_TIMER* timer)