Hi,
I am working on an application which most of the time resides in extended sleep mode. I am referring prox_reporter example. I have following questions.
1. I want to wake-up my system when the button is pushed as well as released. Is it possible?
2.根据我的应用程序状态,我可以通过按钮控制唤醒吗?意味着一旦生成中断,我想停止检测按钮唤醒中断。1Second后,我想再次重新启用按钮唤醒中断。
Device:
Hi Ankit,
Options:
1) You can wake up your system when the button is pushed or released by the wkupct_enable_irq(uint32_t sel_pins, uint32_t pol_pins, uint16_t
events_num, uint16_t deb_time) function by defining the polarity (high or low) according to your implementation plan.
2) You can stop detecting the button after the interrupt occurs if you don’t invoke the enable of the interrupt by calling the wkupct_enable_irq().
You can advise UM-B-51 in Software Development Kit section from the documents tab.
Thanks STS_Dialog.
我同意我可以醒来either button is pressed or release.
But I want to wake up on both the events. Means when the button is pressed, I want to be called button_press_cb() and when button released I want to be called button_relase_cb().
a. Currently, I have to switch between them manually. Means when I detect button press, I am configuring wake-up irq for button release and same when the button is released. Suggest me if there is any better solution for this.
b. Regarding stop detecting, wake-up buttons, Is it applicable as soon as I call wkupct_enable_irq(). function?
Hi Ankit,
1) There isn’t another option to trigger the wake up timer, this procedure implemented by the wake-up irq function. It depends by the definition of the polarity (high or low).
2) If you call wkupct_enable_irq() enables the interrupt which enable the button(the wake up timer), in other case if you don’t call the above function nothing happens.
Thanks,
STS_Dialog.
I am clear with ( a ) now.
Let's talk about the scenario ( b ).
I have enabled wake-up on button press. After that registered callback function is called and I did some processing in it. After that if I want to continue receiving interrupt on that button. Do I have to enable irq again by calling wkupct_enable_irq() function?
Yes you have to call wkupct_enable_irq() function again,otherwise you will have no interrupt when you push the button again(the wake up time which enables the interrupt for the whole procedure).As you can see as many times you want to press the button which enables the interrupt so times you have to call the above function.
Thanks STS_Dialog.
Hi,
Whenever button wake-up callback is called, do I have to configure button pin on every wake-up by calling GPIO_ConfigurePin() function?
Hi Ankit,
No, the configuration that defines the functionallity of the pins is done only once when the device is waking up, through the periph_init() function, you dont have to do anything else for the wake up interrupt to trigger appart from invoking the wkupct_enable_irq() as my collegue mentioned.
Thanks MT_dialog
Now I am facing the new problem.
我已经观察到进入扩展睡眠模式后,有时不会检测到按钮事件。按下它后2-3次,它实际上检测按钮按下事件,并调用唤醒回调。当设备不在睡眠模式下时,它工作正常。看门狗在它中扮演角色吗?我启用了CFG_WDOG。
Hi Ankit,
I have checked your scenario it worked fine (after going into extended sleep mode), you can check if wkupct_enable_irq() function is called when you press the button. Maybe you call the function inside a condition and it’s false, another option is to check the polarity again.
Thank you,
STS_Dialog.
Hi hantig,
Please don't post additional questions in an existing thread. Create a new thread for new questions.
To start new thread, go tohttps://support.dialog-semiconductor.com/forum, select relevant forum category like "dialog-smartbond-bluetooth-low-energy-–-software". Here you can see a button "New topic". By clicking on it you can start new thread.