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

📄 wait.c

📁 TI的CC1110、CC2510、CC2430射频SOC的驱动程序
💻 C
字号:
/*------------------------------------------------------------------------------
Filename:     wait.c
Target:       cc2430, cc2431, cc1110, cc2510, cc2511
Revised:      26/10-2005
Revision:     0.1
------------------------------------------------------------------------------*/

#include "hal.h"
#include "main.h"

/**************************************
函数名:Timer0_Init()
功能:初始化定时器0
入口参数:无
出口参数:无
***************************************/
void  Timer0_Init (void)
{
	  T1CTL=0x0E;		//  NO channel interrupt, MODEL 10:count from 0000 to T1CC0,16-bit Timer, clk= 26M/128
	  T1CC0H=0x00;
          T1CC0L=0x00;
	  	
}

/**************************************
函数名:Timer0_Fresh()
功能:启动定时器0
入口参数:定时器初值
出口参数:无
***************************************/
void  Timer0_Fresh (uint8 delay_H, uint8 delay_L)   // 1000us = 1/26/128  * 203(单位)
{
         CLRBIT(T1CTL,OVFIF);
	 T1CC0H=delay_H;
         T1CC0L=delay_L;
      //   while(!CHKBIT(T1CTL,OVFIF));

}	
//-----------------------------------------------------------------------------
// See hal.h for a description of this function.
//-----------------------------------------------------------------------------
void halWait(byte wait)
{
   uint32 largeWait;

   if(wait == 0)
   {return;}
#if (chip == 2430 || chip == 2431)
   largeWait = ((uint16) (wait << 7));
   largeWait += 114*wait;
#endif

#if ((chip == 1110) || (chip == 2510))
   largeWait = ((uint16) (wait << 7));
   largeWait += 59*wait;
#endif
#if ((chip == 1111) || (chip == 2511))
   largeWait = ((uint16) (wait << 7));
   largeWait += 45*wait;
#endif

   largeWait = (largeWait >> CLKSPD);
   while(largeWait--);

   return;
}
/*------------------------------------------------------------------------------
										  0ooo
								ooo0     (   )
								(   )     ) /
								 \ (     (_/
	    				          \_)       Modify By:cuiqingwei [gary]
------------------------------------------------------------------------------*/

⌨️ 快捷键说明

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