Commit graph

40 commits

Author SHA1 Message Date
Peter Bigot
1688f8c740 samples: nrf: system_off: show how to disable deep sleep
Due to a long standing difference of requirements enabling deep sleep
will by default cause any application that delays for an unbounded
period to power down.  On Nordic doing so turns the system off.  Show
how to prevent this from happening while still allowing deep sleep
states to be available for the application's controlled use.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-07 15:06:08 +02:00
Kumar Gala
a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Marc Herbert
2cd51a33ce samples: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Peter Bigot
24c1be3896 samples: nrf: system_off: demonstrate use of device pm to reduce power
Currently system power management does not automatically control
device power, and this example demonstrates high current draw due to
the UART being enabled.  Enable device power management and
demonstrate how to manually turn off greedy devices.

Also remove the 60 s delay that confirms we successfully turned off
the residency policy; that's not directly relevant to the purpose of
the sample.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-25 16:25:33 +02:00
Martí Bolívar
6e8775ff84 devicetree: remove DT_HAS_NODE_STATUS_OKAY
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:

- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
  for macros which are equivalent to
  DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name

Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.

This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 18:24:42 +02:00
Carles Cufi
b67a31e411 Bluetooth: controller: Remove legacy LL
Remove the legacy Link Layer implementation.

Closes #24187.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-08 15:07:00 +02:00
Kumar Gala
fdd85d5ad7 dts: Rename DT_HAS_NODE macro to DT_HAS_NODE_STATUS_OKAY
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear.  As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-06 05:25:41 -05:00
Kumar Gala
4e93b77552 samples: Convert DT_ALIAS_* to new DT_ALIAS() macro
Convert DT_ALIAS_* defines to use DT_ALIAS() plus other macros from
include/devicetree.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 15:28:20 -05:00
Kumar Gala
50750bfa31 samples: nrf: battery: Convert to new dts macros
Change #ifdef DT_VOLTAGE_DIVIDER_VBATT_IO_CHANNELS to
 #if DT_NODE_HAS_PROP(DT_INST(0, voltage_divider), io_channels)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 17:44:24 -04:00
Kumar Gala
aea994455a sample: boards: nrf: system_off: Convert to use new dts macros
Convert to use DT_GPIO_PIN(DT_NODELABEL(button0), gpios) to get the gpio
pin number.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 17:44:24 -04:00
Kumar Gala
c678f9c132 samples: boards: nrfx: Convert to new dts macros
Convert to use DT_IRQN() and DT_IRQ() to get the irq number and priority
for the DT_NODELABEL(gpiote) device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 17:44:24 -04:00
Joakim Andersson
ab706b28d5 Bluetooth: samples: Convert to using k_timeout_t struct
Convert bluetooth samples or board samples using bluetooth to use the
new k_timeout_t struct.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Peter Bigot
cc3ccef40d samples: nrf: battery: add documentation
Provide a description of the sample and how it works with different
power supply source configurations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-22 17:46:07 +02:00
Peter Bigot
628bd00168 samples: nrf: battery: extend to support measuring Vdd directly
When the system is powered directly a measurement of Vdd provides the
battery voltage.  This requires a different ADC configuration and
level curve.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-22 17:46:07 +02:00
Carles Cufi
0f9b3626c1 boards: nrf52_pca20020: Rename to thingy52_nrf52832
The board name for the Thingy:52, so far known as nrf52_pca20020, is
renamed to thingy52_nrf52832.  Its documentation and all references to
its name in the tree are updated accordingly. Overlay and configuration
files specific to this board are also renamed, to match the new board
name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Carles Cufi
6656214af2 boards: nrf52_pca10040: Rename to nrf52dk_nrf52832
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832.  Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Ioannis Glaropoulos
e0b8158ca1 boards: arm: nrf9160_pca10090: rename board to nrf9160dk_nrf9160
We rename the nRF91 Dev Kit board target (nrf9160_pca10090)
to nrf9160dk_nrf9160. We update all associated references
in the supportive documentation and all nRF9160-related
cofigurations and overlay files in the samples and tests
in the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-31 15:16:08 +02:00
Peter Bigot
090088d015 samples: boards: nrf: battery: Convert to new DT macros
Reference properties through the path to vbatt.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-03-27 11:41:04 -05:00
Torsten Rasmussen
407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Andrzej Głąbek
4253eae005 boards: nrf52840_pca10056: Rename board to nrf52840dk_nrf52840
The nRF52840 DK board target, so far known as nrf52840_pca10056,
is renamed to nrf52840dk_nrf52840.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-27 09:14:08 +01:00
Ioannis Glaropoulos
f3807f19dc boards: arm: nrf51_pca10028: rename board to nrf51dk_nrf51422
We rename the nRF51 Dev Kit board target (nrf51_pca10028)
to nrf51dk_nrf51422. We update all associated references
in the supportive documentation and all nRF51-related
cofigurations and overlay files in the samples and tests
in the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-24 11:45:27 +01:00
Peter Bigot
86d1b7d2c8 samples: boards: nrf: update battery sample for new GPIO API
Replace legacy API and configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Carles Cufi
d3c4b77f45 samples: nrf: onoff_level_light: Convert to new GPIO API
Convert to the new GPIO API using logical levels instead of raw ones.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Carles Cufi
988388d2d5 samples: nrf: mesh: onoff-app: Convert to the new GPIO API
Covert to the new GPIO API, using logical levels instead of raw ones.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter A. Bigot
d715fbba63 samples: boards: nrf: add battery measurement sample
Use the voltage divider devicetree binding to demonstrate measurement
of battery voltage for two Nordic-based boards that have the necessary
circuitry.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-02-03 16:26:51 +01:00
Nick Ward
b5f335b11b mcumgr: BT SMP transport config for authenticated requirement
This commit introduces a new Kconfig symbol MCUMGR_SMP_BT_AUTHEN.
When selected it configures the Bluetooth mcumgr transport to require
an authenticated connection.

