#ifndef _GLOBAL_TIME #define _GLOBAL_TIME typedef struct { unsigned long total_seconds; //Âñåãî ñåêóíä ñ ìîìåíòà âêëþ÷åíèß unsigned long microseconds; unsigned int miliseconds; //??? unsigned int pwm_tics; unsigned int seconds; unsigned int minuts; unsigned int hours; unsigned int freq_pwm_hz; unsigned int microseconds_add; void (*calc)(); //Ñ÷èòàåò â ïðåðûâàíèè ØÈÌ'à } GLOBAL_TIME; typedef GLOBAL_TIME *GLOBAL_TIME_handle; void global_time_calc(GLOBAL_TIME_handle); void init_global_time_struct(unsigned int freq_pwm); /*----------------------------------------------------------------------------- Default initalizer for the GLOBAL_TIME object. -----------------------------------------------------------------------------*/ #define GLOBAL_TIME_DEFAULTS { 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ global_time_calc \ } /*------------------------------------------------------------------------------ Prototypes for the functions in global_time.c ------------------------------------------------------------------------------*/ extern GLOBAL_TIME global_time; void init_timer_sec(unsigned int *start_time); //Èíèöèàëèçèðóåò ïåðåìåííóþ, âðåìß ñòàðòà â ñåêóíäàõ void init_timer_milisec(unsigned int *start_time); //Èíèöèàëèçèðóåò ïåðåìåííóþ, âðåìß ñòàðòà â ìèëèñåêóíäàõ int detect_pause_sec(unsigned int wait_pause, unsigned int *old_time); //ïàóçà â ñåêóíäàõ int detect_pause_milisec(unsigned int wait_pause, unsigned int *old_time); //Ïàóçà â ìèëèñåêóíäàõ (íå áîëåå 60000ìëñåê) #endif //_GLOBAL_TIME