Commit Graph

18 Commits

Author SHA1 Message Date
Pieter De Gendt
a553af738d drivers: sensor: Place API into iterable section
Add wrapper DEVICE_API macro to all sensor_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 22:04:55 +00:00
Rubin Gerritsen
8799ab1ec2 test: Apply semantic patch file ztest_strcmp.cocci
This patch file updates the use of assertion macros
comparing strings.

Command line used:
```
./scripts/coccicheck --mode=patch \
--cocci=scripts/coccinelle/ztest_strcmp.cocci tests/
```

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-06-14 19:25:42 +02:00
Gerard Marull-Paretas
c0e6e1167b tests: drivers: use POST_KERNEL level
There's no need to use APPLICATION level. In case of the IPM console
test, priorities have been adjusted to make sure sender/receiver are
initialized in the correct order.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 16:04:19 +02:00
Ryan McClelland
ad7ae7cc12 test: drivers: sensor: generic: fix double-promotions
Double promotion warnings are generated with the flag -Wdouble-promotion

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-08-08 08:06:07 +00:00
Vincent Geneves
d4d20c5826 drivers: sensor: add helper functions to convert float
These helper functions can be used to avoid dependency to double
type and save some space in ROM.

Signed-off-by: Vincent Geneves <vgeneves@kalray.eu>
2023-05-19 13:18:05 -05:00
Nick Ward
ac697825f1 tests: sensor generic: fix grammar used in test messages
Also removes full stops from messages for consistency.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2022-12-28 10:43:50 +01:00
Nick Ward
ba76501e74 tests: sensor generic: add milli and micro conversion tests
Tests for conversion to milli and micro prefix units.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2022-12-28 10:43:50 +01:00
Michał Barnaś
dae8efa692 ztest: remove the obsolete NULL appended to zassert macros
This commit removes the usage of NULL parameter as message in
zassert_* macros after making it optional

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-09-09 07:05:38 -04:00
Gerard Marull-Paretas
79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Fabio Baltieri
def230187b test: fix more legacy #include paths
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Aaron Massey
3f71ff8a73 tests: sensor generic: update to new ZTEST APIs
Updates tests to use the new ZTEST APIs

TEST=twister -T tests/drivers/sensor/generic

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-07-11 10:43:57 +02:00
Gerard Marull-Paretas
ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Nazar Kazakov
f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Radoslaw Koppel
d1a93c1426 drivers: sensor: Const sensor trigger data in trigger handler
This commit adds const modifier in second argument for
sensor trigger handler.
There is no reason to modify this data and this change
would allow to store trigger configuration also in FLASH.

Fixes: #38929

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2021-10-27 15:09:35 -04:00
Anas Nashif
6071aa5d3c tests: sensor: check for -ENOSYS
if function is not implemented, check for ENOSYS instead of ENOTSUP.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Ying ming
602b71ca5c test: sensor: add testcase
Add module test of API sensor_sample_fetch_chan().
Add module test of unit coversion function.

Signed-off-by: Ying ming <mingx.ying@intel.com>
2021-01-18 19:05:32 +01:00
YouhuaX Zhu
70b3e55bd9 Test: Refine annotaion and test code for sensor subsys.
1. Add more detail info to make the purpose and process
of the test cases more clear which include test goal,
test step, input, judging criteria, constraints, etc.,
and these can be seen in our Zephyr documentations.
2. Add some negative test code.

Signed-off-by: YouhuaX Zhu <youhuax.zhu@intel.com>
2020-10-27 10:43:59 -04:00
Simon Glass
2e14082334 tests: drivers: sensor: Move current test into generic/
The existing tests is for generic sensor drivers. To make room for a
driver-specific one, move it into a subdirectory.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-05 15:33:00 -04:00