Skip to content

Commit 60aadc4

Browse files
MarekPietarlubos
authored andcommitted
applications: nrf_desktop: Improve motion buttons documentation
Change introduces additional information related to the configuration and implementation details of the module. Jira: NCSDK-22789 Signed-off-by: Marek Pieta <[email protected]>
1 parent d9e0c0c commit 60aadc4

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

applications/nrf_desktop/doc/motion.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Depending on the selected configuration option, a different implementation file
4040

4141
You can use the :ref:`CONFIG_DESKTOP_MOTION_PM_EVENTS <config_desktop_app_options>` Kconfig option to enable or disable handling of the power management events, such as :c:struct:`power_down_event` and :c:struct:`wake_up_event`.
4242
The option is enabled by default and depends on the :kconfig:option:`CONFIG_CAF_PM_EVENTS` Kconfig option.
43+
The option is unavailable for the motion module implementation that generates movement data using buttons (:ref:`CONFIG_DESKTOP_MOTION_BUTTONS_ENABLE <config_desktop_app_options>`).
44+
The implementation does not react to the power management events.
4345

4446
Movement data from motion sensors
4547
=================================
@@ -63,6 +65,20 @@ Movement data from buttons
6365

6466
Selecting the :ref:`CONFIG_DESKTOP_MOTION_BUTTONS_ENABLE <config_desktop_app_options>` option adds the :file:`src/hw_interface/motion_buttons.c` file to the compilation.
6567

68+
The movement data is generated when pressing a button.
69+
The module detects the button presses by relying on the received :c:struct:`button_event`.
70+
Generating motion for every direction is triggered using a separate button.
71+
Key ID (:c:member:`button_event.key_id`) of the button used to generate motion for a given direction can be configured with a dedicated Kconfig option:
72+
73+
* Up (:ref:`CONFIG_DESKTOP_MOTION_BUTTONS_UP_KEY_ID <config_desktop_app_options>`)
74+
* Down (:ref:`CONFIG_DESKTOP_MOTION_BUTTONS_DOWN_KEY_ID <config_desktop_app_options>`)
75+
* Left (:ref:`CONFIG_DESKTOP_MOTION_BUTTONS_LEFT_KEY_ID <config_desktop_app_options>`)
76+
* Right (:ref:`CONFIG_DESKTOP_MOTION_BUTTONS_RIGHT_KEY_ID <config_desktop_app_options>`)
77+
78+
Pressing and holding one of the mentioned buttons results in generating data for movement in a given direction.
79+
The :ref:`CONFIG_DESKTOP_MOTION_BUTTONS_MOTION_PER_SEC <config_desktop_app_options>` can be used to control a motion generated per second during a button press.
80+
By default, ``1000`` of motion is generated per second during a button press.
81+
6682
Simulated movement data
6783
=======================
6884

@@ -166,6 +182,18 @@ The module continues to sample data until disconnection or when there is no moti
166182
The ``motion`` module assumes no motion when a number of consecutive samples equal to :ref:`CONFIG_DESKTOP_MOTION_SENSOR_EMPTY_SAMPLES_COUNT <config_desktop_app_options>` returns zero on both axis.
167183
In such case, the module will switch back to ``STATE_IDLE`` and wait for the motion sensor trigger.
168184

185+
Movement data from buttons
186+
==========================
187+
188+
Motion is generated based on the total time a button is pressed.
189+
The time measurements rely on the hardware clock.
190+
If available, the module uses the :c:func:`k_cycle_get_64` function to read the hardware clock.
191+
Otherwise, the :c:func:`k_cycle_get_32` function is used for that purpose.
192+
193+
When a HID subscriber is connected, that is when the device is connected either over USB or Bluetooth LE, the module forwards the generated motion to the subscriber using :c:struct:`motion_event`.
194+
The first :c:struct:`motion_event` is generated when a button is pressed.
195+
The subsequent :c:struct:`motion_event` is submitted when the previously generated motion data is sent to the subscriber, that is when :c:struct:`hid_report_sent_event` is received by the module.
196+
169197
Simulated movement data
170198
=======================
171199

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,17 @@ nRF Machine Learning (Edge Impulse)
206206
nRF Desktop
207207
-----------
208208

209-
* Added Kconfig options to enable handling of the power management events for the following nRF Desktop modules:
209+
* Added:
210+
211+
* Kconfig options to enable handling of the power management events for the following nRF Desktop modules:
210212

211-
* :ref:`nrf_desktop_board` - The :ref:`CONFIG_DESKTOP_BOARD_PM_EVENTS <config_desktop_app_options>` Kconfig option.
212-
* :ref:`nrf_desktop_motion` - The :ref:`CONFIG_DESKTOP_MOTION_PM_EVENTS <config_desktop_app_options>` Kconfig option.
213-
* :ref:`nrf_desktop_ble_latency` - The :ref:`CONFIG_DESKTOP_BLE_LATENCY_PM_EVENTS <config_desktop_app_options>` Kconfig option.
213+
* :ref:`nrf_desktop_board` - The :ref:`CONFIG_DESKTOP_BOARD_PM_EVENTS <config_desktop_app_options>` Kconfig option.
214+
* :ref:`nrf_desktop_motion` - The :ref:`CONFIG_DESKTOP_MOTION_PM_EVENTS <config_desktop_app_options>` Kconfig option.
215+
* :ref:`nrf_desktop_ble_latency` - The :ref:`CONFIG_DESKTOP_BLE_LATENCY_PM_EVENTS <config_desktop_app_options>` Kconfig option.
214216

215-
All listed Kconfig options are enabled by default and depend on the :kconfig:option:`CONFIG_CAF_PM_EVENTS` Kconfig option.
217+
All listed Kconfig options are enabled by default and depend on the :kconfig:option:`CONFIG_CAF_PM_EVENTS` Kconfig option.
218+
* Kconfig option to configure a motion generated per second during a button press (:ref:`CONFIG_DESKTOP_MOTION_BUTTONS_MOTION_PER_SEC <config_desktop_app_options>`) in the :ref:`nrf_desktop_motion`.
219+
The implementation relies on the hardware clock instead of system uptime to improve accuracy of the motion data generated when pressing a button.
216220

217221
* Updated:
218222

@@ -223,6 +227,8 @@ nRF Desktop
223227
* Disabled ``CONFIG_BOOT_SERIAL_IMG_GRP_HASH`` in MCUboot bootloader release configurations of boards that use nRF52820 SoC.
224228
This is done to reduce the memory consumption.
225229
* To improve the accuracy, the generation of simulated movement data in the :ref:`nrf_desktop_motion` now uses a timestamp in microseconds based on the cycle count (either :c:func:`k_cycle_get_32` or :c:func:`k_cycle_get_64` function depending on the :kconfig:option:`CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER` Kconfig option).
230+
* Aligned Kconfig option names in the :ref:`nrf_desktop_motion` implementation that generates motion from button presses.
231+
The Kconfig options defining used key IDs are prefixed with ``CONFIG_MOTION_BUTTONS_`` instead of ``CONFIG_MOTION_`` to ensure consistency with configuration of other implementations of the motion module.
226232

227233
Thingy:53: Matter weather station
228234
---------------------------------

0 commit comments

Comments
 (0)