Application of App_button in nRF58122

Source: Internet
Author: User

Button Handler (key handling program)

The key handler is implemented using the Gpiote(GPIO Task and event) processing mechanism, in order 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 operation, a new Gpiote event is generated, and the timer restarts. In addition, in the App_button_init () macro definition, the parameter Use_scheduler indicates whether to use the 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 is used (queue) is large enough to remain in the Gpiote module's events (event)   app_timer_stop ()  /  app_timer_start () operation. Even if scheduler Not used, also need to be in App_button.h   contains 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.



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.