Specify the units of the current LSB in microamperes, so that we can
measure low maximum currents. Right now it was specified in
milliamperes, but ignored and always hardcoded to 1mA in the driver.
This makes the driver pretty much useless when the maximum current to be
measured is in a range of e.g. 20-50mA.
This patch also removes some unnecessary ifdeffery: since we write the
calibration register, we can always provice measurements with the right
units. It is also wrong to provide sensor readings that do not match
with the units specified by the channel. After this change voltage is
always reported in V, current in A and power in W.
Note that power measurement had the current LSB hardcoded in the
calculation (assuming 1mA/LSB), this has been fixed as well.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Following dtschema practices, add phyisical units to the shunt resistor
value: milliohms.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
With the recent introduction of DT_HAS* Kconfig helpers, such build
asserts are highly unlikely, so just remove them.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Driver had Doxygen stubs for sensor interface calls. First, most were
incomplete, outdated or just wrong. Second, implementations just need to
make sure to adhere to the error codes documented in the public
interface (sensor API in this case).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
- Add many missing includes so that headers are self-contained
- Sort includes properly (locals first, stdc, zephyr, etc.)
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The sample illustrates a way of using the runtime observer registration
feature. With this sample the developer can understand how to use static
and runtime observer registration.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
The sample illustrates a way of exchange message with a host mock
running in a Python script. It can be used to improve the testability
and controllability of the tests.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
The sample illustrates a way of send all the channel event to the host
by using the UART, a user_data portion, and the claim/finish APIs.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
The work_queue sample illustrates three reaction styles available for
using zbus. The first is a listener that reacts by callback; use it should
for urgent reaction. The second is a listener that responds by callback;
instead of executing the code, it pushes a job to a work queue that will
be executed shortly but not immediately. The last one is the subscriber
that reacts using a queue; use it for an asynchronous reaction where the
developer would like to control the flow.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
The hello world sample illustrates a simple way of using zbus. There is
a listener and a subscriber interacting each other by using a read-only
and a regular channel. The APIs are called by using the function
and macro variation.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Add zbus subsystem test to verify the channel's runtime observers list
usage. It demonstrates the use of dynamically add and remove observer to
and from channels at runtime.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Add zbus subsystem test to verify the dynamic channel usage.
It demonstrates the use of static and dynamic external messages.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Add zbus subsystem test to verify threads integration based on usual
interaction, masking observers, and delayed interaction to verify semaphore
and queue event dispatcher timeout.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Add zbus message bus as a Zephyr subsystem. No message bus
or communication abstraction other than the usual (message queues,
mailboxes, etc.) enabled developers to implement event-driven systems in
Zephyr quickly. Zbus would fill that gap by providing the community with
a lightweight and flexible message bus. The implementation tries to be
closest as possible to the existing ones. We use the claim/finish
approach, and the API for publishing and reading channels are similar
in message queues. Zbus is about channels, messages, and observers.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Add a test to ensure that `pthread_mutex_t` can be used over
and over again and that there is no resource leakage with proper
usage.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Consistent with the change of `pthread_t` from
`struct posix_thread` to `uint32_t`, we can now also abstract
`pthread_mutex_t` as `uint32_t` and separate `struct posix_mutex`
as an implementation detail, hidden from POSIX API consumers.
This change deprecates `PTHREAD_MUTEX_DEFINE()` in favour of the
(standardized) `PTHREAD_MUTEX_INITIALIZER`.
This change introduces `CONFIG_MAX_PTHREAD_MUTEX_COUNT`.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Previously, `pthread_mutex_init()` could not actually fail, and
destroying mutexes was a no-op, so it was missing in a couple of
places.
However, with the change of `pthread_mutex_t` to `uint32_t`, and
since those are embedded inside of `struct posix_thread` for the
time being, the pthread code needs to keep track that it is
relinquishes used mutex resources when a thread completes.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
\MTL SOF is not compiling when
8d0eb6ce10
(devicetree: remove deprecated DT_CHOSEN_*_LABEL macros)
is applied
Fix - zephyr/toolchain used to be included by
devicetree/zephyr.h. The file has been removed by 8d0eb6ce10
Include is needed for ALWAYS_INLINE macro
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Right now we had a mix of int (signed) and uint32_t (fixed-width
unsigned integer). Use int32_t for all cases, both values may be either
positive/negative, and we have a defined range when using fixed-width
integers.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The "pmic" driver was in reality a driver for NXP PCA9420 PMIC. There's
no "universal PMIC". While the driver may work for other NXP PMICs, it
is clearly not generic for other vendors PMIC.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The regulator API supports all voltage/current ops, so there's no need
to guard them under "PMIC". If a particular driver doesn't support the
operations it will just return -ENOSYS and the command will fail.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The recently moved "consumer" API had multiple Doxygen issues. This
patch improves the Doxygen docs, e.g. use `@retval`, remove redundant
docs, improve parameter docs, etc.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The previous "consumer" API was designed without API ops, meaning only a
single implementation (singleton) was possible. This was inconsistent
with all other APIs, and, a problem in systems where more than a single
PMIC IC is present.
Note that all "consumer" ops are optional, so this won't break any
existing drivers.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
In Zephyr all regulator APIs are consumer APIs. There's no point in
adding a separate header file. Our current implementation is also
inconsistent with Linux, where enable/disable are also part of the
consumer.h API.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Fail with error if any of flashdisk partition assumptions are not met:
* uniform page size through the whole partition
* flashdisk starts at page boundary
* flashdisk ends at page boundary
Read-only flashdisks are not subject to above conditions because the
cache buffer is not used for read-only flashdisks.
The checks can be disabled via Kconfig option to save code space.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Force cache-size to 0 and treat flashdisk as read-only when backing
partition has read-only flag set. This allows users to save RAM when the
application does not write to the flashdisk, e.g. when a predefined FAT
filesystem is used.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Two tests were using the same simulation id, causing occasional failures
when all tests were run in parallel
Signed-off-by: Troels Nilsson <trnn@demant.com>
Fix some problems with test_recv_ipv6_fragment test case:
* net_pkt_ipv6_hdr_prev was not set, in result reassembly logic
overwritten wrong part of the IPv6 header
* Wrong checksum was set in the first fragment
Add more verification to the test_recv_ipv6_fragment test case:
* Actually register ICMPv6 Echo Reply handler so that the reassembled
packet can be analyzed
* Verify that IPv6, ICMPv6 headers and data are correct
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add test case which verifies that IPv6 fragmentation and reassembly
works correctly in loopback scenario. The test case verfies that:
* IPv6 packet is fragmented correctly in the send handler
* IPv6 packet is reassembled correctly in UDP receive handler.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The test cases which make use of wait_data semaphore incorrectly fed the
semaphore after processing the first fragment, instead of waiting for
all of the expected fragments to be processed. Adittionally, the test
cases did not really fail if the semaphore timeout occured (hence if for
example last fragment was lost, it wouldn't be detected by the test).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The second interface was not really used by the testsuite and only
obfuscated the testsuite content, hence remove it.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Many driver samples or tests only had 'drivers' as the tag, without a
tag indicating what driver that is exactly, so add some missing tags.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If adv stop was called form connected callback,
it would continue and unref the wrong conn object
if there where 2 connectable advertisers running,
but with only one 1 id configured.
Fixes#52196
Signed-off-by: Martin Tverdal <martin.tverdal@nordicsemi.no>
Fix advertising set's is_enabled flag to be reset when
connection complete is dequeued for connectable advertising
started using legacy advertising enable HCI commands. And
reset the is_enabled flag when advertising set terminated
is dequeued for connectable advertising enabled using
Extended Advertising HCI commands.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticks difference calculation to determine delayed
prepare callback. Without the use of masking by
ticker_ticks_diff_get, the diff value can be higher than
the supported 24-bit value. i.e. ticker_ticks_now_get()
rolls over in 24-bit value, whereas ticks_at_event is
free running value of 32-bits.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When running a flash read command on the flash shell, the hexdump
prints came out incorrect. There was a space missing between the
ninth element and its preceding "|", and a redundant newline.
This commit fixes this issue.
Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
The RP2040 needs a DTS overlay for the PWM to work with the
blinky_pwm examples. This commit adds the required overlay.
Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
This commit adds support for compiling in support for several different
regions/frequencies and dynamically choosing which to use in run-time.
This commit introduces no API breakages - if a prj.conf contains only a
single region Kconfig, the new function lorawan_set_region() does not
need to be called.
Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
Convert domains.py to use basic python logging module implementation to
remove west logging dependency. This removes hard dependency on west from
twister.
Fixes#51731
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>