Commit graph

525 commits

Author SHA1 Message Date
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
Alexandre Bourdiol 507ebecffc sample: drivers: counter: alarm: adapt test to driver change
Due to counter driver implementation change
"driver/counter/counter_ll_stm32_rtc.c: Add 1 tick to alarm"
It is necessary to adapt sample test (sanitycheck)
to take into consideration 1 tick precision/tolerance.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-05-19 14:48:49 +02:00
Joakim Andersson a8583ae1d9 samples: drivers: lcd_hd44780: Add readme
Add readme for lcd_hd44780 sample.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-15 17:18:56 +02:00
Joakim Andersson 6c6c03d60c samples: driver: flash_shell: Add readme
Add readme to flash_shell driver sample.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-15 17:18:56 +02:00
Joakim Andersson 2d21eb97d0 samples: drivers: i2c_fujitsu: Change readme to rst format
Rename README.txt to README.rst and change to rst format.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-15 17:18:56 +02:00
Joakim Andersson e01958e447 samples: drivers: entropy: Change readme to rst format
Rename README.txt to READMED.rst and change to rst format.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-15 17:18:56 +02:00
Joakim Andersson 798f9c4c67 samples: drivers: current_sensing: Change README to rst format
Rename README to README.rst and change to rst format.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-15 17:18:56 +02:00
Joakim Andersson a7b8295428 samples: drivers: crypto: Change README to rst format
Rename README.txt to README.rst and convert to rst format.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-15 17:18:56 +02:00
Joakim Andersson ef467c831c samples: drivers: Change drivers.rst to find all samples readme file
Change toc depth to find all samples readme file for driver folder.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-15 17:18:56 +02:00
Kumar Gala ff579a3af3 flash: Convert DT_FLASH_AREA to FLASH_AREA macros
Convert with a combo of scripts and by hand fixups:

git grep -l DT_FLASH_AREA_.*_ID | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_ID/FLASH_AREA_ID(\L\1)/'

git grep -l DT_FLASH_AREA_.*_OFFSET | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_OFFSET/FLASH_AREA_OFFSET(\L\1)/'

git grep -l DT_FLASH_AREA_.*_SIZE | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_SIZE/FLASH_AREA_SIZE(\L\1)/'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +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
Martí Bolívar 7e0eed9235 devicetree: allow access to all nodes
Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.

Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.

To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:

- emit macros for all existing nodes in gen_defines.py, regardless
  of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Tomasz Bursztyka 97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Robert Lubos 2c2771970e modules: mbedtls: Update mbedTLS commit and apply fixes
Update mbedTLS commit along with the following fixes:

* Fix naming inconsistencies in some cipher modes, to match core mbedTLS
  configs
* Add Kconfig to enable CTR cipher mode

Fixes #22421

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-05-07 23:46:08 -05:00
Peter A. Bigot e444274e95 drivers: counter: add Maxim DS3231 support
The DS3231 is an I2C real-time clock with internal temperature
compensated oscillator, maintaining civil time to 1 s precision with
nominal 2 ppm accuracy from 0-40 Cel.

The basic functionality is exposed as a counter that is always running
at 1 Hz.  Much more functionality is exposed as driver-specific API,
including the ability to translate between the time scale of the DS3231
and the time scale of the Zephyr uptime clock.  This allows correlation
of events in the system clock to UTC, TAI, or whatever time scale is
used to maintain the DS3231.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-07 19:45:06 +02:00
Andrzej Głąbek e92ba8f362 samples: drivers: Add sample that shows how to use AT45 flash driver
This commit adds a sample application intended to present capabilities
of the flash driver for AT45 family chips and to serve as a reference
of how to make use of that driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-05-07 14:51:10 +02:00
Andreas Sandberg 7663be01f1 samples: lora: Use the new DT alias to discover radio
The LoRa shell requires the alias 'lora0' for the default radio. Use
the same alias for the samples to make them portable across different
radios and devices.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-07 14:49:06 +02:00
Andreas Sandberg ff26eebb7e samples: lora: Remove unnecessary config option
LoRa drivers no longer depend on CONFIG_COUNTER. Remove this
configuration option from the samples.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-06 07:29:52 -05: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
Alexander Wachter 464f135ce6 canbus: Convert canbus driver and subsys to new timeout API
Convert all canbus related API/samples/tests/subsys
to the new timeout API with k_timeout_t.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-05-06 10:19:13 +02:00
Kumar Gala 31d5caa0a8 samples: counter: alarm: Convert to use new dts macros
Convert DT_RTC_0_NAME to DT_LABEL() references based on which driver is
enabled for the platforms the test is supported on (NRF & STM32).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-05 15:46:50 +02:00
Anas Nashif 0bac2f35cc samples: remove unused harness definition
remove console harness without a config.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-05 06:16:50 -04: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
Manivannan Sadhasivam 7be8debaab lora: Switch to new timeout API
Get rid of legacy timeout API and move to new timeout API for LoRa.
This involves changes to API, SX1276 driver and sample application.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-05-04 19:01:09 +02:00
Stephanos Ioannidis 0eaa495ccb samples: drivers: can: Rename directory for consistency
This commit renames the CAN sample directory name from `CAN` to `can`
to be consistent with others.

