Commit graph

772 commits

Author SHA1 Message Date
Ulf Magnusson 967b89a752 sensors: lps2hh: Fix misspelled GPIOS_CONTROLLER references
DT_INST_0_ST_LPS22HH_CS_GPIO_CONTROLLER should be
DT_INST_0_ST_LPS22HH_CS_GPIOS_CONTROLLER, which is the name generated by
gen_defines.py.

Discovered while working on unrelated removing of special-casing for
clocks.

Co-authored-by: Armando Visconti <armando.visconti@st.com>
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-19 06:41:25 -06:00
Krzysztof Chruscinski 00156ad80a drivers: clock_control: nrf: Switch to single clock device
Low frequency and high frequency clocks had separate devices
while they are actually handled by single peripheral with single
interrupt. The split was done probably because opaque subsys
argument in the API was used for other purposes and there was
no way to pass the information which clock should be controlled.
Implementation changes some time ago and subsys parameter was
no longer used. It now can be used to indicate which clock should
be controlled.

Change become necessary when nrf5340 is taken into account where
there are more clocks and current approach would lead to create
multiple devices - mess.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-12-17 14:38:19 +01: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
Kumar Gala 530b9a7132 include: Fix use of <i2c.h> -> <drivers/i2c.h>
Fix #include <i2c.h> as it has been deprecated and
should be #include <drivers/i2c.h>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-12-10 08:39:37 -05:00
Kumar Gala bb9efbfbd0 include: Fix use of <gpio.h> -> <drivers/gpio.h>
Fix #include <gpio.h> as it has been deprecated and
should be #include <drivers/gpio.h>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-12-10 08:39:37 -05:00
Kumar Gala 24ae1b1aa7 include: Fix use of <misc/FOO.h> -> <sys/FOO.h>
Fix #include <misc/FOO.h> as misc/FOO.h has been deprecated and
should be #include <sys/FOO.h>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-12-10 08:39:37 -05:00
Thomas Schmid 9a06428244 sensor: add ms5607 sensor
Implement a driver for the te connectivity ms5607 pressure and
temperature sensor.

Signed-off-by: Thomas Schmid <tom@lfence.de>
2019-12-09 12:22:25 -06:00
Peter Bigot ccfdc3c34b drivers: nrf_clock_calibration: wait for sensor initialization
When using the RC clock source a periodic calibration is invoked that
involves reading from the die temperature sensor.  The code did not
protect against execution order that caused the periodic calibration
to be invoked before the temperature sensor was initialized.

Update the temperature sensor to detect that it has not been
initialized and so should reject attempts to fetch a reading.

Update the calibration code to do nothing when temperature reading
fails.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-11-28 14:21:49 -05:00
Johann Fischer dfe57ca9e1 drivers: amg88xx: check i2c write return value
Check i2c write return value.

Fixes: #20498
Coverity-CID: 205628

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-11-21 07:48:35 -06:00
Jan Tore Guggedal 8134001148 drivers: sensor: bme680: Use DBG log level for non-error
Use LOG_DBG instead of LOG_ERR when BME680 chip is detected
and its ID verified successfully.

Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
2019-11-15 16:00:46 -05:00
Peter Bigot 83b2bb614b drivers: sensor: mcp9808: clean up I2C API usage
The i2c_msg API details do not work correctly with Nordic TWI.  Switch
to the higher-level and simpler API for register read and write.  Also
add a tree configuration on a Nordic-based board.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-11-13 15:16:54 -06:00
Marcin Niestroj 44841646a1 sensors: lis2dh: use proper scale factor for lsm303agr
LSM303AGR is a special one in terms of raw value scale among all devices
supported by lis2dh.c driver. Apply proper scale factor based on
sensitivity scale provided in LIS2DH and LSM303AGR datasheets.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2019-11-13 14:43:25 -06:00
Marcin Niestroj 59648bd1a5 sensors: lis2dh: fix raw value scaling
All values were scaled by 8 instead of 12 for 16g compile-time selected
range. This resulted with values around 6.5 m/s^2. Scaling for runtime
configurable ranges was broken for all except 2g range option due to
totally broken lis2dh_range_to_reg_val().

Fix wrong scaling for 16g compile-time and all runtime selectable ranges
by reworking code that scales raw value. While doing this, change
lis2dh->scale type from 16 to 32 bits. This allows to slightly increase
final result precision by using the fact that raw values have maximum 12
bits precision, allowing us to multiply lis2dh->scale by (1 << 4)
compared to previous implementation.

Fix bug #19872.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2019-11-13 14:43:25 -06:00
Marcin Niestroj 27b2914da2 sensors: lis2dh: fix raw value to sensor_value conversion
According to struct sensor_value documentation, val2 should be negative
for negative result. So drop code that tries to make val2 positive.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2019-11-13 14:43:25 -06:00
Armando Visconti fdf809d21c driver/sensor: lsm6dso: Fix unchecked return value
Cast to (void) the lsm6dso_mem_bank_set() calls as we
are not interested to the return value.

Coverity-CID: 205625

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-11-12 18:10:07 +01:00
Kevin Townsend 740f6868a5 sensor: hmc5883l: convert to device tree
This commit converts the existing hcm5883l 3-axis magnetometer
driver to use device tree for the I2C and GPIO selection.

It also adds a basic sample application for this sensor, using the
frdm-k64f development board to demonstrate how the interrupt
GPIO pin and I2C bus can be selected.

