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.

cc2541中S1按键如何实现双沿触发

Other Parts Discussed in Thread: CC2541

我看到cc2541中关于S1按键只有一个上升沿触发事件,我想做一个双沿触发(就是将按键的一个pin脚连接到cpu的其他IO上,譬如说连接的到P04口),当按下按键的时候,就能够触发一个上升沿中断,当按键松开的时候就能够触发下降沿中断。

关于代码的部分应该修改那一部分呢?

我这边先是模仿源码中关于上升沿的IO进行配置,但是关于S1按键中的按键定义我只看到只能定义一个按键

原始代码 如下

/* S1 */
#define PUSH1_BV BV(1)
#define PUSH1_SBIT P0_1

我是否可以按照这种方式添加下面的代码么

/* S1 */
#define PUSH1_BV BV(1)
#define PUSH1_SBIT P0_4

谢谢