Noting that the CAN driver test directory is named `tests/drivers/can`,
we have no excuse for naming the CAN driver sample directory
`samples/drivers/CAN`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-02 09:54:06 -04:00
Henrik Brix Andersen ae2b3587e6 samples: drivers: dac: add support for frdm_k64f board
Add support for the NXP FRDM-K64F development board to the DAC driver
sample.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-05-01 12:35:50 -05:00
Henrik Brix Andersen 280e3fa999 samples: drivers: dac: add support for twr_ke18f board
Add support for the NXP TWR-KE18F development board to the DAC driver
sample.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-05-01 12:35:50 -05:00
Peter Bigot 52885d0576 coccinelle: run ms_timeout conversion semantic patch
Substitute integral constants where call sites passed named constants
that have timeout values as arguments to parameters that expect
millisecond durations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-30 18:26:26 +02:00
Kumar Gala 3f236f2183 can: dts: Convert can-primary alias to zephyr,can-primary chosen prop
Convert CAN to use a chosen node property that is similar to how we
handle zephyr,entroy or zephyr,flash-controller as the means to select a
specific peripheral instance utilized by a subsystem.

Replace references of the form:

alias {
	can-primary = &can1;
};

with:

chosen {
	zephyr,can-primary = &can1;
};

Replace various macro/define references with either
DT_CHOSEN(zephyr_can_primary) or replace DT_ALIAS_CAN_PRIMARY_LABEL
with DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-29 14:27:31 -05:00
Gerson Fernando Budke 5321c42882 samples: drivers: counter: alarm: Add samd20_xpro
Add samd20_xpro board support to show how to use sam0 TC32.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-29 10:43:21 -05:00
Jose Alberto Meza 53c8bea659 samples: drivers: espi: Fix coverity issue
Update variable according to new gpio API.
Fixes #23575

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-04-29 00:11:48 +02:00
Kumar Gala 7a15afc1d4 drivers: flash: replace DT_FLASH_DEV_NAME with DT macro
Replace DT_FLASH_DEV_NAME with DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL.
We now set zephyr,flash-controller in the chosen node of the device
tree to the flash controller device.

NOTE: For a SoCs with on die flash, this points to the controller and
      not the 'soc-nv-flash' node.  Typically the controller is the
      parent of the 'soc-nv-flash' node).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-27 18:43:20 -05:00
Mark Olsson 1ca4aedc35 tests: drivers: fixes for failing tests
Tests were failing as they were looking for an alias which didn't exist
Also, because some code in kscan_handlers.c wasn't compilable

Signed-off-by: Mark Olsson <mark@markolsson.se>
2020-04-24 09:49:46 -05:00
Mark Olsson 6b593a51d2 samples: drivers: kscan: Add sample for touch panel drivers
Simple sample to test touch panel drivers.
Outputs a message to the console on every touch event.

