

void TIMERS_sort_out_timers(void){
	unsigned char i;

	for (i = 0; i < NUMBER_OF_TIMERS; i++){				//step through each of our timers
		if (timer_array[i].current_value != 0){			//see if we have already expired.
			timer_array[i].current_value --;			//if not then decrement the timer toward 0 
			if (timer_array[i].current_value == 0){		//now see if we have timed out
				if (timer_array[i].timer_type == timer_periodic){	//if we run on a periodic timer 
					timer_array[i].current_value = timer_array[i].reset_value;	//reload the timer 
				}
				timer_array[i].timeout_func(timer_array[i].func_args);			//if we have timed out then perform the function in our callback.
			}
		}
	}
}



