/*#include "hal_types.h"
#include "halio.h"
#include "OSAL.h"
#include "OnBoard.h"
#include "hal_assert.h"
//#include <string.h>*/
#include <ioCC2530.h>
#include "halio.h"
#include "OSAL.h"
#include "Coordinator.h"
#include "hal_types.h"
#include "OnBoard.h"
uint16 count1,count2,count3;
uint16 f;
/*extern void Initio();
extern void initclock();
extern void InitT3();

extern void T3interrupt();*/
extern byte SampleApp_TaskID;
void Initio()
{
  P1SEL&=~(1<<2);
  P1DIR&=~(1<<2);
  P2INP&=~(1<<3);
  P1IEN|=(1<<2);
  PICTL&=~(1<<1);
  EA=1;
  IEN2|=(1<<4);
  P1IFG=0;
    /*P0IEN |= 0x2;    // P0.1 设置为中断方式 1：中断使能
    PICTL |= 0x01;    //下降沿触发   
    IEN1 |= 0x20;    //允许P0口中断; 
    P0IFG = 0x00;    //初始化中断标志位
    EA = 1;*/          //打开总中断
    //LED1=1;
    //P1DIR |= 0x01;   //P1.0定义为输出口
    //P0DIR&=~0X01;      //P0_1为输入方式
}
void initclock()
{
   //CLKCONCMD &= ~0x40;      //设置系统时钟源为32MHZ晶振
    //while(CLKCONSTA & 0x40); //等待晶振稳定为32M
      //CLKCONCMD &= ~0x47;      //设置系统主时钟频率为32MHZ   
    CLKCONCMD |= 0x08;       //时钟速度32 MHz 定时器标记输出设置[5:3]16mHz
}
void InitT3()
{     
    T3CTL |= 0x08 ;          //开溢出中断     
    T3IE = 1;                //开总中断和T3中断
    T3CTL |= 0xE0;           //128分频,128/16000000*N=0.5S,N=
    T3CTL &= ~0x03;          //自动重装 00－>0xff  62500/255=245(次)
    T3CTL |= 0x10;           //启动
    EA = 1;                  //开总中断
}

void IOINTI()
{
  initclock();
  Initio();
  InitT3();
  
}
void Iointerrupt()
{
   
    count2++;
    
}
void T3interrupt()
{
  //T3IF = 0; //清中断标志, 也可由硬件自动完成
    count1++;
    if(count1>244)
    {
      count3=count2-1;        
      f=count3*2;
      count1=0;
      count2=0;
      osal_set_event(SampleApp_TaskID,JISHUEVENT);
    }
    
  
  
}
HAL_ISR_FUNCTION( iop1, P1INT_VECTOR )
{
  Iointerrupt();
  P1IFG=0;
  P1IF=0;

  
}
HAL_ISR_FUNCTION( T3, T3_VECTOR  )
{
  T3interrupt();
  
  T3IF = 0; //清中断标志, 也可由硬件自动完成
}
