亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hal.h

?? CC2430下基于ZigBee的點對點通信實例
?? H
?? 第 1 頁 / 共 5 頁
字號:
The timers/counters can be configured in a number of ways. The following
functions allow basic configuration of the timers as interrupt timers,
pulse width modulators (PWM) and capture timers. Other uses require manual
configuration of the timers/counters.

Generally 3 steps are nescessary to start a timer:

   TIMERx_INIT();
   BOOL halSetTimerxPeriod(period);
   TIMERx_RUN(TRUE);

where x is the timer number. Please see the function / macro in question for
details.

All timers can generate interrupts. The configuration of interrupts is not
included in the HAL.

******************************************************************************/


/******************************************************************************
* @fn  halSetTimer1Period
*
* @brief
*      This function sets up timer 1 to run with a given period. If _period_ is
*      set to 0, maximum period length will be used. The first time the timer
*      is used the macro TIMER1_INIT() should be run to clear all settings. The
*      timer is started and stopped with the macro TIMER1_RUN(TRUE / FALSE).
*
* Parameters:
*
* @param  DWORD	 period
*         The desired timer period in u-seconds.
*
* @return WORD
*         The timer value written to the register if the configuration was
*         successful and 0 if the period could not be achieved. This return
*         value can be used for determining pulse widths when the timer is
*         used in PWM mode.
*
******************************************************************************/
WORD halSetTimer1Period(DWORD period);


// Macro for initialising timer 1. Resets all involved registers and disables
// all interrupt masks.
#define TIMER1_INIT()   \
   do {                 \
      T1CTL  = 0x00;    \
      T1CCTL0 = 0x00;   \
      T1CCTL1 = 0x00;   \
      T1CCTL2 = 0x00;   \
      TIMIF &= ~0x40;   \
   } while (0)

// Macro for configuring a channel of timer 1 for PWM. Channel may be
// either 1 or 2.
#define TIMER1_PWM_CONFIG(channel)               \
   do {                                          \
      T1CCTL##channel## = 0x24;                  \
      if(PERCFG&0x40) {                          \
         if(channel == 0x01){                    \
            IO_FUNC_PORT_PIN(1,1,IO_FUNC_PERIPH);\
         }                                       \
         else {                                  \
            IO_FUNC_PORT_PIN(1,0,IO_FUNC_PERIPH);\
         }                                       \
      }                                          \
      else {                                     \
         if(channel == 0x01){                    \
            IO_FUNC_PORT_PIN(0,3,IO_FUNC_PERIPH);\
         }                                       \
         else {                                  \
            IO_FUNC_PORT_PIN(0,4,IO_FUNC_PERIPH);\
         }                                       \
      }                                          \
   } while(0)

// Macro for changing the pulse length of a timer in PWM mode. The value is
// not scaled and the user must verify that it is correct. _channel_ is the
// channel (1 or 2) configured for PWM operation, whereas _value_ is the
// 16 bit word giving the pulse length. This argument should be shorter than
// or equal to the value returned from the function halSetTimer1Period(...).
#define TIMER1_SET_PWM_PULSE_LENGTH(channel, value) \
   do {                                             \
      T1CC##channel##L = (BYTE)value;               \
      T1CC##channel##H = (BYTE)(value >> 8);        \
   } while(0)


// Macro for configuring a channel of timer 1 for capture.
#define TIMER1_CAPTURE_CHANNEL(channel, edge)      \
   do {                                            \
      T1CCTL ##channel = edge;                     \
      if(PERCFG&0x40) {                            \
         if(channel == 0x01){                      \
            IO_FUNC_PORT_PIN(1,1,IO_FUNC_PERIPH);  \
         }                                         \
         else {                                    \
            IO_FUNC_PORT_PIN(1,0,IO_FUNC_PERIPH);  \
         }                                         \
      }                                            \
      else {                                       \
         if(channel == 0x01){                      \
            IO_FUNC_PORT_PIN(0,3,IO_FUNC_PERIPH);  \
         }                                         \
         else {                                    \
            IO_FUNC_PORT_PIN(0,4,IO_FUNC_PERIPH);  \
         }                                         \
      }                                            \
   } while(0)

