Commit graph

777 commits

Author SHA1 Message Date
Peter Bigot 6afbd053e4 drivers: sensor: isl29035: update to new GPIO API
Document alert pin behavior, switch to new API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Johann Fischer 664a1cf0db drivers: amg88xx: convert to new GPIO API
Convert AMG88XX sensor driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Johann Fischer afe53230b3 drivers: ti_hdc: convert to new GPIO API
Convert TI HDC sensor driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Kevin Townsend f800c7266e drivers: hmc5883l: update to new GPIO API
This commit updates the HMC5883L driver to use the new GPIO API.

Also add a note explicitly describing the active state of the DRDY
pin in the binding file.

Tested on frdm_k64f.

Signed-off-by: Kevin Townsend <kevin@ktownsend.com>
2020-02-05 12:00:36 +01:00
Armando Visconti 7fa48d4d6e driver/sensor: lis2mdl: update to use new GPIO API
Get rid of all the deprecated functions and definitions
replacing them with the new ones.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-02-05 12:00:36 +01:00
Peter Bigot 4b5393c228 sensor: adxl372: update for new GPIO API
Update sample overlay for missing chip select and to deconflict with
UART TXD.  Add GPIO flags to configuration state.  Replace callback
enable with interrupt enable.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot de7e3e7693 sensor: adxl362: update for new GPIO API
Add a sample overlay.  Add GPIO flags to configuration state.  Replace
callback enable with interrupt enable.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 0d1d06ea79 drivers: sensor: hts221: cleanup related to devicetree and trigger idiom
Put all the devicetree configuration data into a config structure in
flash, which removes some ultra-long identifiers from the code and
makes it more readable, and prepares for multiple instance support.

Consistently use the interrupt signal datasheet name for all objects
that are specific to that signal, including configuration structure
tags and function names.

Update the trigger idiom for setup/handle/process stages.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Armando Visconti a08aec9999 driver/sensor: stts751: update to use new GPIO API
Get rid of all the deprecated functions and definitions
replacing them with the new ones.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-02-05 12:00:36 +01:00
Peter Bigot c44290f75d drivers: sensor: dht: update to new GPIO API
Document IO signal behavior, switch to new API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Maureen Helm 0f38786889 drivers: sensor: Convert fxas21002 to new gpio api
Converts the fxas21002 sensor driver to the new gpio api. Updates device
trees for all boards with this sensor to active low gpio interrupts by
default.

Tested on the hexiwear_k64 board.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-02-05 12:00:36 +01:00
Armando Visconti b0ad7bb594 driver/sensor: lis3mdl: update to use new GPIO API
Get rid of all the deprecated functions and definitions
replacing them with the new ones.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-02-05 12:00:36 +01:00
Peter Bigot 6dd1f66a3c drivers: sensor: bmi160: convert to new GPIO API
Document interrupt signal and replace legacy calls with new API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 1cf43985e9 drivers: sensor: lsm6dsl: update to new GPIO API
Correct IRQ active level to default active-high, switch to new
interrupt configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Johann Fischer 2a117748f6 drivers: apds9960: convert to new GPIO API
Convert APDS9960 sensor driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Maureen Helm cadbc96d66 drivers: sensor: Convert fxos8700 to new gpio api
Converts the fxos8700 sensor driver to the new gpio api. Updates device
trees for all boards with this sensor to active low gpio interrupts by
default.

Tested on frdm_k64f and rv32m1_vega_ri5cy boards. The latter verifies
that the reset output works correctly.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-02-05 12:00:36 +01:00
Armando Visconti 0ae55c7ce9 driver/sensor: iis3dhhc: update to use new GPIO API
Get rid of all the deprecated functions and definitions
replacing them with the new ones.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-02-05 12:00:36 +01:00
Armando Visconti f5dc6580a0 driver/sensor: lsm6dso: update to use new GPIO API
Get rid of all the deprecated functions and definitions
replacing them with the new ones.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-02-05 12:00:36 +01:00
Armando Visconti cde71b4f75 driver/sensor: lps22hh: update to use new GPIO API
Get rid of all the deprecated functions and definitions
replacing them with the new ones.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-02-05 12:00:36 +01:00
Armando Visconti e690fab6b1 driver/sensor: lis2dw12: update to use new GPIO API
Get rid of all the deprecated functions and definitions
replacing them with the new ones.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-02-05 12:00:36 +01:00
Peter Bigot a49b364244 drivers: sensor: sht3xd: convert to new GPIO APIO
Update ALERT active level in all devicetree files.  Capture GPIO flags
in static configuration.  Add internal API to enable and disable
interrupt, to release the handlers when an alert occurs, and to
re-enable the signal when the handler completes.  Check for alerts
received during periods when the interrupt was disabled.

