You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change introduces additional information related to the configuration
and implementation details of the module.
Jira: NCSDK-22789
Signed-off-by: Marek Pieta <[email protected]>
Copy file name to clipboardExpand all lines: applications/nrf_desktop/doc/motion.rst
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,8 @@ Depending on the selected configuration option, a different implementation file
40
40
41
41
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`.
42
42
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.
43
45
44
46
Movement data from motion sensors
45
47
=================================
@@ -63,6 +65,20 @@ Movement data from buttons
63
65
64
66
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.
65
67
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
+
66
82
Simulated movement data
67
83
=======================
68
84
@@ -166,6 +182,18 @@ The module continues to sample data until disconnection or when there is no moti
166
182
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.
167
183
In such case, the module will switch back to ``STATE_IDLE`` and wait for the motion sensor trigger.
168
184
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.
* 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:
210
212
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.
214
216
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.
216
220
217
221
* Updated:
218
222
@@ -223,6 +227,8 @@ nRF Desktop
223
227
* Disabled ``CONFIG_BOOT_SERIAL_IMG_GRP_HASH`` in MCUboot bootloader release configurations of boards that use nRF52820 SoC.
224
228
This is done to reduce the memory consumption.
225
229
* 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.
0 commit comments