Signed-off-by: Kevin Townsend <kevin@ktownsend.com>
2019-11-08 12:12:38 -06:00
Kumar Gala 36c94ddd36 sensor: bmc150_magn: Convert to DTS
Convert bmc150_magn sensor driver to utilize device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala 62f5ac1ad4 sensor: bmg160: Convert to DTS
Convert bmg160 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala 7b8b5524be sensor: bmm150: Convert to DTS
Convert bmm150 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala 3700a46632 sensor: hp206c: Convert to DTS
Convert hp206c sensor driver to utilize device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala c2aa25b358 sensor: isl29035: Convert to DTS
Convert isl29035 sensor driver to utilize device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala ddddbf9f84 sensor: max44009: Convert to DTS
Convert max44009 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala 30ea840eb1 sensor: mcp9808: Convert to DTS
Convert mcp9808 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala 03c7cb4f46 sensor: sx9500: Convert to DTS
Convert sx9500 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala c7fae66952 sensor: tmp007: Convert to DTS
Convert tmp007 sensor driver to utilize device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala b388b178a0 sensor: tmp112: Convert to DTS
Convert tmp112 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala 0e9e67297e sensor: th02: Convert to DTS
Convert th02 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Erwan Gouriou 4e8f6f0fe5 sensors: lis3mdl: Fix warning when TIGGER_OWN_THREAD is enabled
No need to cast dev in  k_thread_create.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-11-06 17:10:49 +01:00
Kumar Gala 7185055b38 sensor: lis3mdl-magn: Convert GPIO INT to device tree
Update lis3mdl-magn dts binding to include GPIO interrupt pin and change
driver code to get the GPIO pin and controller info from DT instead of
Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-06 17:10:49 +01:00
Kumar Gala 819276e082 sensor: ccs811: Convert GPIOs to device tree
Update ccs811 dts binding to include GPIO pins for wakeup, reset, and
interrupt and change driver code to get the GPIO pin and controller
info from DT instead of Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-06 11:13:04 +01:00
Armando Visconti 58d5d237b4 driver/sensor: lis2mdl: handle SPI 4-wires mode selection
The LIS2MDL supports SPI half duplex mode with a single data line
by default (3-wire), but it might configured to switch to standard
full duplex mode (4-wire).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-11-05 15:42:00 -06:00
Kumar Gala cd35a4a753 sensor: vl53l0x: Convert GPIO XSHUT to device tree
Update vl53l0x dts binding to include GPIO XSHUT pin and change
driver code to get the GPIO pin and controller info from DT instead of
Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-05 15:07:18 -06:00
Kumar Gala b09b773bb5 sensor: nrf5: Convert name to come from device tree
Update the binding for nordic,nrf-temp to require the label property and
use the generated define (DT_INST_0_NORDIC_NRF_TEMP_LABEL) instead of
Kconfig symbol (CONFIG_TEMP_NRF5_NAME).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-05 19:56:28 +01:00
Marcin Niestroj afa5183ee3 sensors: lis2dh: support disabling SDO/SA0 pull-up during init
Some chips supported by lis2dh driver (such as LIS2DH12 and LIS3DH)
contain CTRL_REG0 (1Eh) register to control internal pull-up on SDO/SA0
line (enabled by default). Add disconnect-sdo-sa0-pull-up boolean
device-tree property to allow disconnecting pull-up during driver
initialization. This allows to save around 180uA at 3.6V in
accelerometer power-down mode.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2019-11-05 19:40:12 +01:00
Marcin Niestroj d3f2878460 sensors: lis2dh: compile lis2dh_reg_field_update() unconditionally
There is little reason to compile lis2dh_reg_field_update() function
conditionally, based on enabled features. If it is not used, then linker
will drop it anyway.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2019-11-05 19:40:12 +01:00
Ulf Magnusson 1f38ea77ba kconfig: Clean up 'config FOO' (two spaces) definitions
Must've been copy-pasted around.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Ulf Magnusson bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Ulf Magnusson 975de21858 kconfig: Global whitespace/consistency cleanup
Clean up space errors and use a consistent style throughout the Kconfig
files. This makes reading the Kconfig files more distraction-free, helps
with grepping, and encourages the same style getting copied around
everywhere (meaning another pass hopefully won't be needed).

Go for the most common style:

 - Indent properties with a single tab, including for choices.

   Properties on choices work exactly the same syntactically as
   properties on symbols, so not sure how the no-indentation thing
   happened.

 - Indent help texts with a tab followed by two spaces

 - Put a space between 'config' and the symbol name, not a tab. This
   also helps when grepping for definitions.

 - Do '# A comment' instead of '#A comment'

I tweaked Kconfiglib a bit to find most of the stuff.

Some help texts were reflowed to 79 columns with 'gq' in Vim as well,
though not all, because I was afraid I'd accidentally mess up
formatting.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-01 15:53:23 +01:00
Jan Van Winkel 0e59f6846f libc: Changed dependencies of NEWLIB_C into !MINIMAL_LIBC
Changed Kconfig dependencies of NEWLIB_C into !MINIMAL_LIBC

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-11-01 14:18:36 +01:00
Peter Bigot f875c3fc48 sensor: lis2dh: support I2C use on Nordic platforms
The default I2C driver on Nordic platforms does not support the I2C
burst operations, so replace those calls with ones that work on the
platform.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-25 11:02:58 -05:00
Ulf Magnusson d5ff890547 sensor: bmg160: Use BMG160_THREAD_PRIORITY instead of ignoring it
The value of BMG160_THREAD_PRIORITY has never been used after the symbol
was added. Use it.

The value defaults to 10 in Kconfig too, so this is a no-op in itself.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-22 14:32:55 -05:00
Ulf Magnusson 677f1e6db9 kconfig: Turn pointless/confusing 'menuconfig's into 'config's
Defining a symbol with 'menuconfig' just tells the menuconfig to display
any dependent symbols that immediately follow it in a separate menu.
'menuconfig' has no effect on symbol values.

Making a symbol that doesn't have any dependent symbols after it a
'menuconfig' should be avoided, because then you end up with an empty
menu, which is shown as e.g.

    [*] Enable foo ---

This is how it would be shown if there were children but they all
happened to be invisible as well.

With a regular 'config', it turns into

    [*] Enable foo

Change all pointless 'menuconfig's to 'config's.

See the section on 'menuconfig' on the Kconfig - Tips and Best Practices
page as well.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-22 13:53:06 -05:00
Alexander Wachter 91818d2c07 drivers: sensors: ens210: fix fractional part calculation
This commit fixes the calculation of the fractional part
for both values.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-10-22 13:48:12 -05:00
Ulf Magnusson 53c688292a drivers: sensor: ens210: Fix broken CONFIG_ENS210_CRC_CHECK checks
The CONFIG_* prefix was missing, making the #ifdefs always false.

Found with a script (CONFIG_ENS210_CRC_CHECK was unused).

Also make ens210_crc7() static. Guessing it's unused outside this file.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-22 09:44:46 -05:00
Ulf Magnusson a9759d2cab drivers: lsm6dsl: kconfig: Remove unused internal pull-up symbol
Added in commit 180b139786 ("drivers: sensor: lsm6dsl: Adding sensorhub
support"), then never used.

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-21 08:20:59 -05:00
Ulf Magnusson 4310babed8 drivers: sensor: lis2mdl: kconfig: Remove unused fixed ODR symbols
After commit 44f373e806 ("driver/sensor: lis2mdl: make use of STdC
definitions"), the code only looks at LIS2MDL_MAG_ODR_RUNTIME, and not
at the LIS2MDL_MAG_ODR_<frequency> symbols.

LIS2MDL_MAG_ODR_RUNTIME is now a yes/no thing in practice, so remove the
choice and turn it into a regular bool symbol.

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-21 08:20:23 -05:00
Peter Bigot 9e473f9fea drivers: sensor: lsm6dsl: correct initialization order
The function that initializes interrupts configures the sensor
register to enable interrupts.  It is called before the function that
resets the sensor.  Swap the order.

Also correct the mask argument to the configuration command, and use
the BIT() macro to construct the set argument.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-17 13:17:02 -05:00
Armando Visconti dc9e297e09 modules/hal_st: Align sensor drivers to stmemsc HAL i/f v1.02
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v1.02.

Requires https://github.com/zephyrproject-rtos/hal_st/pull/3

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-10-17 13:07:50 -05:00
Iosif Macesanu 24508a777d drivers: sensor: Add OPT3001 light sensor driver
Add OPT3001 light sensor driver

Signed-off-by: Iosif Macesanu <iosif@actinius.com>
2019-10-16 14:51:07 -05:00
Iosif Macesanu 884485667d drivers: sensor: Add SI7060 temperature sensor driver
Add SI7060 temperature sensor driver

Signed-off-by: Iosif Macesanu <iosif@actinius.com>
2019-10-16 14:48:12 -05:00
Marcin Niestroj 74fc8fe071 sensor: lis2dh: fix SPI burst transfers
After switching to new SPI API there is no need to reserve first dummy
byte in buffer and ignore that in application later on. Instead two
buffers can be specified, which is how it is done already in lis2dh
driver. The problem is that dummy byte is still part of the buffer, but
it clearly should no longer be. As an example we write 0x7 (bits to
enable XYZ axes) into CTRL2 instead of CTRL1 register. When reading
measurements on the other hand we have filled buffer starting from 0,
instead of 1 as the driver code has expected.

Fix driver in all places that use burst transfers by removing first
dummy byte from input/output buffer.

Fixes: 2f7e6b6d42 ("drivers/sensors: Switch lis2dh driver to new SPI
  API")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2019-10-14 17:16:03 -05:00
Krzysztof Chruscinski ac417abdf0 drivers: sensors: Fix log module registration
All sensors were using legacy log module registeration method
where LOG_LEVEL was defined before registeration. This method
was error prone as it requires preserving includes order.

Replaced with LOG_MODULE_REGISTER(foo, level).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-11 07:33:08 -05:00
Peter Bigot e28f330a8e coccinelle: standardize k_thread create/define calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments
to k_thread_create and K_THREAD_DEFINE to use the standard timeout
macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Peter Bigot 6e5db350b2 coccinelle: standardize k_sleep calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments to
k_sleep to use the standard timeout macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Ioannis Konstantelias 556cf41021 drivers: sensor: Add TMP116
Added driver for TI's TMP116. This driver does not use the Alert
functionality.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-10-04 15:31:56 -05:00
Krzysztof Chruscinski 6700f2f194 drivers: clock_control: nrf: reimplementation including API updates
Reimplementation of clock control driver for nrf platform. It includes
latest API changes: asynchronous starting and getting clock status.

Additionally, it implements calibration algorithm which optionally
skips calibration based on no temperature change. Internal temperature
sensor is used for that.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-04 17:15:39 +02:00
Peter Bigot ab91eef23b coccinelle: standardize kernel API timeout arguments
Use the int_literal_to_timeout Coccinelle script to convert literal
integer arguments for kernel API timeout parameters to the standard
timeout value representations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-03 11:55:44 -07:00
Armando Visconti 82b9172718 driver/sensor: lis2mdl: remove sensitivity
LIS2MDL sensor has a fixed sensitivity equal to 1500 uGauss/LSB.
So, use a constant value directly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-09-26 13:42:59 -07:00
Armando Visconti 44f373e806 driver/sensor: lis2mdl: make use of STdC definitions
Port the lis2mdl sensor driver on top of the lis2mdl_StdC
HAL interface (in modules/hal/st/sensor/stmemsc/).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-09-26 13:42:59 -07:00
Armando Visconti a34a5885b8 driver/sensor: lis2mdl: change order of operations in trigger init
Creation of callback thread is moved before the enabling of
the callback itself.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-09-26 13:42:59 -07:00
Armando Visconti 89199dcbaf driver/sensor: lis2mdl: Fix the temperature fractional value
The temperature fractional value has to be assigned multiplied
by 10^6.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-09-26 13:42:59 -07:00
Andrzej Głąbek c24c463328 soc: nordic: Include <nrfx.h> instead of <nrf.h> from <soc.h>
This change is done so that there is no need to additionaly include
<nrfx.h> before <soc/nrfx_coredep.h> (what might be a bit surprising)
and so that <nrfx_config.h> doesn't need to be include separately for
nRF SoCs requiring a special mapping of peripheral accessing symbols.

This commit removes also no longer needed inclusions and updates
the hal_nordic module with required minor correction of nrfx_glue.h.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-09-24 16:20:16 +02:00
Andrzej Głąbek 57c6cfc9cd nordic: Use hal/ in all inclusions of nrfx HAL header files
Header files of nrfx HALs are not supposed to be included directly
but only with their names prepended with the hal/ directory (so that
an inclusion of an nrfx HAL header clearly differs from an inclusion
of an nrfx driver header).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-09-24 16:20:16 +02:00
Peter Bigot d566254e3f drivers: fix k_thread_create timeout argument
Use the named representation for no-wait to future-proof against a
change to the representation of timeout values.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-09-19 17:35:53 +02:00
Armando Visconti c79925bd0f driver/sensor: IIS3DHHC: Fix DT_ macro typo for CS GPIO
The correct suffix name for selecting the GPIO for SPI Chip Select
is _CS_GPIOS_CONTROLLER and not _CS_GPIO_CONTROLLER.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-09-19 09:47:45 -05:00
Michał Oleszczyk 2663f71c6a drivers/sensor: lis2dw12: fix for wrong gpio_callback handling
It seems that gpio_pin_disable_callback() has never been working
for that sensor as it was expected. We used there argument 'dev'
as its own (lis2dw12) device pointer. While this argument is a
gpio_port device pointer not lis2dw12 sensor device pointer. So
cfg->int_gpio_pin always tries to disable callback for some random
pin read from accidental data sector.

Signed-off-by: Michał Oleszczyk <oleszczyk.m@gmail.com>
2019-09-19 08:04:05 -05:00
Michał Oleszczyk da4d00ee0a drivers/sensor: sht3xd: implement single shot mode
For now there is only periodic data acquisition mode implemented.
This mode is quite power consuming. Based on datasheet in idle
state in periodic data acquisition mode SHT3X consumes 45uA but
in single shot mode 0.2uA. For many applications where power
consumption has to be kept as low as possible single shot mode
is the only choice. Tester on custom board NRF52832 + SHT31-DIS.

Signed-off-by: Michał Oleszczyk <oleszczyk.m@gmail.com>
2019-09-18 18:03:32 -05:00
Johann Fischer feef83d864 drivers: amg88xx: rework sensor driver to use DT
Rework sensor driver to use DT.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-09-17 06:27:21 -05:00
Armando Visconti 871d132577 driver/sensor: add IIS3DHHC accelerometer sensor
Add support to STM IIS3DHHC the ultra-low noise, high-stability
three-axis linear accelerometer.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-09-16 14:07:56 -05:00
Kumar Gala c17297c18a drivers: ens210: Fix error in header guard
Looks like some copy/paste bug snuck in.  Fix the include header guard
to define the proper name.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-12 22:04:55 -05:00
Erwan Gouriou 21d39eff6c dts/Kconfig: Remove symbol HAS_DTS_QDEC.
Symbol not used, so clean it up.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-09-12 08:16:42 -05:00
Erwan Gouriou 555936f771 dts/Kconfig: Remove unused HAS_DTS_SPI
Symbol is always "and'ed" with the symbol that
selects it, so no effect. Clean it up.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-09-12 08:16:42 -05:00
Armando Visconti b7944510a4 dts/bindings: sensors: remove '-magn' extension from lis2mdl name
The LIS2MDL is not a combo device, but pure magnotemeter.
Hence, '-magn' extension is not adding information and can
be removed from dts compatible name as well as binding filename.

Instead specify '-i2c' or '-spi' to distinguish between the names.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-09-12 07:58:34 -05:00
Andy Ross 075c94f6e2 kernel: Port remaining syscalls to new API
These calls are not accessible in CI test, nor do they get built on
common platforms (in at least one case I found a typo which proved the
code was truly unused).  These changes are blind, so live in a
separate commit.  But the nature of the port is mechanical, all other
syscalls in the system work fine, and any errors should be easily
corrected.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-12 11:31:50 +08:00
Michał Oleszczyk e4ed17472f driver/sensor: lis2dw12: single/double tap trigger implementation
Implementation for two new interrupt triggers: single tap and
double tap. Add new Kconfig options to configure those triggers:
trigger mode (single/single and double), latency/quiet/shock time,
threshold levels, active axes.

Signed-off-by: Michał Oleszczyk <oleszczyk.m@gmail.com>
2019-09-09 10:52:57 -05:00
Vaishali Pathak 0923ae4172 drivers: sensors: Add Si7006 temperature/humidity sensor driver
Adds driver for Silicon Labs Si7006 chip.

Signed-off-by: Vaishali Pathak <vaishali@electronut.in>
2019-08-06 15:05:25 -05:00
Armando Visconti 6dceb4987e driver/sensor/lsm6dso: Fix deprecated macros CS_GPIO_* to CS_GPIOS_*
The lsm6dso driver was in pre-merging state when a614a026
was committed. So, let's make the modification manually.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-08-06 11:09:34 -04:00
Armando Visconti 9e5c97edae driver/sensor: add STTS751 temperature sensor
Add support to STM STTS751 temperature sensor.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-07-31 10:32:10 -04:00
Marcin Niestroj 710f9e7b3e sensors: lis2dh: support high resolution mode
So far we supported normal (10 bit) and low-power (8 bit) modes. Add
support for high-resolution mode as a third option.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2019-07-23 10:52:08 +02:00
Kumar Gala c016cd2c4e sensor: lis2dh: Fix stray use of old DT define
Convert old DT_ST_LIS2DH_0_BUS_SPI to DT_ST_LIS2DH_BUS_SPI.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-10 10:25:21 -05:00
Armando Visconti 72ae24d8d5 driver/sensor: lsm6dso: Add support
Add support to STM LSM6DSO 6-axis IMU sensor driver.
This driver supports communication with device though both
I2C and SPI bus and both polling and drdy trigger mode.

This driver supports also the sensorhub mode with the possibility
to connect a maximum of two external devices, typically a
magnetometer and an environmental sensor, currently selected among
following devices: lis2mdl magnetometer, lps22hh or lps22hb
pressure and temperature sensors, HTS221 humidity sensor.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-07-03 12:17:43 -05:00
Armando Visconti 9dbdd81abe driver/sensor: add LPS22HH sensor support
Add support to STM LPS22HH pressure and temperature sensor.
The driver support I2C and SPI bus communication and both
polling and drdy trigger mode.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-07-03 11:59:17 -05:00
Andy Ross 17051e42d6 drivers/sensor/hp206c: Clarify tick rate warning
The default tick rate is now 10 kHz, but that driver was demanding
that it be exactly 1 kHz instead of at least that rate.  I checked the
source, and the driver isn't actually extracting "ticks" from the
kernel illegally, it just needs fine-grained timers that work with the
existing millisecond API.  Let it build, this is fine.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Krzysztof Chruscinski f1b349aa72 drivers: sensor: temp_nrf5: Code cleanup
Reworked nrf5 internal temperature sensor driver to use hal

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-07-02 15:54:25 -04:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 5d001f3e41 cleanup: include/: move misc/byteorder.h to sys/byteorder.h
move misc/byteorder.h to sys/byteorder.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 5eb90ec169 cleanup: include/: move misc/__assert.h to sys/__assert.h
move misc/__assert.h to sys/__assert.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif d1b2718687 cleanup: include/: move uart.h to drivers/uart.h
move uart.h to drivers/uart.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif bd70f6f1ed cleanup: include/: move spi.h to drivers/spi.h
move spi.h to drivers/spi.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 8c1f89fa99 cleanup: include/: move sensor.h to drivers/sensor.h
move sensor.h to drivers/sensor.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 8f692c7d38 cleanup: include/: move i2c.h to drivers/i2c.h
move i2c.h to drivers/i2c.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 6aa9c3a68f cleanup: include/: move gpio.h to drivers/gpio.h
move gpio.h to drivers/gpio.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 17ddd1714c cleanup: include/: move clock_control.h to drivers/clock_control.h
move clock_control.h to drivers/clock_control.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif f4709f2c2f cleanup: include/: move adc.h to drivers/adc.h
move adc.h to drivers/adc.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Kumar Gala a614a026b7 dts: Rename DT_.*_GPIO_* to DT_.*_GPIOS_*
Convert DT_.*_GPIO_{CONTROLLER,PIN,FLAGS} ->
	DT_.*_GPIOS_{CONTROLLER,PIN,FLAGS)

Used the following commands to make these conversions:

git grep -l DT_.*_GPIO_CONTROLLER | xargs sed -i 's/DT_\(.*\)_GPIO_CONTROLLER/DT_\1_GPIOS_CONTROLLER/g'
git grep -l DT_.*_GPIO_PIN | xargs sed -i 's/DT_\(.*\)_GPIO_PIN/DT_\1_GPIOS_PIN/g'
git grep -l DT_.*_GPIO_FLAGS | xargs sed -i 's/DT_\(.*\)_GPIO_FLAGS/DT_\1_GPIOS_FLAGS/g'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-27 13:02:34 -05:00
Robert Lubos 7bf0124adf drivers: sensor: Update DT symbols in qdec_nrfx driver
Currently used IRQ DT symbols became deprecated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-06-27 07:16:33 -04:00
Armando Visconti ab4f280661 driver/sensor: lis2dw12: make use of STdC definitions
Port the lis2dw12 sensor driver on top of the lis2dw12_StdC
HAL interface (in modules/hal/st/sensor/stmemsc/).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-06-26 15:41:40 -04:00
Kumar Gala 0a99f53c80 sensor: lis2dh: Use general DT_<COMPAT>_BUS_<BUS> define.
Match what other drivers are doing and use the general BUS define.
Change DT_ST_LIS2DH_0_BUS_SPI to DT_ST_LIS2DH_BUS_SPI

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-24 07:28:19 -05:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Kumar Gala a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 08:02:15 -05:00
Nikos Oikonomou 8617df1e64 sensors: ti_hdc simplified ti_hdc_channel_get
Removed unneeded second temporary variable, used for humidity conversion

Signed-off-by: Nikos Oikonomou <nikoikonomou92@gmail.com>
2019-06-11 10:17:11 -05:00
Nikos Oikonomou e7dbc1d770 sensors: ti_hdc now supports 1050 versions
TI_HDC Driver now also supports the 1050 (e.g. hdc1050, hdc1080) temp/rh
sensor versions.

Signed-off-by: Nikos Oikonomou <nikoikonomou92@gmail.com>
2019-06-11 10:17:11 -05:00
Nikos Oikonomou 080e71c908 sensors: ti_hdc driver wait conversion support
TI_HDC Driver now also supports waiting for conversion to finish instead
of waiting for GPIO interrupt.

Signed-off-by: Nikos Oikonomou <nikoikonomou92@gmail.com>
2019-06-11 10:17:11 -05:00
Nikos Oikonomou 4a38cae2af sensors: renamed hdc1008 driver into ti_hdc
Hdc1008 driver is renamed into ti_hdc to prepare it to support all
available Texas Instruments HDC sensors (e.g. hdc1080, hdc2080).

Signed-off-by: Nikos Oikonomou <nikoikonomou92@gmail.com>
2019-06-11 10:17:11 -05:00
Anas Nashif 4c32258606 style: add braces around if/while statements
Per guidelines, all statements should have braces around them. We do not
have a CI check for this, so a few went in unnoticed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-06 15:20:21 +02:00
Johann Fischer 2204193bdb drivers: apds9960: allow additional LED current configuration
Allow additional proximity LED current configuration.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-06-05 07:48:58 -05:00
Johann Fischer df3796a724 drivers: apds9960: make proximity pulse length configurable
Make proximity pulse length and pulse count configurable.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-06-05 07:48:58 -05:00
Johann Fischer 67ae508459 drivers: apds9960: make ALS and proximity gain configurable
Make ALS and proximity gain configurable.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-06-05 07:48:58 -05:00
Johann Fischer 3bbd102844 drivers: apds9960: allow to disable Ambient Light Sense
Allow to disable Ambient Light Sense (ALS) if measurement is
not necessary.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-06-05 07:48:58 -05:00
Bosch Sensortec b05d5ffc46 driver: sensor: bme680 added support
Added support for the BME680 environmental sensor

Signed-off-by: Bosch Sensortec <github@bosch-sensortec.com>
2019-05-31 10:27:13 -05:00
Brett Witherspoon 626349f16f drivers: adxl362: use burst transfer
It is recommended that multibyte (burst) transfers are used to read
acceleration and temperature data. This ensures the data is concurrent
and complete.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-23 06:55:38 -05:00
Brett Witherspoon 1becd75604 drivers: adxl362: rework temperature conversion
This commit consolidates the temperature conversion into a single
location and subtracts the bias from the measurement using values from
the datasheet. Also magic numbers have been replaced with more
descriptive macros.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-21 14:26:31 -05:00
Brett Witherspoon 935efeb0ce drivers: adxl362: fix acceleration sample conversion
This driver uses magic numbers which are incorrect. A correct conversion
is done using the LSB/g scale factors given by Table 1 in the
specifications section of the ADXL362 (Rev. F) datasheet. The entire
conversion has also been consolidated into a signal function.

The sensitivity and offset of the accelerometer values actually vary
with the supply voltage and temperature. Using datasheet provided values
for 25 C and 2.0 V is the best we can do. Users will need to apply
sensitivity and offset corrections for their application.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-21 14:26:31 -05:00
Brett Witherspoon 4cc486ec4f drivers: adxl362: fix control flow issue
The return code check and error return on the interrupt register
configuration function call should be included in the #if defined
region.

Fixes #16159

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-21 14:20:42 -05:00
Brett Witherspoon a5327b0003 drivers: adxl362: clear status independently and before mapping
Clear status bits before mapping them to the interrupt pin, so the
interrupt will occur on the next event instead of a pending event. Also
the status bits are cleared independently, because the threshold and
data ready functions can be enabled simultaneously.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-13 09:53:04 -05:00
Brett Witherspoon ed474e88bd drivers: adxl362: check interrupt status
Check the status and only execute the callback if the event has
occurred.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-13 09:53:04 -05:00
Brett Witherspoon 0e9257018c drivers: adxl362: don't disable callbacks
Enabling and disabling the GPIO callbacks is error prone and unnecessary
since the trigger data is protected with a mutex, so it has been
removed. This resolves the following issues:

- The GPIO callbacks are not being re-enabled properly in the error path
  of the trigger setting function.

- The device pointer used in the GPIO callback to retrieve the ADXL362
  driver configuration data is the GPIO device not the ADXL362 device,
  so this cast is invalid and the int_gpio field is garbage.

- There are potential timing issues between enabling interrupts and
  re-enabling the callbacks.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-13 09:53:04 -05:00
Brett Witherspoon cddb3a1e34 drivers: adxl362: use Kconfig for interrupt mode
Commit 11295c1 added Kconfig options for interrupt mode, but then hard
coded the interrupt mode. This commit uses the Kconfig option to set
the interrupt mode.

Applications expecting the interrupt mode to be something other than
the default will need to be updated.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-08 12:00:17 -05:00
Brett Witherspoon ae9905232c drivers: adxl362: don't skip mutex unlocking in error path
The default case of the switch statement jumps over the unlocking of the
trigger mutex. This has been fixed with more granular locking which has
the added benefit of being more explicit about what is being protected.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-08 11:58:07 -05:00
Brett Witherspoon bfea453693 drivers: adxl362: use logger API
Use logger API instead of printk.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-04 09:54:26 -04:00
Henrik Malvik Halvorsen 11295c190b drivers: sensor: Add ADXL362 interrupt handling
The ADXL362 driver is expanded to support interrupt handling.

Signed-off-by: Henrik Malvik Halvorsen <henrik.halvorsen@nordicsemi.no>
2019-05-03 09:11:51 -05:00
Alexander Wachter f29ec12f21 drivers: sensor: ens210: Implement AMS ens210 Sensor
Implementation of AMS (Austria Micro Systems) ENS210 temperature and
relative humidity sensor.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-04-19 08:37:17 -05:00
Alexander Wachter 3c70a3832d drivers: sensor: ams_iAQcore: Implemented ASM Indoor Air Quality Sensor
Implementation of AMS (Austria Micro Systems) Indoor Air Quality Sensor

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-04-19 08:37:17 -05:00
Henrik Brix Andersen 917cb432ee sensor: fxos8700: add support for hardware reset pin
Add support for pulsing the hardware reset pin of the FXOS8700 high
during initialization.

According to the datasheet, this is required for the I2C/SPI bus
auto-detection logic to work properly if the VDD/VDDIO power
sequencing order cannot be guaranteed.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2019-04-18 09:22:56 -04:00
William Fish 1e5e8829c7 drivers: sensor: APDS9660 WhoAmI check logic
APDS9660 sensor driver missing WhoAmI check

signed-off-by: William Fish <william.fish@manulytica.com>
2019-04-18 09:15:56 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Patrik Flykt 21358baa72 all: Update unsigend 'U' suffix due to multiplication
As the multiplication rule is updated, new unsigned suffixes
are added in the code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Maureen Helm 0cff42fe9d drivers: sensor: Refactor apds9960 to use const config struct
Refactors the apds9960 sensor driver to get the i2c device name, i2c
device address, gpio device name, and gpio pin from a constant device
configuration structure, rather than using hardcoded macros. This will
make it easier to change the names of the macros and to instantiate
multiple instances of the driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-03-15 10:30:53 -05:00
Henrik Malvik Halvorsen 627fdd67f3 drivers: sensor: ADXL362 data conversion fix
The ADXL362 sensor data is converted to the expected
output, m/s^2.

Signed-off-by: Henrik Malvik Halvorsen <henrik.halvorsen@nordicsemi.no>
2019-03-15 09:25:58 -05:00
Henrik Malvik Halvorsen 64fd822652 drivers: sensor: adxl362: Driver update and CS support
Updated to add support for CS. DT config names updated
to adhere to the DTS naming convention. Init and SPI
configuration now follows the device datasheet.

Signed-off-by: Henrik Malvik Halvorsen <henrik.halvorsen@nordicsemi.no>
2019-03-15 07:39:05 -05:00
Ramakrishna Pallala e1639b5345 device: Extend device_set_power_state API to support async requests
The existing device_set_power_state() API works only in synchronous
mode and this is not desirable for devices(ex: Gyro) which take
longer time (few 100 mSec) to suspend/resume.

To support async mode, a new callback argument is added to the API.
The device drivers can asynchronously suspend/resume and call the
callback function upon completion of the async request.

This commit adds the missing callback parameter to all the drivers
to make it compliant with the new API.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2019-03-14 14:26:15 +01:00
Ulf Magnusson 53376394b7 kconfig: Remove blank lines at the beginning/end of files
Maybe this is some "just in case" thing that got copied around. There's
no need to have a blank line at the beginning or end of Kconfig files.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-13 07:29:42 -05:00
Gaute Gamnes 6af7856a66 drivers: nrf5: temp: Cleanup temp_nrf5.c source
1. Remove nrf_common.h include
2. Remove unnecessary NRF_*Type defines, using
   CMSIS NRF_TEMP define directly instead.
3. Align driver code by including DEVICE_DECLARE,
   and moving DEVICE_AND_API_INIT() to the bottom.

Signed-off-by: Gaute Gamnes <gaute.gamnes@nordicsemi.no>
2019-03-12 13:33:36 +01:00
Gaute Gamnes f4f98981d7 drivers: nrf5: temp: Migrate Kconfig priority option to DT
1. Kconfig options priority setting removed.
2. Modified temp_nrf5.c driver to use DT
   defines instead of Kconfig.

Signed-off-by: Gaute Gamnes <gaute.gamnes@nordicsemi.no>
2019-03-12 13:33:36 +01:00
Armando Visconti 599bda3745 driver/sensor: lis2mdl: (FIX) change 'uint32_t' type into 'u32_t'
In zephyr drivers should always use u32_t.
Using uint32_t here generates issues in the CI when NEWLIB_LIBC
is defined.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-03-11 22:06:37 -07:00
Patrik Flykt 4344e27c26 all: Update reserved function names
Update reserved function names starting with one underscore, replacing
them as follows:
   '_k_' with 'z_'
   '_K_' with 'Z_'
   '_handler_' with 'z_handl_'
   '_Cstart' with 'z_cstart'
   '_Swap' with 'z_swap'

This renaming is done on both global and those static function names
in kernel/include and include/. Other static function names in kernel/
are renamed by removing the leading underscore. Other function names
not starting with any prefix listed above are renamed starting with
a 'z_' or 'Z_' prefix.

Function names starting with two or three leading underscores are not
automatcally renamed since these names will collide with the variants
with two or three leading underscores.

Various generator scripts have also been updated as well as perf,
linker and usb files. These are
   drivers/serial/uart_handlers.c
   include/linker/kobject-text.ld
   kernel/include/syscall_handler.h
   scripts/gen_kobject_list.py
   scripts/gen_syscall_header.py

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-11 13:48:42 -04:00
Ulf Magnusson e3ce7a62a4 kconfig: drivers: sensor: Remove redundant dependencies
Most of these are from 'source'ing drivers/sensor/grove/Kconfig within
an 'if SENSOR' (in drivers/sensor/Kconfig), and then adding another 'if
SENSOR' within it.

'if FOO' is just shorthand for adding 'depends on FOO' to each item
within the 'if'. Dependencies on menus work similarly. There are no
"conditional includes" in Kconfig, so 'if FOO' has no special meaning
around a source. Conditional includes wouldn't be possible, because an
if condition could include (directly or indirectly) forward references
to symbols not defined yet.

Tip: When adding a symbol, check its dependencies in the menuconfig
('ninja menuconfig', then / to jump to the symbol). The menuconfig also
shows how the file with the symbol got included, so if you see
duplicated dependencies, it's easy to hunt down where they come from.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-09 09:57:44 -05:00
Piotr Zięcik d30c9aeafd drivers: nrf_power_clock: Migrate to DTS.
This commit migrates the nrf_power_clock driver to DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-25 17:51:24 +01:00
Erwan Gouriou c55c188e68 drivers/sensor/vl53l0x: Remove unnecessary lib include check
vl53l0x driver is using an external library to build, located under:
ext/hal/st/lib/sensor/vl53l0x.
This library is expecting stdint.h lib to be available and to
secure this for driver library inclusion work, a stdint.h file
header check was done. This check was based on assumptions on possible
header names for stdint.h.
Due to recent renaming of the zephyr header files, this check was
returning a false positive, generating warning at compilation.

Rather than updated with new header names, remove this check, since
driver porting is completed and stdint.h inclusion is actually
done.

Fixes #10134

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-19 07:48:10 -06:00
Johann Fischer 70776028f5 drivers: apds9960: fix ALS in non-trigger mode
Generate interrupt on every ALS cycle in non-trigger mode
and enable ALS saturation interrupt.

resolves: #11989

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-02-13 22:10:21 -06:00
Armando Visconti 208f565bce driver/sensor: add LIS2DW12 sensor support
Add support to STM LIS2DW12 3-axis accelerometer driver.
The driver support I2C and SPI bus communication and both
polling and drdy trigger mode.

Co-authored-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-08 15:22:42 -06:00
Peter A. Bigot aa684363f0 drivers: sht3xd: update to new I2C API
Use the new i2c_write_read() wrapper to simplify the code.

Also add several overlays used to test the sensor on a variety of
boards, and conf file support for trigger testing.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:04:28 -05:00
Kumar Gala 4520237ef5 sensors: adxl372: Fixup SPI CS handling
Replace undefined Kconfig SPI CS defines with DTS based defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-06 14:01:51 -06:00
Kumar Gala 2d90772244 sensor: lis2ds12: Fixup SPI CS handling
Replace undefined Kconfig SPI CS defines with DTS based defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-04 08:17:08 -06:00
Armando Visconti 37e77f942a driver/sensor: lps25hb: align driver to auto-generated dts macros
Use auto-generated device tree macros in LPS25HB driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-01 04:19:42 -06:00
Armando Visconti 396ffbd86d driver/sensor: lsm6ds0: align driver to auto-generated dts macros
Use auto-generated device tree macros in LSM6DS0 driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-01 04:19:42 -06:00
Kumar Gala e0349fb421 sensor: lsm6dsl: Fixup SPI CS handling
Replace undefined Kconfig SPI CS defines with DTS based defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 04:11:23 -06:00
Kumar Gala 13fd996178 sensor: lsm9ds0: Remove unused define/Kconfig symbol
We use DT to get the I2C address, so the define that got it from a
Kconfig sybmol isn't used and the Kconfig symbol isnt defined.  Remove
this dead code.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-31 09:10:29 -06:00
Kumar Gala 1d210dc2d8 sensor: adxl372: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert adxl372 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 17:51:25 -06:00
Kumar Gala 8de6778e90 sensor: lis2dh: Fix gcc8 compiler warning
We get the following warning with sdk-ng:

	drivers/sensor/lis2dh/lis2dh.c:210:38: error: bitwise comparison
	always evaluates to false [-Werror=tautological-compare]

	if ((value & LIS2DH_LP_EN_BIT_MASK) == 1 && ...
                                      ^~
The test needs to be:
	(value & LIS2DH_LP_EN_BIT_MASK) == LIS2DH_LP_EN_BIT_MASK

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 17:19:41 -06:00
Kumar Gala 4f334970ad sensor: adt7420: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert adt7420 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 08:08:03 -06:00
Kumar Gala cdc1b1f103 sensor: ccs811: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert ccs811 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 02:53:35 -06:00
Kumar Gala d7b7dbd910 sensor: apds9960: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert apds9960 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 16:03:21 -06:00
Kumar Gala 1300f5bd9e sensor: ms5837: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert ms5837 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 15:26:28 -06:00
Peter A. Bigot 5147ab74da drivers: sensors: hts221: move static definition out of header
This belongs in the implementation file that references the array, since
the header is included in multiple files.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-29 17:50:02 +01:00
Peter A. Bigot 4cd19eaeee drivers: sensor: hts221: correct bit for CTRL_REG1.BDU
Setting bit 3 instead of bit 2 modifies a reserved section of the
register, with the impact that the ODR is not as configured.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-29 17:50:02 +01:00
Peter A. Bigot 9f15116fd7 drivers: sensor: hts221: correct default log configuration
Incorrect symbol used for default.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-29 17:50:02 +01:00
Armando Visconti 42c7e8873c driver/sensor: lis3mdl: align driver to auto-generated dts macros
Use auto-generated device tree macros in LIS3MDL driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Armando Visconti a3ae11f897 driver/sensor: lis2mdl: align driver to auto-generated dts macros
Use auto-generated device tree macros in LIS2MDL driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Armando Visconti 5ad0d27bd1 driver/sensor: lsm6dsl: Fix attribute setting for gyroscope fs
The API for setting the gyroscope full scale attruibute requires
the argument in radians/s.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Armando Visconti c81efe25d5 driver/sensor: lsm6dsl: align driver to auto-generated dts macros
Use auto-generated device tree macros in LSM6DSL driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Johann Fischer 65087aa99e drivers: hdc1008: add macros for manufacturer and device IDs
Add macros for HDC1008 manufacturer and device IDs.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-01-26 12:08:52 -05:00
Johann Fischer f36fe23e65 sensor: hdc1008: convert to DT_<COMPAT>_<INSTANCE> defines
Convert hdc1008 sensor driver to use new defines.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-01-26 12:08:52 -05:00
Armando Visconti 797ecde958 sensor/lis2mdl: use kconfig named choice for TRIGGER_MODE
Use Kconfig named choice for TRIGGER_MODE in order to easy
up the trigger mode selection in default configurations
for boards using this sensor driver.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 09:38:08 -06:00
Armando Visconti 3ab122d293 driver: sensor: lps22hb: fix the temp sensor fractional value
Fix the temperature sensor fractional value.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 09:38:08 -06:00
Armando Visconti aca8ae3fd4 driver/sensor: use lis2dh as common driver among multiple sensors
Share lis2dh driver among few accelerometer sensors that has
same register interface: LIS2DH, LIS3DH, LSM303DLHC, LIS2DH12,
LSM303AGR.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 07:26:16 -06:00
Armando Visconti e35f36966b driver/sensor: lis2dh: align driver to auto-generated dts macros
Use auto-generated device tree macros in LIS2DH driver to avoid
usage of dts.fixup files. The triggered interrupt part has been
slightly hacked to automatically understand whether only int1 is
configured or both int1 and int2.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 07:26:16 -06:00
Armando Visconti fdce786c07 driver/sensor: add LIS2DS12 sensor support
Add support to STM LIS2DS12 3-axis accelerometer driver.
The driver support I2C and SPI bus communication and both
polling and drdy trigger mode.
Currently it uses high resolution only as power mode.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-22 08:48:40 -06:00
Kumar Gala affc1ed253 sensor: bmi160: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert bmi160 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 12:53:53 -06:00
Kumar Gala 31dad5b411 sensor: vl53l0x: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert vl53l0x sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 12:52:14 -06:00
Kumar Gala 957c3009a6 sensor: max30101: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert max30101 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 12:50:12 -06:00
Peter A. Bigot 12836d9280 drivers: sensors: sht3xd: support multiple devices and DT bindings
Add a configuration structure to sht3xd that holds instance-specific
parameters, implemented in a immutable statically allocated object
initialized with material from device tree binding aliases.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-18 09:43:14 -06:00
Peter A. Bigot ec6509504d drivers: sensors: sht3xd: uncrustify
Run this through the code formatter.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-18 09:43:14 -06:00
Peter A. Bigot 98cc93952d drivers: sensors: sht3xd: move object definitions out of header
These belong in the driver implementation file.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-18 09:43:14 -06:00
Kumar Gala 7b9bf08dce sensor: lps22hb: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert lps22hb sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 09:38:31 -06:00
Kumar Gala 8f04f81e97 sensor: fxas21002: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert fxas21002 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 08:54:31 -06:00
Kumar Gala 5431762769 sensor: fxos8700: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert fxos8700 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 13:29:46 -06:00
Kumar Gala 689ad43b62 sensor: hts221: Move GPIO to device tree
Move how we configure the DRDY gpio line to device tree from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 11:06:38 -06:00
Kumar Gala c77a322c6e sensors: hts221: Get I2C address from device tree
Change driver to get I2C address of sensor from the device tree like
most other sensor drivers that utilize device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 11:06:38 -06:00
Kumar Gala a5e8921de9 sensors: hts221: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert hts221 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 11:06:38 -06:00
Kumar Gala efd31af624 sensors: lsm303dlhc: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert lsm303dlhc_accel & lsm303dlhc_magn sensor driver to use new
defines so we can remove the dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-16 21:33:16 -05:00
Kumar Gala be2b6f870d sensor: bme280: Converting to using device tree
Convert the BME280 driver to use device tree and new DT_<COMPAT>
defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-16 12:39:37 -06:00
Armando Visconti 16891af7a7 drivers/sensor: lis2dh: Fix LP Enable bit mask
Fix the value for Low Power Enable (LP_EN) bit mask.
(Issue described by Coverity CID #188734)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-16 12:27:05 -06:00
Varun Sharma 77c643a5a3 drivers: Modify drivers to use DEVICE_AND_API_INIT()
Modified drivers to use DEVICE_AND_API_INIT() instead of DEVICE_INIT()

This will make sure driver_api,is populated at build time and is exposed
to user space

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
2019-01-15 10:39:34 -08:00
Ioannis Glaropoulos 302a746bd6 drivers: clock control: nrf: rename CLOCK_CONTROL_NRF5 Kconfig symbol
This commit renames the CLOCK_CONTROL_NRF5 Kconfig symbol to
CLOCK_CONTROL_NRF. The change is required to aleviates confusion
when selecting the symbol in nRF9160 SOC definition.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-01-15 18:03:24 +01:00
Armando Visconti f300dedcc1 drivers/sensor/lsm6dsl: Use DT defines to select I2C/SPI bus
Remove configuration parameter CONFIG_BUS_TYPE. Now we may
make use of DT_ST_LSM6DSL_BUS_I2C and DT_ST_LSM6DSL_BUS_SPI
definition to select the bus.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-08 09:15:51 -06:00
Armando Visconti b75a05cae6 driver: sensors: convert lsm9ds0_gyro to use information coming from dts
Convert lsm9ds0_gyro driver to get the device name as well as
i2c slave information and gpio info for triggers from device tree.
Updates the build_all test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-20 12:35:46 +01:00
Dhananjay Gundapu Jayakrishnan bfe0c2e748 drivers: sensor: temp_nrf5: update assert condition in nRF temp sensor
nRF 16MHz clock is used by both BLE radio and temperature sensor.
During BLE connection if the temperature sensor is also used then
at some point assert condition is hit in temp_nrf5_sample_fetch().
The error code -EBUSY seen during clock_control_off() is that clock
is no longer needed for the temperature sensor, but it cannot be
just turned off because it is still needed for BLE connection.

Signed-off-by: Dhananjay Gundapu Jayakrishnan <dhananjay.jayakrishnan@proglove.de>
2018-12-19 09:03:47 -06:00
Armando Visconti 4446b16e24 driver: sensors: convert lsm9ds0_mfd to use information coming from dts
Convert lsm9ds0_mfd accel/magn driver to get the device name as well
as i2c slave information from device tree. Updates the build_all
test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-19 07:31:18 -06:00
Armando Visconti 6e2a1b62c4 drivers: lsm9ds0_mfd: Fix typo in get accel/magn channels
Fixed channel type in get accel/magn channel routines,
where, by mistake, GYRO definitions were used instead of
ACCEL/MAGN ones.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-19 07:31:18 -06:00
Armando Visconti ec47b7cd7d sensors: convert lis2mdl to use information coming from dts
Convert lis2mdl magnetometer driver to get the device name as well
as i2c slave information from device tree. Updates the build_all
test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-11 08:11:11 -06:00
Armando Visconti e721b498ce drivers/lis3dh: Add symbol to TRIGGER_MODE config choice
Add symbolic names to trigger mode (LIS3DH_TRIGGER_MODE) in order to
be defined in board defconfig files.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-07 10:43:13 -05:00
Armando Visconti 7dbbb07f07 sensors: convert lis3dh to use information coming from dts
Convert lis3dh accelerometer driver to get the device name as well
as i2c slave information from device tree. Updates the build_all
test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-07 10:43:13 -05:00
Armando Visconti 802ad61aba drivers: sensors: lis2dh: Fix out-of-bound access
FIX issue #10571 and #10593
atomic_xxx() functions expect the bit argument to be the
position index inside the target integer and not its
numerical representation (e. g. 5 means the 5th bit and not 32).
The original code could potentially override an adiacent variable.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-05 10:38:38 -08:00
Patrik Flykt 8ff96b5a57 drivers: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Jan Van Winkel 55f091f43f i2c: sensor: Replace static_assert by BUILD_ASSERT_MSG
Replace static_assert in NRFX TWI, TWIM and QDEC drivers by
BUILD_ASSERT_MSG

fixes: #11754

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-01 18:37:16 +01:00
Peter A. Bigot be624d8e51 drivers: sensor: sht3xd: change from level to double edge trigger
The sensor signal cannot be cleared by the application, so enabling
level triggers causes the system to hang as the callback is invoked
repeatedly.  We want notification when the alarm state is entered, and
when it's exited, so use a double edge.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-11-30 08:30:13 -08:00
Peter A. Bigot 5313d4fb51 drivers: sensor: sht3xd: migrate GPIO from Kconfig to device tree
Replace Kconfig ALERT signal GPIO device and pin information with device
tree bindings.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-11-30 08:30:13 -08:00