If the Bluetooth mcumgr transport is selected then this new symbol is
selected by default.  Bluetooth SMP is also selected to ensure Zephyr
is configured with Bluetooth security features enabled to provide
Bluetooth authentication APIs to the user's app.  Users can choose to
disable this level of security for the Bluetooth mcumgr transport if
they do not require it.

Fixes #16482

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2019-12-20 20:28:39 -05:00
Ulf Magnusson
984bfae831 global: Remove leading/trailing blank lines in files
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.

Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.

Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-11 19:17:27 +01:00
Vikrant More
5af5407570 samples: mesh: nrf52: added some preprocessor directive
Added some preprocessor directive so that code get compile
for some more nRF52 boards which has only one LED & one button.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Vikrant More
b80b359955 samples: mesh: nrf52: minor improvement in MOVE msg handlers
Changes in MOVE message handler are  as per Mesh Model
Specification which says:

"Upon receiving a Generic Move Set message, the Generic Level
Server shall respond with a Generic Level Status message.
The target Generic Level state is the upper limit of the
Generic Level state when the transition speed is positive,
or the lower limit of the Generic Level state
when the transition speed is negative."

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Vikrant More
102d402fc5 samples: mesh: nrf52: added some more macros support
Added some more macros support.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Vikrant More
c4edc2d78b samples: mesh: nrf52: removed redundant global variable
Removed global variable 'default_tt' & code depend on it
which is redundant as per latest implementation.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Vikrant More
13a5addffa samples: mesh: nrf52: corrected sequence of get & publish messages
Corrected sequence of execution of get & publish messages.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Vikrant More
f8c03d79f6 samples: mesh: nrf52: added separate update_vnd_led_gpio()
Added sepate function update_vnd_led_gpio().

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Vikrant More
c97e872e7d samples: mesh: nrf52: used constrain functions whereever possible
Added support of constrain_temperature() function.
Used constrain_lightness() & constrain_temperature()
whereever possible.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Vikrant More
ff323ce0e8 samples: mesh: nrf52: separately save default & last target values
Separately saved default & last target values of lightness,
temperature & delta_uv on flash (using settings layer).

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Vikrant More
5ad88281b0 samples: mesh: nrf52: rename enum attributes
Rename attributes in enum state_binding.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Vikrant More
89a0986dff samples: mesh: nrf52: implementation based on single pointer
Implement thing based on single struct light_ctl_state pointer
in entire Application.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Vikrant More
b5ebc66889 samples: mesh: removed redundant code, blank lines & comments
Removed redundant code, unnecessary blank lines & comments.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-12-11 12:52:17 +02:00
Peter Bigot
e83b079e22 samples: nrf52: replace power_mgr with system_off
The Nordic SOC doesn't support multiple system power states, only one
deep sleep state.  Replace the old example with a simpler one that can
be used to measure CPU active, normal sleep, and system off modes.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-12-09 16:33:03 -05:00
Andrzej Głąbek
d3ea66d493 samples: boards: Merge nrf91/ with nrf52/ and rename it to nrf/
The following samples:
- boards/nrf91/nrfx
- boards/nrf52/power_mgr
are actually not specific to nRF91 and nRF52 Series SoCs, respectively,
hence the current naming of the above board/ subdirectories may be
misleading. Thus, use nrf/ directory for holding all nRF board specific
samples that apply to several boards.

Paths to the moved samples that are mentioned in their documentation
are also updated accordingly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-12-09 16:10:19 +01:00