Application of App_button in nrf51822

Source: Internet
Author: User

Button Handler (key handling program)

Key handlers are implemented using the processing mechanism of the Gpiote(GPIO Task and Event) to prevent keystrokes from dithering. The timer is turned on in the Gpiote event handler.

After the timer expires, the button corresponding to the PIN is still valid (the button has been pressed), the key press event will be reported to the application.

When the timer is in the process of execution, and a new Gpiote event is generated, the timer will start again. Also in the App_button_init () macro definition. The number of Use_scheduler indicates whether to use scheduler (I do not know what the scheduler is for, and later study to say).

Note: The timer in the key handler uses the virtual timer (App_timer), not the peripheral timer (Rtc0,rt1,tim0, tim1, tim2, ), the user must ensure that the cache (queue" is large enough so that the talent remains in the Gpiote module of events (event)   app_timer_stop ()  /  app_timer_start () operation.

Even Scheduler not used. Also need to be in App_button.h   includes App_scheduler.h, so when compiling.  app_scheduler.h must be included in the compiler's path (include paths).  


in app_ble_hrs program, finally through Button_handler_ The P_btn->button_handler (p_btn->pin_no) call in the Execute function implements the processing of the keys.



Application of App_button in nrf51822

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.