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.

关于sensor controller button debouncer 例子问题

1.event handler A code 里面的代码是一个只要触发按钮按下,就会运行的代码吗?

2.sensor controller Task Testing 里面我只有点击Run task iterations continuously 这个按钮,才能一直正常检测按钮有没有按下。如果我把这个代码编译到CCS里面,烧录到CC1352里面,sensor controller 是怎么运行的?一直检测按钮是否按下吗?

// If a button edge has been detected (not yet debounced) ...

if (state.isDebouncing == 0) {

// Store the state (do not read the pin, as it may have changed since the trigger)

output.buttonState ^= 1;

// Alert the System CPU application when the button is pressed

if (output.buttonState == BUTTON_PRESSED) {

fwGenAlertInterrupt();

}

// Start ~200 ms debouncing interval

evhSetupTimer1Trigger(0, 200, 2);

// Update state

state.isDebouncing = 1;

// When debouncing has been completed ...

} else {

// Start listening for the opposite button state

if (output.buttonState == BUTTON_PRESSED) {

evhSetupGpioTrigger(0, AUXIO_I_BUTTON, BUTTON_RELEASED, EVH_GPIO_TRIG_ON_MATCH);

} else {

evhSetupGpioTrigger(0, AUXIO_I_BUTTON, BUTTON_PRESSED, EVH_GPIO_TRIG_ON_MATCH);

}

// Update state

state.isDebouncing = 0;

}