Signed-off-by: Mark Olsson <mark@markolsson.se>
2020-04-24 09:49:46 -05:00
Kumar Gala a3ec95caef drivers: gpio: gpio_sam: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.  We update one
sample app to use a nodelabel reference.  We also remove defines in
dts_fixup.h as they are no longer needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-23 05:59:50 -05:00
Jose Alberto Meza 3bb73adbea samples: drivers: espi: Showcase eSPI flash read/write API
Extend sample code to demonstrate the eSPI API to read/write flash.
Remove trailing \n
Use LOG_ERR when applicable instead of LOG_WRN
Treat warnings as errors.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-04-22 22:21:54 +02:00
Martin Jäger 8870a699dc samples: drivers: dac: Add API example
This example generates a sawtooth signal to show how to use the DAC.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-04-20 17:41:48 +02:00
Martí Bolívar aea96bca25 samples: watchdog: devicetree updates
Move to the new devicetree API and stop using DT_WDT_0_NAME fixup
macros. All existing in-tree SoCs with fixup names are still supported
here via compatible. The watchdog0 alias is also still supported.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-17 16:09:07 -05:00
Flavio Ceolin b41583d7d5 samples: espi: Follow API changes
Change the sample to follow espi API changes to pass structs by
reference.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-04-17 10:33:02 -07:00
Bjarne Steinsbo 4034ef0633 boards: arm: black_f407ve: Add support for on-board SPI flash
This board contains an on-board Winbond W25Q16.
The chip is connected to spi1 using PB3-PB5 and PB0 as CS.

Signed-off-by: Bjarne Steinsbo <bjarne@gmail.com>
2020-04-15 13:15:29 -05:00
Erwan Gouriou 9985713fd0 samples/drivers/led_*: Remove usage of CONFIG_I2C_X on stm32 boards
Remove usage of Kconfig symbols I2C_X and rely on overlay
to enable i2c instances in samples for stm32 boards

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-15 08:21:30 -05:00
Richard Osterloh 3f8c83a591 boards: adafruit_feather_stm32f405: Add SPI flash
Added SPI flash definition on SPI1.

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2020-04-13 11:53:59 -05:00
Kumar Gala 43a7d26603 drivers: entropy: replace CONFIG_ENTROPY_NAME with DT macro
Replace CONFIG_ENTROPY_NAME with DT_CHOSEN_ZEPHYR_ENTROPY_LABEL.  We now
set zephyr,entropy in the chosen node of the device tree to the entropy
device.

This allows us to remove CONFIG_ENTROPY_NAME from dts_fixup.h.  Also
remove any other stale ENTROPY related defines in dts_fixup.h files.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-13 09:14:21 -05:00
Jose Alberto Meza aad8ad915d samples: drivers: espi: Enable OOB channel explicitly
Sample showcase OOB transaction, enable OOB channel explicitly.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-04-11 15:30:27 -04:00
Maciej Fabia ae285ef4e6 drivers: crypto: add driver for nRF ECB
add driver for nRF AES Electronic CodeBook (ECB) peripheral

Signed-off-by: Maciej Fabia <maciej.fabia@nordicsemi.no>
2020-04-08 16:20:53 +02:00
Peter Bigot 95435a546d samples: drivers: fix ps2 sample for timer api change
Sleep duration is given in integral milliseconds so use k_msleep()
instead of k_sleep().

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-07 16:39:08 -05: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
Andrzej Głąbek 0b300da221 tree-wide: Remove assignments to Kconfig options unused in nRF drivers
Kconfig options that enable I2C and SPI instances are no longer used
in nRF drivers. Remove all assignments done to these options in related
board definitions, samples, and tests.

For nrf52_pca20020, also no longer needed setting of default values
for GPIO_SX1509B* options is removed (now the gpio_sx1509b driver is
enabled by default when a corresponding devicetree node is enabled).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-04-03 14:47:32 +02:00
Christian Taedcke 1bf5d24638 samples: drivers/entropy yaml regex fix
The last regex in the yaml file did not match when executing the test on
an embedded target. The expected two spaces are not present at the
beginning of the line.

Fixes #23919

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-04-03 08:00:38 -04:00
Peter Bigot ecf3bdb5b3 coccinelle: re-run timeout conversion semantic patch
Run the int_literal_to_timeout Coccinelle script to fix places where
it is clear that an integer duration is being passed where a timeout
value is required.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-02 19:47:51 +03:00