Extend the example to handle both above and below range triggers and
alerts that are present on startup.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Erwan Gouriou b0ced41b69 drivers: sensors: vl53l0x: update to new GPIO API
Update to the new GPIO API.
Tested on disco_l475_iot1.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-05 12:00:36 +01:00
Peter Bigot ff4294a7fe drivers: sensor: hts221: update to new GPIO API
Correct DRDY active level to default active-high, switch to new
interrupt configuration.

Also fix a common bug where an already-active DRDY signal is not
properly handled.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 165fe48229 treewide: use full path to sensor.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Peter Bigot 1a5368a07b drivers: sensor: bma280: convert from Kconfig to devicetree
Define a binding for the Bosch BMA280 sensor.  Remove the Kconfig
settings and update the driver to use the devicetree information.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-24 15:52:09 +01:00
Henrik Brix Andersen fdbb76ff55 drivers: sensor: add driver for the nxp kinetis temperature sensor
Add sensor driver for the internal temperature sensor present in the
NXP Kinetis SoC series.

The driver allows reading the die temperature and the voltage of the
external voltage reference used for calculating the temperature.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-01-16 17:30:42 -06:00
Thomas Schmid 03e992a6b5 drivers: sensor: ms5607: fix potential integer overlow
Fix potential integer overflow by making operands to multiplication
wider.

Fixes #21673

Signed-off-by: Thomas Schmid <tom@lfence.de>
2020-01-16 07:47:59 -06:00
Dominik Ermel 8cb200309b drivers: sensors: qdec_nrfx: Fix compilation after HAL update
hal_nordic update 1e8103ae require changes to sensor code,
to make it compile.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-01-15 16:16:09 +01:00
Peter Bigot f041570188 drivers: sensor: ccs811: accommodate old firmware
The firmware version on the CCS811 on nrf52_pca20020 is generally
version 1.1, which does not set the data ready bit in the status
register.  Assume that a non-zero CO2 measurement on that version is
fresh for the purposes of determining the fetch status.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-14 15:44:09 -06:00
Peter A. Bigot ac5acb9530 drivers: sensor: ccs811: provide API to fetch configuration and versions
The application may want to know the configured mode without inspecting
Kconfig macros; this is important for proper management of BASELINE
which is mode-dependent.

It also may need to know the version of the hardware and firmware, as
the behavior of application firmware 2.0 is significantly better than
version 1.1.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot 2dd990ad55 drivers: sensor: ccs811: enable drive mode 4
This mode is documented as producing a raw result every 250 ms that the
application must convert to eCO2 and eTVOC readings.  In practice
application firmware 2.0 appears to convert the readings as with all
other rates.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot cb84836745 drivers: sensor: ccs811: provide access to sensor results
Expose the entire content of the ALG_RESULT_DATA block to the
application, primarily so the status and error flags can be seen.  With
those available the application has the ability to detect that a stale
result has been provided so sensor_fetch_sample() can return -EAGAIN in
this case instead of -EIO, and it doesn't need to block which is
annoying.

