Commit graph

68 commits

Author SHA1 Message Date
Ulf Magnusson 10d54e2b22 boards: arm: argonkey: Properly set choice default
The choice symbol LSM6DSL_EXT0_LIS2MDL was given a 'default' in
Kboards/arm/96b_argonkey/Kconfig.defconfig, but 'default' has no effect
on choice symbols, triggering a warning from Kconfiglib.

Instead of adding a default to the choice symbol, change the default of
the 'choice' itself by giving it name and adding the default in
Kconfig.defconfig.

This requires that we remove the default on the "base" definition of the
'choice', due to some messiness related to the Zephyr-specific
prefer-later-defaults behavior (see the 'Zephyr-specific Kconfig
behavior for defaults' section in the Board Porting Guide). Choices were
overlooked when that patch was added to the C tools, meaning choices
still prefer earlier defaults. The crux is that Kconfig.defconfig files
are included last.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-29 16:19:51 -04:00
Armando Visconti c9262bb47f board: argonkey: add LSM6DSL configuration in Kconfig.defconfig
Use the named choices feature introduced by PR #6966
and configure LSM6DSL on ArgonKey board.
The two named choices introduced in LSM6DSL are:

    - LSM6DSL_BUS_TYPE (default LSM6DSL_I2C)
    - LSM6DSL_TRIGGER_MODE (default LSM6DSL_TRIGGER_NONE)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-05-18 13:10:33 -05:00
Armando Visconti 17c15ff182 boards: stm32: argonkey: Add dts support to sensors
This patch adds dts support to lps22hb/hts221/vl53l0x
I2C sensors as well as lsm6dsl SPI sensor.

Since some info, like gpio for irq triggering or SPI bus
characteristics, may be provided through dts, they need
to be made optional in the LSM6DSL driver by usage of
macros like HAS_DTS_SPI_PINS or HAS_DTS_SPI_DEVICE.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-05-18 13:10:33 -05:00
Adithya Baglody b0db28b512 drivers: Cmake: Add __ZEPHYR_SUPERVISOR__ macro for driver files.
Normally a syscall would check the current privilege level and then
decide to go to _impl_<syscall> directly or go through a
_handler_<syscall>.
__ZEPHYR_SUPERVISOR__ is a compiler optimization flag which will
make all the system calls from the driver files directly link
to the _impl_<syscall>. Thereby reducing the overhead of checking the
privileges.

In the previous implementation all the source files would be compiled
by zephyr_source() rule. This means that zephyr_* is a catchall CMake
library for source files that can be built purely with the include
paths, defines, and other compiler flags that all zephyr source
files uses. This states that adding one extra compiler flag for only
one complete directory would fail.
This limitation can be overcome by using zephyr_libray* APIs. This
creates a library for the required directories and it also supports
directory level properties.
Hence we use zephyr_library* to create a new library with
macro _ZEPHYR_SUPERVISOR_ for the optimization.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-15 17:48:18 +03:00
Andy Gross 3ff4065cb3 drivers: sensors: lsm6dsl: Fix array overrun
This patch fixes an overrun detected via Coverity.  The
lsm6dsl_odr_to_freq_val function takes an index as argument.  If the
index is out of bounds, the expected behavior was to return the last
element of an array.  The actual behavior was to overrun the array.

Fixes: #7482

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-05-11 19:04:06 -04:00
Armando Visconti f7f56ccda5 drivers: sensor: lsm6dsl: add .attr_set callback
In order to be able to change at runtime the Output Data
Rate (ODR) as well as the Full-Scale (FS) for both the
Accelerometr and Gyroscope the driver needs to provide
the .attr_set callback.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-30 16:16:08 -05:00
Armando Visconti 580a9b3f2f drivers: sensor: lsm6dsl: Fix typos
In .h there are few typos that are fixed in this commit:

  - Delete LSM6DSL_REG_CTRL3_C and LSM6DSL_REG_CTRL9_XL
    register sections duplication.
  - Fix LSM6DSL_REG_CTRL6_C address.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-30 16:16:08 -05:00
Armando Visconti 180b139786 drivers: sensor: lsm6dsl: Adding sensorhub support
Adding sensorhub support. Only one slave device can be selected
among LIS2MDL (magnetometer) and LPS22HB (pressure and temperature).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-30 16:16:08 -05:00
Tomasz Bursztyka a09a0b2c49 sensors/lsm5dsl: Fix SPI API usage
The driver was not moved to the recent SPI API changes.

Fixes #7009

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-21 05:42:59 -07:00
Armando Visconti 6fb326ce06 drivers: sensor: lsm6dsl: add trigger support
Add DATA_READY trigger support to ST LSM6DSL driver.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-10 22:12:14 +02:00
Armando Visconti 87d6c50e47 sensors: Add separation between ambient and die temperature
Some device include a temperature sensor, usually used as a
companion for helping in drift compensation, that measure the
die temperature. This temperature IS NOT related to the the
ambient temperature, hence a clean separation between the two
is required.

This commit introduces a clean separation between the two
types of temperature leaving the old deprecated definition
still there.

The list of current drivers that read the die (and not the ambient)
temperature is the following:

 - adxl362
 - bma280
 - bmg160
 - bmi160
 - fxos8700
 - lis3mdl
 - lsm6ds0
 - lsm6dsl
 - lsm9ds0
 - mpu6050

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-03 22:29:11 -04:00
Armando Visconti 902c629eac drivers: sensor: lsm6dsl: add SPI support
Add SPI bus support to LSM6DSL sensor. The bus routines (i.e. I2C
and SPI) are defined in separate files, where proper r/w callbacks
are registered.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-03 15:59:36 -04:00
Kumar Gala b51cfeae60 sensors: dts: cleanup usage of HAS_DTS_I2C_DEVICE
Move to new Kconfig pattern in which we use an if !HAS_DTS_I2C_DEVICE
block for the Kconfig symbols that can now come from DT generation.
This pattern is useful to allow us to define default values for the
generated symbols for build-all testing.

Fixes: #5877

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 22:25:41 -05:00
Erwan Gouriou 65747e8702 dts: add sensors dts support for some sensors
Provide HAS_DTS_I2C_DEVICE flag to enable dts based generation for
these sensors.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-12-14 11:30:44 -06:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Piotr Mienkowski c1f8eb4182 drivers: sensor: clean up Kconfig files
- place all sensor Kconfig options in submenu
- separate device drivers and common options with a comment line
- align help text

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-09-21 15:47:58 -04:00
Erwan Gouriou e015c00300 sensor: add lsm6dsl sensor driver
Support for LSM6DSL accelerometer and gyroscpe sensor
with bare minimum features.

For more info on this sensor:
http://www.st.com/en/mems-and-sensors/lsm6dsl.html

Change-Id: I9b100a3e030faa8a70a5015a881025c876b81be4
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-05-15 14:50:38 -05:00