| commit | 9fad7e4b2348a11efb158ad19ab3ce9909ae9cec | [log] [tgz] |
|---|---|---|
| author | Gwendal Grignou <gwendal@chromium.org> | Fri Jan 10 08:37:44 2025 |
| committer | Copybara-Service <copybara-worker@google.com> | Thu Feb 13 06:32:26 2025 |
| tree | e62ec7da852a83af46a7ea3cb8fd2c1057d335db | |
| parent | 14529a4593f2faca09b53e0646df4c6b794e50ef [diff] |
libmems: Stop exposing internal implementation Add a factory object to create the iio context. From there, iio device objects are added. No ..impl.h files are exported anymore. BUG=none TEST=Unit tests. Change-Id: Ib24fd46ca69b85e98e0767c16a2880b6f1fe1db7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/6164341 Reviewed-by: Harvey Yang <chenghaoyang@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Cheng-Han Yang <chenghan@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> NOKEYCHECK=True GitOrigin-RevId: 6872e3b5b5c53dc0f68c656ca551d1729ea04c07
Project goal and motivationThis library provides a set of wrapper and test helpers around libiio.
It is meant to provide a common foundation for Chrome OS to access and interface IIO sensors, with:
At the root of the hierarchy, there exists the IioContext, which represents the IIO devices currently available on the system. These can be retrieved by name and inspected, via instances of IioDevice.
An IioDevice allows reading and writing attributes of an IIO device via type-safe helper APIs. It also offers support for configuring the buffer and trigger of an IIO device, which we use in order to allow the Chrome UI to read accelerometer data and support screen rotation.
An IioDevice also exposes a list of IioChannels, which can individually be enabled and disabled.
Useful mocks for the core classes are provided, such that a test author can focus on the logic of the unit tests and share a common testing language with other engineers working in this space. Sharing the foundation of testing IIO sensor access helps ensure that any improvement in this area can benefit all clients.