This should also make the sensor usable on older Nordic Thingy:52
devices with outdated CCS811 application firmware that doesn't properly
implement the DATA_READY bit.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot c90a738d8c drivers: sensor: ccs811: support update of environmental conditions
Accurate estimate of gas presence requires temperature and humidity
data.  Add API to update these values.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot 316c6e3aeb drivers: sensor: ccs811: cleanup of raw reading processing
Use CMSIS-standard bit mask and offset macros.  Rename the field to more
closely match the data sheet.  Use slightly less magic numbers for the
scale multipliers.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot af0c69fb9f drivers: sensor: ccs811: add interface for BASELINE management
Proper use of the CCS811 requires maintenance of the BASELINE
register value measured in clean air at various points in the sensor
life cycle.  The sensor driver abstraction has no facility to support
this, so add an application header with functions to fetch and update
the register value.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot 403a7ab2c5 drivers: sensor: ccs811: support triggers
Add the standard suite of trigger configuration options.  Add driver
support for the DATA_READY and THRESHOLD triggers.  Note cross-module
dependency as configuring the trigger requires a controlled modification
of the sensor registers and the sensor driver API doesn't support this.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot 29c5f30ed2 drivers: sensor: ccs811: rework data fetch to prepare for non-polled use
The original implementation relied on the DATA_READY bit of the STATUS
register to indicate when a reading was available.  This bit remains
clear for the first several readings produced by the CCS811.

When INT_DATARDY is set in MEAS_MODE the nINT signal will remain
asserted until ALG_RESULT_DATA is read.  If this is treated as a LEVEL
signal, which is the common case in Zephyr, gating the read of
ALG_RESULT_DATA on DATA_READY means the signal will never be cleared,
and the interrupt callback will be repeated immediately.

Since the STATUS register value is part of the ALG_RESULT_DATA block
just read the whole thing, and provide its content to the user only if
the DATA_READY bit is set.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot 21e68d4b81 drivers: sensor: ccs811: reset sensor when driver is initialized
The CCS811 has a measurement lifecycle that includes certain timing
constraints, including that calibration constants should not be applied
until the conditioning period has completed.  If a device resets but the
CCS811 remains the process of inspecting current state and initializing
the device properly can be complicated.

Simplify this by forcing a reset of the device when the driver is
initialized.  Should this cause hardship the necessary logic and
infrastructure to record time-of-last-reset across reboots and verify
measurement mode/baseline consistency can be added at that point.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot ff5ef271ee drivers: sensor: ccs811: abstract read of status/error
Read the status and error in one function that provides its own
diagnostics.

Also change name of register to match datasheet.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot 463bec1749 drivers: sensor: ccs811: bypass APP_START when not in boot mode
The CCS811 can be in either boot mode (after powerup) or application
mode, and these modes have distinct register maps that share only some
content.  The register written to switch from boot mode to application
mode is not available in application mode, so don't write to it in that
case.

Also respect the required timeout between APP_START and next I2C
operation.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot 59d41669b9 drivers: sensor: ccs811: make measurement drive mode configurable
Allow application to choose the measurement rate.

Measurement mode 4 (250 ms rate) is not supported because it we have no
support for processing the raw data it produces.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot cc3020ea49 drivers: sensor: ccs811: deassert WAKEn when not active
Asserting the WAKEn increases current draw.  Turn it off when I2C is
not being used.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-01-14 15:44:09 -06:00
Peter A. Bigot 11dd504f2a drivers: sensor: ccs811: use device tree for control GPIOs
Replace Kconfig GPIO pin configuration with device tree gpios.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Peter A. Bigot 6c15968322 drivers: sensor: ccs811: uncrustify
Run the code formatter over the source files for the CCS811.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-14 15:44:09 -06:00
Jan Tore Guggedal a536c14132 drivers: sensor: bme280: Add CS control when using SPI
Adds BME280 SPI chip select pin control if chip select is
configured for the device in the device tree.

Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
2020-01-14 08:49:19 -06:00
Anas Nashif ebaed210c7 sensor: tmp007: fix read and use i2c_burst_read
- Fix reading of temp. sensor
- Use i2c_burst_read instead of i2c_transfer

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-01-13 16:09:27 -06:00
Peter A. Bigot f05cbb421d drivers: sensor: mcp9808: fix various problems and improve test
Correct handling of device encoded temperature values, which combine a
12-bit 2s complement signed value with a separate sign bit.  Rework
conversion between device and sensor temperature representations to
support negative temperatures in both domains.

Use a much simpler trigger configuration where the alert is driven by
comparator output, rather than as an interrupt that requires a pair of
I2C transactions to read and clear the flag.

