CC2640R2F 如何设置定时器为捕获模式,我发现GPTTimer 并没有这种模式功能?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
When configuring for full-width timer \c ui32Config is set
//! as one of the following values:
//! - \ref TIMER_CFG_ONE_SHOT : Full-width one-shot timer.
//! - \ref TIMER_CFG_ONE_SHOT_UP : Full-width one-shot timer that counts up
//! instead of down.
//! - \ref TIMER_CFG_PERIODIC : Full-width periodic timer.
//! - \ref TIMER_CFG_PERIODIC_UP : Full-width periodic timer that counts up
//! instead of down.
//!
//! When configuring for a pair of half-width timers, each timer is separately
//! configured. The timers are configured by setting \c ui32Config to
//! the bitwise OR of one of each of the following three:
//! - Use half-width timers:
//! - \ref TIMER_CFG_SPLIT_PAIR
//! - Timer A:
//! - \ref TIMER_CFG_A_ONE_SHOT : Half-width one-shot timer
//! - \ref TIMER_CFG_A_ONE_SHOT_UP : Half-width one-shot timer that counts up
//! instead of down.
//! - \ref TIMER_CFG_A_PERIODIC : Half-width periodic timer
//! - \ref TIMER_CFG_A_PERIODIC_UP : Half-width periodic timer that counts up
//! instead of down.
//! - \ref TIMER_CFG_A_CAP_COUNT : Half-width edge count capture
//! - \ref TIMER_CFG_A_CAP_COUNT_UP : Half-width edge count capture that counts
//! up instead of down.
//! - \ref TIMER_CFG_A_CAP_TIME : Half-width edge time capture
//! - \ref TIMER_CFG_A_CAP_TIME_UP : Half-width edge time capture that counts up
//! instead of down.
//! - \ref TIMER_CFG_A_PWM : Half-width PWM output
//! - Timer B:
//! - Same as Timer A but using TIMER_CFG_B_* instead.
//!
//! \param ui32Base is the base address of the timer module.
//! \param ui32Config is the configuration for the timer.
详细请看timer.h中的描述:6837.timer.h
是用定时器来捕获IO电平的变化
你好 我也是想用定时器来计数,但IO电平跳变要保持1s以上才能被检测到计数,比如我要检测按键按下次数,按键按下是低电平,我现在遇到的问题是每次低电平需要保持1s以上计数才能变化,如图初始化代码如下:Kevin Qiu1 说:When configuring for full-width timer \c ui32Config is set
//! as one of the following values:
//! - \ref TIMER_CFG_ONE_SHOT : Full-width one-shot timer.
//! - \ref TIMER_CFG_ONE_SHOT_UP : Full-width one-shot timer that counts up
//! instead of down.
//! - \ref TIMER_CFG_PERIODIC : Full-width periodic timer.
//! - \ref TIMER_CFG_PERIODIC_UP : Full-width periodic timer that counts up
//! instead of down.
//!
//! When configuring for a pair of half-width timers, each timer is separately
//! configured. The timers are configured by setting \c ui32Config to
//! the bitwise OR of one of each of the following three:
//! - Use half-width timers:
//! - \ref TIMER_CFG_SPLIT_PAIR
//! - Timer A:
//! - \ref TIMER_CFG_A_ONE_SHOT : Half-width one-shot timer
//! - \ref TIMER_CFG_A_ONE_SHOT_UP : Half-width one-shot timer that counts up
//! instead of down.
//! - \ref TIMER_CFG_A_PERIODIC : Half-width periodic timer
//! - \ref TIMER_CFG_A_PERIODIC_UP : Half-width periodic timer that counts up
//! instead of down.
//! - \ref TIMER_CFG_A_CAP_COUNT : Half-width edge count capture
//! - \ref TIMER_CFG_A_CAP_COUNT_UP : Half-width edge count capture that counts
//! up instead of down.
//! - \ref TIMER_CFG_A_CAP_TIME : Half-width edge time capture
//! - \ref TIMER_CFG_A_CAP_TIME_UP : Half-width edge time capture that counts up
//! instead of down.
//! - \ref TIMER_CFG_A_PWM : Half-width PWM output
//! - Timer B:
//! - Same as Timer A but using TIMER_CFG_B_* instead.
//!
//! \param ui32Base is the base address of the timer module.
//! \param ui32Config is the configuration for the timer.详细请看timer.h中的描述:(请访问站点以查看此文件)
是用定时器来捕获IO电平的变化
#define Radio_PIN IOID_19
PIN_Config RadioPinTable[] =
{
Radio_PIN | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
PIN_TERMINATE
};
RadioPinHandle = PIN_open(&RadioPinState, RadioPinTable);
//RTOS: Enable peripheral domain and clocks for timer
Power_setDependency(PERIPH_GPT1);
PINCC26XX_setMux(RadioPinHandle, Radio_PIN, IOC_PORT_MCU_PORT_EVENT2);
//TimerDisable(GPT1_BASE,TIMER_BOTH);
TimerConfigure(GPT1_BASE,TIMER_CFG_SPLIT_PAIR|TIMER_CFG_A_CAP_COUNT);
TimerEventControl(GPT1_BASE,TIMER_A,TIMER_EVENT_BOTH_EDGES);
//TimerPrescaleSet(GPT1_BASE,TIMER_A,0);
TimerLoadSet(GPT1_BASE,TIMER_A,65535);
TimerMatchSet(GPT1_BASE,TIMER_A,1);
TimerIntRegister(GPT1_BASE,TIMER_A,Radio_callback);
TimerIntEnable(GPT1_BASE,TIMER_CAPA_MATCH);
TimerEnable(GPT1_BASE,TIMER_A);