// Where _edge_ is either
#define POS_EDGE 0x01  // Capture when a positive edge on the channel input is detected
#define NEG_EDGE 0x02  // Capture when a negative edge on the channel input is detected
#define ANY_EDGE 0x03  // Capture when either a positive or a negative edge on the
                       // channel input is detected.

// Macro for enabling or disabling overflow interrupts of timer 1.
#define TIMER1_ENABLE_OVERFLOW_INT(val) \
   (TIMIF =  (val) ? TIMIF | 0x40 : TIMIF & ~0x40)


/******************************************************************************
* @fn  halSetTimer2Period
*
* @brief
*      This function sets the period and overflow counter value of the MAC timer
*      (timer 2). The timer can be set up with 320 u-second periods according to
*      IEEE 802.15.4 or as a normal counter with 1 m-second period by using the
*      option TIMER2_MAC_TIMER or TIMER2_NORMAL_TIMER respectively. The value of
*      _period_ gives the number of periods (320 u-seconds or 1 m-seconds) to
*      generate a compare event. The timer is set up to compensate for any clock
*      division. The timer is also set up to be synchronised with the 32.768 KHz
*      clock when entering or leaving power mode 0. When starting synchronously
*      from power mode 1 or 2, the timer value is updated by adding the time
*      passed since PM 0 was left. This time is kept by the 32.768 KHz clock.
*      This way the time is kept as if the chip had been in power mode 0 the
*      whole time. The timer must be started with the macro
*      TIMER2_RUN(TRUE) or MAC_TIMER_RUN(TRUE). The macro TIMER2_INIT() should be
*      run in advance to reset all register values.
*
* Parameters:
*
* @param  BYTE	 mode
*         Determines which time period Timer 2 is to use. The period of Timer 2
*         is either 320 u-seconds (TIMER2_MAC_TIMER) or 1 m-second
*         (TIMER2_NORMAL_TIMER).
* @param  DWORD	 period
*         This value indicates how many periods (320 u-second or 1 m-second) to
*         pass before an overflow compare event is generated.
*
* @return BOOL
          Returns 0 if period is too large, 1 otherwise.
*
******************************************************************************/
BOOL halSetTimer2Period(BYTE mode, DWORD period);

// _options_ may be of the following:
#define TIMER2_MAC_TIMER    0x01  // Counts 320 u-second periods
#define TIMER2_NORMAL_TIMER 0x02  // Uses the timer as a normal timer with 1 m-second period.

// Macro for initialising timer 2
#define TIMER2_INIT()  \
   do {                \
      T2THD = 0x00;    \
      T2TLD = 0x00;    \
      T2CMP = 0x00;    \
      T2OF0 = 0x00;    \
      T2OF1 = 0x00;    \
      T2OF2 = 0x00;    \
      T2CAPHPH = 0x00; \
      T2CAPLPL = 0x00; \
      T2PEROF0 = 0x00; \
      T2PEROF1 = 0x00; \
      T2PEROF2 = 0x00; \
      T2CNF = 0x06;    \
   } while (0)

#define TIMER2_ENABLE_OVERFLOW_COMP_INT(val) (T2PEROF2 =  (val) ? T2PEROF2 | 0x20 : T2PEROF2 & ~0x20)


/******************************************************************************
* @fn  halSetTimer34Period
*
* @brief
*      This function sets the period of timer 3 or 4 according to the value of
*      _timer_. The two timers are identical. Clock division is used to fit the
*      desired period within the timer range. If the period is too short or too
*      long the function returns 0. If the period is successfully set, the
*      function returns the BYTE value written to the timer register. This
*      value can be used to set the pulse length if the timer is used for PWM.
*      If _period_ is set to 0, maximum timeout value will be used.
*
* Parameters:
*
* @param  BYTE	 timer
*         Indicates which timer to configure. Must be either 3 or 4
*         (0x03 or 0x04).
* @param  DWORD	 period - Describe value.
*         The desired period in microseconds.
*
* @return BYTE
*         The value written to the TxCC0 register. The timer is incremented up
*         to this value before the timer is reset. This value may be used to
*         set the pulse length in PWM mode.
*
******************************************************************************/
BYTE halSetTimer34Period(BYTE timer, DWORD period);
// Where _timer_ must be either 3 or 4

// Macro for initialising timer 3 or 4
#define TIMER34_INIT(timer)   \
   do {                       \
      T##timer##CTL   = 0x06; \
      T##timer##CCTL0 = 0x00; \
      T##timer##CC0   = 0x00; \
      T##timer##CCTL1 = 0x00; \
      T##timer##CC1   = 0x00; \
   } while (0)

//Macro for enabling overflow interrupt
#define TIMER34_ENABLE_OVERFLOW_INT(timer,val) \
   (T##timer##CTL =  (val) ? T##timer##CTL | 0x08 : T##timer##CTL & ~0x08)



// Macro for configuring channel 1 of timer 3 or 4 for PWM mode.
#define TIMER34_PWM_CONFIG(timer)                 \
   do{                                            \
      T##timer##CCTL1 = 0x24;                     \
      if(timer == 3){                             \
         if(PERCFG & 0x20) {                      \
            IO_FUNC_PORT_PIN(1,7,IO_FUNC_PERIPH); \
         }                                        \
         else {                                   \
            IO_FUNC_PORT_PIN(1,4,IO_FUNC_PERIPH); \
         }                                        \
      }                                           \
      else {                                      \
         if(PERCFG & 0x10) {                      \
             IO_FUNC_PORT_PIN(2,3,IO_FUNC_PERIPH);\
         }                                        \
         else {                                   \
            IO_FUNC_PORT_PIN(1,1,IO_FUNC_PERIPH); \
         }                                        \
      }                                           \
   } while(0)

// Macro for setting pulse length of the timer in PWM mode
#define TIMER34_SET_PWM_PULSE_LENGTH(timer, value) \
   do {                                            \
      T##timer##CC1 = (BYTE)value;                 \
   } while (0)


// Macro for setting timer 3 or 4 as a capture timer
#define TIMER34_CAPTURE_TIMER(timer,edge)          \
   do{                                             \
      T##timer##CCTL1 = edge;                      \
      if(timer == 3){                              \
         if(PERCFG & 0x20) {                       \
            IO_FUNC_PORT_PIN(1,7,IO_FUNC_PERIPH);  \
         }                                         \
         else {                                    \
             IO_FUNC_PORT_PIN(1,4,IO_FUNC_PERIPH); \
         }                                         \
      }                                            \
      else {                                       \
         if(PERCFG & 0x10) {                       \
            IO_FUNC_PORT_PIN(2,3,IO_FUNC_PERIPH);  \
         }                                         \
        else {                                     \
           IO_FUNC_PORT_PIN(1,1,IO_FUNC_PERIPH);   \
        }                                          \
     }                                             \
  }while(0)


// Macros for turning timers on or off
#define TIMER1_RUN(value)      (T1CTL = (value) ? T1CTL|0x02 : T1CTL&~0x03)
#define TIMER2_RUN(value)      (T2CNF  = (value) ? T2CNF|0x01  : T2CNF&~0x01)
#define MAC_TIMER_RUN(value)   do{ TIMER2_RUN(value); }while(0)  //MAC-timer == timer 2
#define TIMER3_RUN(value)      (T3CTL = (value) ? T3CTL|0x10 : T3CTL&~0x10)
#define TIMER4_RUN(value)      (T4CTL = (value) ? T4CTL|0x10 : T4CTL&~0x10)

// Macro for enabling/ disabling interrupts from the channels of timer 1, 3 or 4.
#define TIMER_CHANNEL_INTERRUPT_ENABLE(timer, channel, value) \
   do{                                                        \
      if(value){                                              \
         T##timer##CCTL##channel## |= 0x40;                   \
      } else {                                                \
         T##timer##CCTL##channel## &= ~0x40;                  \
      }                                                       \
   } while(0)



/******************************************************************************
*******************          Watch Dog Timer (WDT)          *******************
*******************************************************************************

The WDT may be used to prevent the unit from being trapped in a system
stalemate, i.e. an endless waiting state. The WDT must be reset before it times
out. If a timeout occurs, the system is reset.

The WDT can also be configured as a normal timer which generates interrupt at
each timeout. This must be configured manually.
******************************************************************************/

// Macro for setting the WDT timeout interval.
#define WDT_SET_TIMEOUT_PERIOD(timeout) \
   do {  WDCTL &= ~0x03; WDCTL |= timeout; } while (0)

// Where _timeout_ is one of
#define SEC_1          0x00     // after 1 second
#define M_SEC_250      0x01     // after 250 ms
#define M_SEC_15       0x02     // after 15 ms
#define M_SEC_2        0x03     // after 2 ms

// Macro for resetting the WDT. If this is not done before the WDT times out,
// the system is reset.
#define WDT_RESET() do {           \
   WDCTL = (WDCTL & ~0xF0) | 0xA0; \
   WDCTL = (WDCTL & ~0xF0) | 0x50; \

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一二三四区| 91精品在线观看入口| 精品剧情在线观看| 国产欧美综合色| 九九**精品视频免费播放| 欧美性猛交xxxx黑人交| 亚洲一区二区在线播放相泽| 99久久综合精品| 国产精品美女久久久久久久久| 久久精品视频网| 亚洲第一成年网| 成人免费毛片片v| 中文在线一区二区| 成人avav在线| ...中文天堂在线一区| www.性欧美| 亚洲欧美日韩一区二区| 91成人网在线| 亚洲国产成人va在线观看天堂| 国产乱理伦片在线观看夜一区| 日韩一区二区视频在线观看| 日本不卡高清视频| 欧美v日韩v国产v| 国产一区二区久久| 国产嫩草影院久久久久| 成人午夜又粗又硬又大| 久久久久久黄色| 99久久精品国产精品久久| 亚洲三级免费电影| 欧美精品一卡二卡| 韩国精品主播一区二区在线观看| 日韩欧美视频一区| 国产suv一区二区三区88区| 国产欧美一区二区精品忘忧草| 日本va欧美va精品| 国产午夜精品久久久久久免费视 | 亚洲国产精品自拍| 欧美精品日韩精品| 国产成人丝袜美腿| 一区二区在线观看av| 97aⅴ精品视频一二三区| 亚洲超丰满肉感bbw| 欧美成人在线直播| 91丨九色丨黑人外教| 丝瓜av网站精品一区二区 | 国内精品久久久久影院色| 中国色在线观看另类| 91福利视频久久久久| 精品综合免费视频观看| 国产精品午夜电影| 91女厕偷拍女厕偷拍高清| 天天综合天天做天天综合| 欧美精品一区二区三区蜜桃视频| 成人小视频免费在线观看| 亚洲综合偷拍欧美一区色| 日韩久久久精品| 成人免费毛片片v| 日本三级亚洲精品| 中文字幕人成不卡一区| 91精品国产一区二区三区香蕉| 黄色日韩网站视频| 亚洲一区免费观看| 久久久久国产精品麻豆| 色欧美片视频在线观看在线视频| 日韩成人免费电影| 亚洲乱码日产精品bd| 久久午夜电影网| 欧美久久久影院| 色综合久久中文字幕综合网 | 国产资源在线一区| 一区二区三区四区蜜桃| 国产欧美日韩激情| 欧美一区二区不卡视频| 色久综合一二码| 大胆亚洲人体视频| 久久精品国产亚洲aⅴ| 亚洲一区影音先锋| 亚洲免费视频成人| 国产清纯美女被跳蛋高潮一区二区久久w| 91丝袜美腿高跟国产极品老师| 国产综合色精品一区二区三区| 亚洲少妇屁股交4| 国产偷v国产偷v亚洲高清| 91精品婷婷国产综合久久| 色噜噜久久综合| av中文字幕不卡| 国产成人在线看| 国产一区福利在线| 日日夜夜免费精品| 亚洲成人一二三| 一区二区三区丝袜| 1000精品久久久久久久久| 国产精品伦理在线| 国产日韩v精品一区二区| 精品国产91洋老外米糕| 91麻豆精品国产91久久久使用方法| 91麻豆123| av日韩在线网站| 成人免费观看av| eeuss鲁片一区二区三区在线观看| 韩国女主播一区| 狠狠网亚洲精品| 国产乱国产乱300精品| 国产在线不卡一区| 国产高清成人在线| 不卡视频一二三四| 99精品视频一区| 91麻豆国产精品久久| 在线视频一区二区三区| 欧美最猛性xxxxx直播| 国产91高潮流白浆在线麻豆| 成人午夜激情在线| 91免费看视频| 欧美色手机在线观看| 欧美高清精品3d| 日韩视频免费直播| 538在线一区二区精品国产| 欧美一区二视频| 久久综合九色综合欧美98| 日本一区二区在线不卡| 17c精品麻豆一区二区免费| 一色屋精品亚洲香蕉网站| 亚洲免费伊人电影| 日本sm残虐另类| 风流少妇一区二区| 91国偷自产一区二区三区成为亚洲经典 | 丝袜亚洲另类欧美| 国产sm精品调教视频网站| 欧美午夜理伦三级在线观看| 日韩你懂的在线观看| 亚洲欧美日本在线| 国产精品一区二区黑丝| 欧美撒尿777hd撒尿| 国产精品色婷婷久久58| 日本三级韩国三级欧美三级| 91亚洲国产成人精品一区二区三| 欧美日韩另类国产亚洲欧美一级| 日韩女优制服丝袜电影| 一区二区三区加勒比av| 成人综合激情网| 日韩视频在线观看一区二区| 亚洲狠狠爱一区二区三区| 成人深夜视频在线观看| 欧美不卡一区二区三区四区| 亚洲午夜激情av| 99re热这里只有精品免费视频 | 日本伊人精品一区二区三区观看方式| 久久精品理论片| 欧美日韩黄色影视| 亚洲另类一区二区| 丰满放荡岳乱妇91ww| 久久嫩草精品久久久精品| 男女男精品网站| 欧美精三区欧美精三区| 亚洲综合清纯丝袜自拍| 91在线视频免费观看| 一色屋精品亚洲香蕉网站| 国产91在线观看| 国产日韩欧美精品综合| 国产一区二区三区综合| 精品久久国产字幕高潮| 日产国产欧美视频一区精品| 欧美精品自拍偷拍| 五月婷婷激情综合| 欧美剧在线免费观看网站 | 亚洲精品欧美二区三区中文字幕| 国产精品一区二区久久不卡| 久久亚洲精品国产精品紫薇| 久久丁香综合五月国产三级网站| 欧美丰满一区二区免费视频| 亚洲一区在线观看视频| 欧美日韩中文精品| 舔着乳尖日韩一区| 日韩亚洲欧美在线| 久久激五月天综合精品| 久久久三级国产网站| 国产成人在线视频网站| 中文字幕 久热精品 视频在线| 国产99久久久国产精品潘金| 国产亚洲综合性久久久影院| 成人性生交大片免费看中文| 最近日韩中文字幕| 欧美色视频在线观看| 日韩va欧美va亚洲va久久| 精品国产乱码久久| 成人app网站| 亚洲自拍偷拍网站| 日韩欧美国产不卡| 国产99精品国产| 亚洲精品成人天堂一二三| 欧美日韩在线综合| 精品一区二区三区在线观看国产| 欧美电影免费观看高清完整版在线 | 99久久99久久精品免费观看| 国产精品久久久久久久浪潮网站| 粗大黑人巨茎大战欧美成人| 一区二区三区在线不卡| 日韩一级片网站| 成人妖精视频yjsp地址| 亚洲精品精品亚洲|