⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer4admset.c

📁 CC2430无线语音测试代码。两结点间通讯。IAR开发环境的工程文件。
💻 C
字号:
/******************************************************************************
*                                                                             *
*        **********                                                           *
*       ************                                                          *
*      ***        ***                                                         *
*     ***    ++    ***                                                        *
*     ***   +  +   ***                      CHIPCON                           *
*     ***   +                                                                 *
*     ***   +  +   ***                                                        *
*     ***    ++    ***                                                        *
*      ***        ***                                                         *
*       ************                                                          *
*        **********                                                           *
*                                                                             *
*******************************************************************************

Filename:     timer4AdmSet.c
Target:       cc2430
Author:       EFU
Revised:      16/12-2005
Revision:     1.0
******************************************************************************/

#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -