timer4admset.c

来自「CC1110无线收发FHSS的源程序。使用的开发环境是IAR7.2H」· C语言 代码 · 共 63 行

C
63
字号
/******************************************************************************
*                                                                             *
*    ****       ******       ****
*     ****     ********     ****
*      ****   ****  ****   ****
*       **** ****    **** ****              wxl
*        *******      *******
*         *****        *****                    成都无线龙通讯科技有限公司
*                                                                             *
*******************************************************************************
Target:       cc1110                          使用芯片:       cc1110
Author:       WXL                             程 序 员:      无线龙
data:         1/12-2007                       日    期:      1/12-2007
******************************************************************************/
/**********************************头文件**************************************/

#include "cul.h"

extern volatile TIMER4_TABLE_ENTRY timer4Table[TIMER_ADM_TABLE_LENGTH];

//-----------------------------------------------------------------------------
// See cul.h for a description of this function.
//-----------------------------------------------------------------------------
BYTE culTimer4AdmSet(DWORD timeout, FUNCTION* callBackFunction){
   BYTE status = 0x00;
   BYTE i = 0x00;

   // Checking the arguments...
   if((timeout == 0) || (callBackFunction == NULL)){
      return 0xFF;
   }

   status = IEN0;
   INT_GLOBAL_ENABLE(INT_OFF);

   // Searching for an available entry in the table.
   for(i = 0; i < TIMER_ADM_TABLE_LENGTH; i++){
      if(timer4Table[i].timeout == 0){

         // Storing the interrupt enable register, and turning off interrupts

         // Setting up the table.
         timer4Table[i].timeout = timeout;
         timer4Table[i].counter = 0;
         timer4Table[i].callBackFunction = callBackFunction;
         break;
      }
   }

   // Restoring the interrupt enable status.
   IEN0 = status;

   if(i < TIMER_ADM_TABLE_LENGTH )
   {
      return i;
   }
   else
   {
      // No available entry in the table, returning error value
      return 0xFF;
   }
}   // ends culTimer4AdmSet(...)

⌨️ 快捷键说明

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