Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/nrf-bm/api/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Bluetooth LE Connection State library
:inner:
:members:

.. _api_bm_buttons:

Bare Metal Buttons library
==========================

Expand Down
62 changes: 62 additions & 0 deletions doc/nrf-bm/libraries/buttons.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
.. _lib_bm_buttons:

Button handling library
#######################

.. contents::
:local:
:depth: 2

The button handling library uses the GPIOTE to detect button presses.

Overview
********

The library initiates a timer within the GPIOTE event handler to manage debouncing.
The button is only reported to the application as pressed if the corresponding pin is still active when the timer expires.

Configuration
*************

The library is enabled using the Kconfig system.
Set the :kconfig:option:`CONFIG_BM_BUTTONS` Kconfig option to enable the library.

Use the :kconfig:option:`CONFIG_BM_BUTTONS_NUM_PINS` Kconfig option to configure the number of pins available to the library.

Initialization
==============

Initialize the library by calling the :c:func:`bm_buttons_init` function.
This function requires an array of button configurations (:c:struct:`bm_buttons_config`).
You must also provide the detection delay time used for the debouncing.

Each button configuration is associated with a separate :c:type:`bm_buttons_handler_t` function.
The event handler receives the button pin number and state during a button event.
In this way, all configurations can use the same event handler.

Usage
*****

After initialization, enable the buttons by calling the :c:func:`bm_buttons_enable` function.
They can be disabled by calling the :c:func:`bm_buttons_disable` function.

Once a button is pressed and the debouncing process succeeds (the button state has not changed during the detection delay period), its configured event handler function is triggered.

When a button is enabled, you can call the :c:func:`bm_buttons_is_pressed` function to check whether it is pressed or not.

To deinitialize the library, call the :c:func:`bm_buttons_deinit` function.

Dependencies
************

This library uses the following |BMshort| libraries:

* Timer - :kconfig:option:`CONFIG_BM_TIMER`

API documentation
*****************

| Header file: :file:`include/bm/bm_buttons.h`
| Source files: :file:`lib/bm_buttons/`

:ref:`Button handling library API reference <api_bm_buttons>`
5 changes: 3 additions & 2 deletions doc/nrf-bm/libraries/event_scheduler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Event Scheduler
:local:
:depth: 2

The event scheduler is used for transferring execution from the interrupt context to the main context.
The event scheduler is used for transferring execution from the interrupt context to the main application context.

Overview
********

In some applications, it is beneficial to defer the execution of certain interrupts, for example some SoftDevice interrupts, to the main application function.
In some applications, it is beneficial to defer the execution of certain interrupts, such as those from the SoftDevice, to the main application function.
This shortens the time spent in the interrupt service routine (ISR).
It also allows for lower priority events to be raised before the previous event is fully processed.

Expand All @@ -33,6 +33,7 @@ Usage
*****

The SoftDevice event handler can call the :c:func:`event_scheduler_defer` function to schedule an event for later execution in the main thread.

To process these deferred events, call the :c:func:`event_scheduler_process` function regularly in the main application function.

Dependencies
Expand Down
3 changes: 2 additions & 1 deletion doc/nrf-bm/release_notes/release_notes_changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ No changes since the latest nRF Connect SDK Bare Metal release.
Documentation
=============

* Added documentation for the :ref:`lib_bm_buttons` library.
* Added documentation for the :ref:`lib_bm_timer` library.
* Added documentation for the :ref:`lib_ble_adv`.
* Added documentation for the :ref:`lib_ble_adv` library.
* Added documentation for the :ref:`lib_event_scheduler` library.
* Added documentation for the :ref:`lib_sensorsim` library.