timers.i

来自「cs8900 c51应用」· I 代码 · 共 265 行

I
265
字号
#line 1 "..\timers.c" /0     #error *** WARNING C318 IN LINE 74 OF ..\timers.c: can't open file 'inet/debug.h' #error *** WARNING C318 IN LINE 75 OF ..\timers.c: can't open file 'inet/datatypes.h' #error *** WARNING C318 IN LINE 76 OF ..\timers.c: can't open file 'inet/timers.h' #error *** WARNING C318 IN LINE 77 OF ..\timers.c: can't open file 'inet/system.h'   struct { UINT32 value; UINT8 free; } timer_pool[NUMTIMERS];   void timer_pool_init (void) { UINT8 i;  for( i=0; i < NUMTIMERS; i++) { timer_pool[i].value = 0; timer_pool[i].free = TRUE;  }   }    UINT8 get_timer (void) {  UINT8 i; UINT8 first_match;   for( i=0; i < NUMTIMERS; i++) { if( timer_pool[i].free == TRUE ) {    timer_pool[i].free = FALSE; first_match = i; return first_match;		  }  }    TMR_DEBUGOUT("No Timers, Resetting..\n\r"); RESET_SYSTEM();   }    void free_timer (UINT8 nbr) {   if( nbr > (NUMTIMERS-1) )  return;   timer_pool[nbr].free = TRUE;  }    void init_timer ( UINT8 nbr, UINT32 tout ) {   UINT32 val;  if( nbr > (NUMTIMERS-1) )  return;   if( timer_pool[nbr].free == TRUE )  return;    val = tout;  OS_EnterCritical();    timer_pool[nbr].value = val;  OS_ExitCritical();  }    UINT32 check_timer (UINT8 nbr) {  return timer_pool[nbr].value;  }    void decrement_timers (void) { UINT8 i;    for( i=0; i<NUMTIMERS; i++ ) { if( (timer_pool[i].free == FALSE) && (timer_pool[i].value != 0)) timer_pool[i].value --; } }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?