Refactor the trigger infrastructure to use the setup/handle/process
idiom, which reduces duplicated code and to correctly detect alerts
present when the triggers are set.

Completely replace the sample with something that demonstrates
updating upper and lower threshold values to track moving
temperatures.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-01-08 20:33:51 -05:00
Krzysztof Chruscinski 95b4d37230 drivers: sensor: shell: Improved shell support for sensors
Added autocompletion to 'sensor get' command. After this change
device and channels are autocompleted. It is possible to provide
multiple channels for reading.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-01-08 12:59:46 -05:00
Krzysztof Chruscinski efeb7fa771 drivers: sensor: hts221: Return error on not supported channel
When asserts were disabled then sensor accepted any channel in
hts221_channel_get(). Changed to return -ENOTSUP when invalid
channel is provided.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-01-08 12:59:46 -05:00
Peter Bigot 19a0f354ae drivers: sensor: ak8975: remove legacy reference to MPU6050
MPU6050 no longer using Kconfig to specify I2C addresses.  Reference
to the removed symbol causes QA diagnostics.  Remove the reference;
when AK8975 is converted to devicetree it may be possible to restore
the link between the sensors.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-08 16:40:04 +01:00
Peter Bigot fe018f51a2 drivers: sensor: mpu6050: convert to devicetree
Add a binding for the sensor and replace all Kconfig selection of
hardware parameters with devicetree property values.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-08 16:40:04 +01:00
Ulf Magnusson 6ef29c0250 kconfig: Remove some redundant single-item menus and ifs
A single menu within an if like

    if FOO

    menu "blah"

    ...

    endmenu

    endif

can be replaced with

    menu "blah"
            depends on FOO

    ...

    endmenu

Fix up all existing instances.

Also remove redundant extra menus underneath 'menuconfig' symbols.
'menuconfig' already creates a menu.

Also remove the menu in arch/arm/core/aarch32/Kconfig around the
"Floating point ABI" choice. The choice depends on FLOAT, which depends
on CPU_HAS_CPU, so remove the 'depends on CPU_HAS_FPU' too.

Piggyback removing a redundant 'default n' for BME280.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-21 10:26:54 -05:00
Hans Wilmers 5b1a524348 sensor: tmp116: Add support for tmp117, fix calculation issues
- Added support for TMP117 in existing driver for TMP116
  The Texas Instruments TMP117 is a higher precision upgrade
   from TMP116. It shares most functionality, but has a
   differing device ID.
   This patch will run with the hardware IDs of both devices.

- Fixed an int promote issue in tmp116_channel_get
  Negative temperature values in drv_data->sample were not
  processed correctly.
  The error occured during integer promotion from u16_t to s32_t
  in this code line:
     tmp = (s32_t)drv_data->sample * TMP116_RESOLUTION;

  By first promoting to s16_t, the correct result is obtained:
     tmp = (s16_t)drv_data->sample * (s32_t)TMP116_RESOLUTION;

- Made temperature resolution compatible to sensor API
  The fractional part of the temperature was returned as a
  multiple of 10^-7 deg.Celsius.
  This differs from the resolution sugegsted by the sensor API,
  which is 10^-6.

  The driver is now returning temperature readings with
  a resolution of 10^-6 deg. Celsius.

- The changed driver was tested using following hardware:
  TMP117 attached to disco_l475_iot1 via i2c1

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2019-12-20 20:18:25 -05:00
Diego Sueiro 93e1560faa subsys/shell: Introduce the Sensor Shell Module
Adds a Shell Module for retrieving Sensor data. The following commands
were added:

sensor - Device commands
Options:
  -h, --help  :Show command help.
Subcommands:
  get            :<device_name> [chanel_idx]
  list           :List configured sensors
  list_channels  :<device_name>

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2019-12-19 15:54:04 -05:00
Peter Bigot 0cfac519cc sensor: dht: convert from Kconfig to devicetree
Define a binding for the Aosong DHT family of temperature/humidity
sensors.  Remove the Kconfig settings, and update the driver to use
devicetree information.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-12-19 06:43:37 -06:00
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