Commit graph

772 commits

Author SHA1 Message Date
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
Peter A. Bigot b7dc23984d drivers: sensor: sht3xd: migrate I2C from Kconfig to device tree
Replace Kconfig I2C bus and address information with device tree
bindings.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-11-30 08:30:13 -08:00
Peter A. Bigot 2bb33a1bdc drivers: sensor: sht3xd: correct humidity threshold conversion
Original scale factor assumed a maximum humidity of 10^5 percent.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-11-30 08:30:13 -08:00
Armando Visconti a1c0a1fbe5 drivers/lis2dh: Add symbol to BUS_TYPE and TRIGGER_MODE config choices
Add symbolic names to bus type (LIS2DH_BUS_TYPE) and trigger mode
(LIS2DH_TRIGGER_MODE) in order to be defined in board defconfig
files.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-11-30 08:36:29 -06:00
Armando Visconti 73a6f58dd4 sensors: convert lis2dh to use information coming from dts
Convert lis2dh accelerometer driver to get the device name as well
as i2c/spi slave information from device tree. Updates the build_all
test accordingly. (issue #11605)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-11-30 08:36:29 -06:00
Himanshu Jha f411073c85 drivers: sensor: vl53l0x: remove unnecessary variable
Remove an unnecessary local variable to store the
return value, instead return directly thereby saving
few bits of memory.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-28 11:54:01 -08:00
Mieszko Mierunski c9906dd3cf dts: nrf: Remove qdec dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Maureen Helm f2d8d93269 drivers: sensor: Convert adxl362 to device tree
Converts the adxl362 sensor driver to get the device name and spi slave
properties from the device tree rather than Kconfig. Updates the
build_all test accordingly.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-11-14 23:54:57 -05:00
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Kumar Gala a134438840 sensors: bmi160: Add DTS support
Convert the BMI160 to use Device Tree to get SPI and GPIO params instead
of Kconfig.  Updated samples, tests, and arduino_101_sss board support
for this.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-13 10:23:22 +01:00
Krzysztof Chruscinski 97345dbb1b logging: Fix errors in log usage
Couple of findings which were revealed after changing
LOG_MODULE_REGISTER macro:
- missing semicolons after LOG_MODULE_REGISTER()
- missing LOG_LEVEL defines
- other

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-11-10 12:38:29 -05:00
Himanshu Jha cb350e9399 sensors: lis2dh: Handle return value of lis2dh_reg_read_byte function
Provide necessary error handling for `lis2dh_reg_read_byte` function
which might fail.

Also, use a common `status` variable to be used for storing the
error code.

Fixes #10590
Coverity-CID: 188733

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-09 16:11:26 -06:00
Maureen Helm f379abfe47 drivers: sensor: Fix missing case break in fxos8700 driver
Fixes a missing case break in the fxos8700 sensor driver, caught by
Coverity.

Coverity-CID: 189517

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-11-07 19:23:46 -05:00
Himanshu Jha d0a98b7cf9 drivers: Remove redundant semicolon
Remove the redundant semicolon used as a terminator in
`if`, `switch`, `while` statements.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:34:06 -05:00
Himanshu Jha 4a5042dd77 sensor: lis2mdl: Handle return value of i2c_burst_read
i2c_burst_read can fail during read/write procedure. Therefore,
add a sanity check for its return value.

Fixes #11101
Coverity-CID: 189505

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-06 14:10:51 -06:00
Dennis Wildmark e60a6e9256 drivers: lsm303dlhc_accel: support for sensor_attr_set
Driver for LSM303DLHC accelerometer now supports API function
sensor_attr_set for attribute SENSOR_ATTR_SAMPLING_FREQUENCY.

Signed-off-by: Dennis Wildmark <d.wildmark@gmail.com>
2018-11-05 10:41:51 -06:00
Flavio Ceolin 20e5c257f8 drivers: sensor: Fix syscall name
syscall sensor_sample_fetch was erroneously being defined as
sensor_sample_sample_fetch.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-01 14:40:30 -07:00
Himanshu Jha b8c19d8c75 util: Add GENMASK helper macro definition
Macro is used to create contiguous bitmask between the
arguments passed to the macro.

BITS_PER_LONG is computed as the multiplication of predefined
macros `__CHAR_BIT__` and `__SIZEOF_LONG__`.

Both gcc and clang support these predefined macros.

With this change, replace the redundant defintions of
GENMASK with the new generic macro available.

Fixes #10843

Suggested-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-01 13:40:01 +01:00
Anas Nashif 04c85e64c1 sensors: qdex_nrfx: move to new logger
Move to new logger and use sensor log level instead of our own.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-31 08:34:36 -04:00
Kumar Gala d505d9a8ca driver: sensor: bmm150: Use SENSOR_CHAN_MAGN_XYZ
Driver should be using SENSOR_CHAN_MAGN_XYZ as SENSOR_CHAN_MAGN_ANY has
been deprecated for a while.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-30 15:28:41 -05:00
Satya Bhattacharya 7d886e8b6e sensor: isl29035: Unchecked return value
Check the return value of i2c_reg_read_byte() and return
if unable to read the register
Coverity-CID: 188740

Fixes #10585

Signed-off-by: Satya Bhattacharya <satyacube@gmail.com>
2018-10-30 05:56:18 -05:00
Anas Nashif 203948e156 sensors: move grove sensors under drivers/sensor
Grove devices are sensors, so no need to have them under their own
category.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-28 11:46:36 -04:00
Johann Fischer 38765d2c40 drivers: fxos8700: mention compatible devices in the help section
Mention compatible devices in the Kconfig help section.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Johann Fischer ba4239f5f8 Revert "drivers: sensor: Add support for MMA8451Q (3-axis accelerometer)"
Driver fxos8700 can also be used for the MMA8451
accelerometer and offers more functionality.
Revert the commit to avoid duplicate code.

This reverts commit 9c0d7813e5.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Johann Fischer 47bb0e1e5f drivers: fxos8700: add verification of the supported devices
Add basic verification of the supported devices.
Add IDs for MMA8451, MMA8652, MMA8653 and FXOS8700 and
remove Kconfig FXOS8700_WHOAMI option.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Johann Fischer b401f5ee38 drivers: fxos8700: add motion detection
Add basic support for motion detection.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Johann Fischer 8e0ec542a5 drivers: fxos8700: add power mode configuration
Add power mode configuration.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Johann Fischer 6bd80cdc97 drivers: fxos8700: allow to change output data rate
Add attr_set for SENSOR_ATTR_SAMPLING_FREQUENCY and
allow to change output data rate.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Pawel Dunaj 004b8b26c0 drivers: sensors: qdec_nrfx: Add support for Nordic QDEC
Add a QDEC driver that utilizes Nordic's QDEC.

This closes issue #9364

Jira:DESK-259

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2018-10-17 13:45:51 -05:00
Anas Nashif 86ad1bd03d drivers: lsm303dlhc_magn: move to new logger
Move to new logger replacing macros and defining module.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 17:30:09 -04:00
Anas Nashif b49e26680d drivers: lsm303dlhc_accel: move to new logger
Move to new logger replacing macros and defining module.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 17:30:09 -04:00
Andy Ross 220d4f8347 sys_clock.h: Make "global variable" APIs into proper functions
The existing API defined sys_clock_{hw_cycles,ticks}_per_sec as simple
"variables" to be shared, except that they were only real storage in
certain modes (the HPET driver, basically) and everywhere else they
were a build constant.

Properly, these should be an API defined by the timer driver (who
controls those rates) and consumed by the clock subsystem.  So give
them function syntax as a stepping stone to get there.

Note that this also removes the deprecated variable
_sys_clock_us_per_tick rather than give it the same treatment.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Anas Nashif 1f6122e268 sensors: lis2dh: move header after log module init
Allow logging in header file using the module of the file including the
header.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 08:49:53 -04:00
Punit Vara e5620a2b87 drivers: sensor: Migrate to new logger
Move all sensor drivers and samples to new logging system.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-10-16 08:49:53 -04:00
Philémon Jaermann 43bc39e140 drivers: sensor: lsm303dlhc magnetometer driver
Enable magnetometer measurement

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
2018-10-15 12:47:13 -05:00
Philémon Jaermann 0453b2e0dd drivers: sensor: lsm303dlhc accel driver
Enable acceleration measurement.

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
2018-10-15 12:47:13 -05:00
Jan Van Winkel db9403def5 drivers: sensors: Added MS5837 driver
Added MS5837 pressure sensor driver

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-10-12 14:28:32 -05:00
Mario Tesi 5d8834bee4 driver: sensor: Add support for LIS2MDL Mag sensor
Added support to LIS2MDL Magnetometer sensor provided
with following features:
	- I2C interface
	- Mag data
	- Temperature data
	- ODR configurable by config or at runtime
	- Trigger mode selectable by menuconfig
	- IRQ pin configurable (by dts or Kconfig)
	- Hard Iron offset setting at runtime
	- Include yaml file

Tested on ST MEMS IKS01A2 + NUCLEO STM32F411RE board.
LIS2MDL connected to I2C master interface (SPI 3 wire not
supported yet).
Test run with all ODR {10, 20, 50, 100} Hz in poll and
trigger mode.

GPIO IRQ dts configuration has been tested by adding
to boards/arm/nucleo_f411re/nucleo_f411re.dts file
this patch:

&i2c1 {
        status = "ok";
        clock-frequency = <I2C_BITRATE_FAST>;
+
+       /* ST Microelectronics LIS2MDL mag sensor */
+       lis2mdl-magn@1e {
+               compatible = "st,lis2mdl-magn";
+               reg = <0x1e>;
+               irq-gpios = <&gpioa 4 0>;
+               label = "LIS2MDL";
+               status = "ok";
+       };
};

and adding boards/arm/nucleo_f411re/dts.fixup with following
content:

	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_LABEL
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_BASE_ADDRESS
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_BUS_NAME
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_IRQ_GPIOS_CONTROLLER
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_IRQ_GPIOS_PIN

For more info on this LIS2MDL please follow this link:
http://www.st.com/en/mems-and-sensors/lis2mdl.html

Signed-off-by: Mario Tesi <mario.tesi@st.com>
2018-10-12 14:13:50 -05:00
Maureen Helm 98d765a3b4 drivers: sensor: Remove Kconfigs conditioned upon !HAS_DTS_GPIO
Make device tree required for these sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-02 10:50:18 -07:00
Maureen Helm bd6facbc14 drivers: sensor: Remove Kconfigs conditioned upon !HAS_DTS_SPI
Make device tree required for these sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-02 10:50:18 -07:00
Maureen Helm 2b72283bda drivers: sensor: Remove Kconfigs conditioned upon !HAS_DTS_I2C
Make device tree required for these sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-02 10:50:18 -07:00
Maureen Helm ad32e3b543 drivers: boards: Merge HAS_DTS_SPI_PINS with HAS_DTS_SPI
Every board that uses dts-enabled spi drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_SPI_PINS and
HAS_DTS_SPI.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Maureen Helm eeb4411de7 drivers: boards: Merge HAS_DTS_GPIO_DEVICE with HAS_DTS_GPIO
Every board that uses dts-enabled gpio drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_GPIO_DEVICE and
HAS_DTS_GPIO.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Maureen Helm 89ccead382 drivers: boards: Merge HAS_DTS_SPI_DEVICE with HAS_DTS_SPI
Every board that uses dts-enabled spi drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_SPI_DEVICE and
HAS_DTS_SPI.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Maureen Helm 75bc6ba454 drivers: boards: Merge HAS_DTS_I2C_DEVICE with HAS_DTS_I2C
Every board that uses dts-enabled i2c drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_I2C_DEVICE and
HAS_DTS_I2C.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Johann Fischer 59a6ec44b7 drivers: apds9960: use power management
Use power management

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-09-21 09:02:00 -05:00
Johann Fischer b192b2b575 drivers: apds9960: add trigger mode for proximity
Add trigger mode for proximity

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-09-21 09:02:00 -05:00
Johann Fischer 963f97d035 drivers: apds9960: use interrupt output for sample
This patch changes the behavior of the sensor. The sensor
will remain in sleep mode after initialization and will only
run the measurements once when sample_fetch is called.
This optimizes the power consumption of the sensor as it
stays in sleep mode most of the time.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-09-21 09:02:00 -05:00
Johann Fischer 9c3d77380a driver: apds9960: reorganize ALS and proximity setups
Refactor and reorganize ALS and proximity setup functions.
Cleanup and reorder register, fix register fields.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-09-21 09:02:00 -05:00
Johann Fischer 163629c96a drivers: apds9960: use i2c_burst_read to fetch ALS data
Use i2c_burst_read to fetch ALS data.
Use unsigned values for ALS and proximity data.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-09-21 09:02:00 -05:00
Maureen Helm a013ce3bf0 drivers: sensor: Fix incorrect Kconfig dependency in lsm6dsl
The lsm6dsl sensor driver incorrectly conditioned the interrupt pin
Kconfigs upon !HAS_DTS_SPI_PINS, when it should actually be
!HAS_DTS_GPIO_DEVICE.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Maureen Helm 06f73456ba drivers: sensor: Fix casting warnings
Fixes casting warnings in multiple sensor drivers when creating their
own thread. These warnings were found when updating the build_all tests
to include missing sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Maureen Helm 553a31efb9 drivers: sensor: Add missing cmake files for bmm150
The bmm150 sensor driver was missed in the conversion from kbuild to
cmake. This problem was found when updating the build_all tests to
include missing sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Maureen Helm 7ac70c4764 drivers: sensor: Fix compiler format warning in bmi160
Fixes a compiler format warning in the bmi160 sensor driver. This
warning was found when updating the build_all tests to include missing
sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Maureen Helm 2875c052dc drivers: sensor: Fix unused variable warnings
Fixes unused variable warnings for the adxl362 and lis2dh sensor
drivers. These warnings were found when updating the build_all tests to
include missing sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Maureen Helm 232cb657fc sensor: Remove unnecessary Kconfig parentheses in sensor drivers
Removes Kconfig parentheses that become unnecessary after commits
7fe3a481d0 and
ab9017ec83.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-13 10:49:54 -04:00
Maureen Helm 7fe3a481d0 sensor: Remove redundant Kconfig "depends on SENSOR" in sensor drivers
The sensor driver Kconfigs are sourced inside an "if SENSOR..endif"
conditional, so it is redundant for sensor drivers to explicitly
"depends on SENSOR".

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-13 01:02:37 -04:00
Maureen Helm ab9017ec83 sensor: Eliminate repetitive Kconfig "depends on" in sensor drivers
For each sensor driver, wrap all Kconfig symbols in a big if/endif
conditional rather than repeating "depends on" for each symbol.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-13 01:02:37 -04:00
Frank Li 70efac6e90 drivers: sensor: dht: Fix fetch fail when config hw cycles=32768
When config hw cycles=32768 max_wait_cycles maybe small than 60us.
The fix change the condition,make sure the wait time exceeds 80us.

Fixed #9816

Signed-off-by: Frank Li <lgl88911@163.com>
2018-09-11 18:42:47 -05:00
Erwan Gouriou 18b8a633b6 sensors: introduce kconfig named choices
Use Kconfig specific object "named choices".
Aim is to allow to define config choices selection in Kconfig.*
files instead of _defconfig and hence allow to keep flags
activation conditional.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-08-29 09:05:51 -04:00
Michael Hennerich a3e7cea1df drivers: sensors: adxl372: Add driver for ADXL372 high-g accelerometer
This patch adds support for the Analog Devices ADXL372 ultra-low power,
3-axis, +/-200 g MEMS accelerometer. The ADXL372 can be either connected
via a SPI or I2C interface.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
2018-08-21 20:19:44 -05:00
Johann Fischer 7a507d3ea5 drivers: apds9960: add dt bindings
Add dt bindings.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-08-17 13:19:20 -07:00
Johann Fischer 6c9eb734a7 drivers: hdc1008: add dt bindings
Add dt bindings for HDC1008 sensor.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-08-17 13:19:20 -07:00
Johann Fischer acc5312b6c drivers: hdc1008: do not use hardcoded I2C address
Do not use hardcoded I2C address.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-08-17 13:19:20 -07:00
Ulf Magnusson 8cf8db3a73 Kconfig: Use a short, consistent style for prompts
Consistently use

    config FOO
            bool/int/hex/string "Prompt text"

instead of

    config FOO
            bool/int/hex/string
            prompt "Prompt text"

(...and a bunch of other variations that e.g. swapped the order of the
type and the 'prompt', or put other properties between them).

The shorthand is fully equivalent to using 'prompt'. It saves lines and
avoids tricking people into thinking there is some semantic difference.

Most of the grunt work was done by a modified version of
https://unix.stackexchange.com/questions/26284/
how-can-i-use-sed-to-replace-a-multi-line-string/26290#26290, but some
of the rarer variations had to be converted manually.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-15 04:10:10 -07:00
Diego Sueiro 72cad66c5b drivers/sensor/fxas21002: Fix race condition during initialization
A race condition was identified during the initialization of the
driver when the trigger function is enabled. This exposed two issues:

1 - The fxas21002_handle_int is trying to acquire the semaphore before
    it gets initialized. To solve this we need to initialize the
    semaphore before calling the fxas21002_trigger_init function.

2 - During the fxas21002_trigger initialization the i2c bus is used
    (from fxas21002_handle_int function) at the same time as the
    fxas21002_set_power is being called. To fix this we need to
    initialize the semaphore with 0 and just release it after calling
    the fxas21002_set_power function in the fxas21002_int

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-08-13 09:05:54 -05:00
Diego Sueiro ed4f0ff36e drivers/sensor/fxos8700: Fix race condition during initialization
A race condition was identified during the initialization of the
driver when the trigger function is enabled. This exposed two issues:

1 - The fxos8700_handle_int is trying to acquire the semaphore before
    it gets initialized. To solve this we need to initialize the
    semaphore before calling the fxos8700_trigger_init function.

2 - During the fxos8700_trigger initialization the i2c bus is used
    (from fxos8700_handle_int function) at the same time as the
    fxos8700_set_power is being called. To fix this we need to
    initialize the semaphore with 0 and just release it after calling
    the fxos8700_set_power function in the fxos8700_int

These two scenarios was reproducible in the WaRP7 board with i.MX7 SoC.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-08-13 09:05:07 -05:00
Ulf Magnusson ec3eff57e0 Kconfig: Use the first default with a satisfied condition
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.

There are at least three problems with the patch:

  1. It's inconsistent with how Kconfig works in other projects, which
     might confuse newcomers.

  2. Due to oversights, earlier 'range' properties are still preferred,
     as well as earlier 'default' properties on choices.

     In addition to being inconsistent, this makes it impossible to
     override 'range' properties and choice 'default' properties if the
     base definition of the symbol/choice already has 'range'/'default'
     properties.

     I've seen errors caused by the inconsistency, and I suspect there
     are more.

  3. A fork of Kconfiglib that adds the patch needs to be maintained.

Get rid of the patch and go back to standard Kconfig behavior, as
follows:

  1. Include the Kconfig.defconfig files first instead of last in
     Kconfig.zephyr.

  2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
     last in arch/Kconfig.

  3. Include arch/<arch>/soc/*/Kconfig first instead of last in
     arch/<arch>/Kconfig.

  4. Swap a few other 'source's to preserve behavior for some scattered
     symbols with multiple definitions.

     Swap 'source's in some no-op cases too, where it might match the
     intent.

  5. Reverse the defaults on symbol definitions that have more than one
     default.

     Skip defaults that are mutually exclusive, e.g. where each default
     has an 'if <some board>' condition. They are already safe.

  6. Remove the prefer-later-defaults patch from Kconfiglib.

Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions

As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).

This commit includes some default-related cleanups as well:

  - Simplify some symbol definitions, e.g. where a default has 'if FOO'
    when the symbol already has 'depends on FOO'.

  - Remove some redundant 'default ""' for string symbols. This is the
    implicit default.

Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).

Piggyback some fixes for style nits too, e.g. unindented help texts.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Lars Knudsen 9c0d7813e5 drivers: sensor: Add support for MMA8451Q (3-axis accelerometer)
Only basic features supported initially but more could be added from:
https://www.nxp.com/docs/en/data-sheet/MMA8451Q.pdf

fixes #9006

A sample app will be provided in a separate PR.

Signed-off-by: Lars Knudsen <larsgk@gmail.com>
2018-07-31 09:07:54 -05:00
Michael Hennerich 21fd91e11e drivers: sensors: adt7420: Add driver for ADT7420 Temperature Sensor
This patch adds support for the Analog Devices ADT7420 High-Accuracy
16-bit Digital I2C Temperature Sensors. Optionally sensor threshold
events are supported.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
2018-07-12 13:03:24 -05:00
Ulf Magnusson 19d7803546 drivers: sensor: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-27 17:20:10 -05:00
Ulf Magnusson 2a8349950e drivers: sensors: Consistently quote "GPIO_0" string default
These cases weren't caught by the heuristic used by the warning added in
commit 6eabea3a7e ("Kconfiglib: Warn for unquoted string defaults"),
because "GPIO_0" has no lowercase characters in it.

Unquoted Kconfig values are are indistinguishable from reference to
(undefined) symbols in general. Quoting all string defaults will help
find "true" references to undefined Kconfig symbols, and makes it
clearer that the value is constant.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-13 13:35:56 -04:00
Armando Visconti 87bd2c25bf drivers: sensor: lis2dh: Fix I2C burst read/write operations
As stated in LIS2DH datasheet in section "5.1.1 I2C Operation",
in order to read/write multiple bytes on I2C it is necessary
to add the autoincrement bit to the subaddress field.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-06-11 17:20:21 -04:00
Evgeny Kalugin e16037d87a drivers: sensor: lis2dh: Fix of compilation issue
The lis2dh_burst_write used "bus" as an input parameters, while
inside "dev" was referred. Now variable names are aligned.

Signed-off-by: Evgeny Kalugin <evgeny.kalugin@intel.com>
2018-06-11 17:20:21 -04:00
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
Punit Vara 8eb652bfd5 drivers: apds9960: Always default on I2C_0
Use I2C_0 instance by default for APDS9960

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-05-29 07:46:08 -07:00
Adithya Baglody 62004146e4 drivers: sensors: Remove usage of zephyr_library_ifdef
Phasing out the usage of this cmake macro from the sensor folder.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-28 13:23:13 -04:00
Kumar Gala 4a3f5e5c7d drivers: sensor: pms7003: Rename CONFIG_PMS7003_SERIAL_TIMEOUT
Rename CONFIG_PMS7003_SERIAL_TIMEOUT to CFG_PMS7003_SERIAL_TIMEOUT as it
was not exposed in Kconfig as a configurable option.  So don't use the
CONFIG_ prefix for non-Kconfig symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-23 17:57:06 -04:00
Kumar Gala 084386302f drivers: sensor: bmm150: Fix typo in Kconfig symbol
In the code we had an if defined based on
CONFIG_BMM150_MAGN_SAMPLING_RATE_RUNTIME that should have been
CONFIG_BMM150_SAMPLING_RATE_RUNTIME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-23 17:57:06 -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
Andrew Boie 8345e5ebf0 syscalls: remove policy from handler checks
The various macros to do checks in system call handlers all
implictly would generate a kernel oops if a check failed.
This is undesirable for a few reasons:

* System call handlers that acquire resources in the handler
  have no good recourse for cleanup if a check fails.
* In some cases we may want to propagate a return value back
  to the caller instead of just killing the calling thread,
  even though the base API doesn't do these checks.

These macros now all return a value, if nonzero is returned
the check failed. K_OOPS() now wraps these calls to generate
a kernel oops.

At the moment, the policy for all APIs has not changed. They
still all oops upon a failed check/

The macros now use the Z_ notation for private APIs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 23:34:03 +03: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
Maureen Helm 9cd36c7bd2 boards: dts: Add fxas21002 interrupt bindings and fix sensor sample
Adds dts bindings for the fxas21002 interrupt pins to all boards that
have this sensor.

The fxas21002 driver is currently only aware of one sensor interrupt
pin, therefore the routing of INT1 or INT2 to the driver is handled in
each board's dts.fixup.

The fxas21002 sample application has been broken since the refactoring
of the mcux gpio driver to dts in commit
4e8f29f319. The sample is now fixed.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-10 15:43:42 -05:00
Maureen Helm 90ac25f736 boards: dts: Add fxos8700 interrupt bindings and fix sensor sample
Adds dts bindings for the fxos8700 interrupt pins to all boards that
have this sensor. The frdm_k64f and hexiwear_k64 connect both sensor
interrupt pins to the mcu, but the frdm_kw41z connects only one.

The fxos8700 driver is currently only aware of one sensor interrupt pin,
therefore the routing of INT1 or INT2 to the driver is handled in each
board's dts.fixup.

The fxos8700 sample application has been broken since the refactoring of
the mcux gpio driver to dts in commit
4e8f29f319. The sample is now fixed.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-10 15:43:42 -05:00
Armando Visconti 77c0456d00 sensors: hts221: Fix a crash due to bad device init
The hts221 requires 2.2 ms at boot time to download
the flash content into the volatile mem and the
calibration values cannot be read before that.

This issue is causing following crash:

  ***** USAGE FAULT *****
    Executing thread ID (thread): 0x20000234
    Faulting instruction address:  0x80037de
    Division by zero
  Fatal fault in essential thread! Spinning...

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-05-09 15:15:50 -05:00
Armando Visconti b83d0782c9 sensor: vl53l0x: make xshut pin control optional
The XSHUT pin, used to shutdown the device when it is not
in current use, is optional and some boards (like ArgonKey)
leave it tied to vdd. So, the driver must provide a way to
make this part configurable.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-05-09 13:18:58 -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
Leandro Pereira c200367b68 drivers: Perform a runtime check if a driver is capable of an operation
Driver APIs might not implement all operations, making it possible for
a user thread to get the kernel to execute a function at 0x00000000.

Perform runtime checks in all the driver handlers, checking if they're
capable of performing the requested operation.

Fixes #6907.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-26 02:57:12 +05:30
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
Aapo Vienamo fbd3c2f4e2 sensors: ccs811: Deassert the reset pin with GPIO
The driver releases the sensor from reset in case the reset pin is
driven by a GPIO.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-04-09 17:09:06 -05:00
Marti Bolivar bdd03f388b drivers: sensor: temp_nrf5: fix sensor type
The sensor channel type for the nRF TEMP peripheral is incorrectly set
to SENSOR_CHAN_AMBIENT_TEMP. This peripheral measures die temperature,
not ambient temperature.

Fix the sensor channel.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-04-04 12:29:05 -05:00
Tomasz Bursztyka 2f7e6b6d42 drivers/sensors: Switch lis2dh driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 94d7c9f23e drivers/sensors: Switch adxl362 driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka eb7af5527d drivers/sensors: Switch bmi160 driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 244c2af154 drivers/sensors: Switch bme280 driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 324265420b api/spi: Disable legacy API by default
Let's start deprecation work of the SPI legacy API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +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
Tobias Aschenbrenner e99fb77620 sensors: lis3dh: Fix i2c burst read
The sensor enables the readout of multiple consecutive registers if
the MSb of the sub-address is set. The other 7bit are the register
address.

Signed-off-by: Tobias Aschenbrenner <taschenb@posteo.de>
2018-03-28 10:42:34 -04:00
Carles Cufi b2016da563 arch: arm: nrf: Rename common header to apply to all nRFx ICs
The existing nrf5_common.h now applies to other Nordic ICs that are not
part of the "5" family. Instead rename this to nrf_common.h to cover the
upcoming ICs that belong to other families.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 11:57:14 +01:00
Carles Cufi f49150cab6 arch: arm: nrf: Rename nrf5 SoC Family to nrf
Upcoming Nordic ICs that share many of the peripherals and architecture
with the currently supported nRF5x ones are no longer part of the nRF5
family. In order to accomodate that, rename the SoC family from nrf5 to
nrf, so that it can contain all of the members of the wider Nordic
family.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 11:57:14 +01:00
Kumar Gala 4cd0fd2496 drivers: sensor: lsm6ds0: Fix assert logical error
The assert for what chan can be was missing several cases.

Coverity-CID: 182594
Fixes: 5888

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-06 15:21:43 -05:00
Aapo Vienamo 0a6f8c1aa2 drivers: sensor: ccs811: Fix value conversion
The arithmetic performed on the CO2 and VOC measurements is pointless as
the units of the sensor already match those of the API, furthermore the
multiplication will overflow the u32_t with CO2 or VOC readings greater
than 4294 ppm or ppb. This CO2 concentration is achievable by breathing
at the sensor.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-03-05 13:23:38 -06:00
Aapo Vienamo 3318f21196 sensors: css811: Use HAS_DTS_I2C_DEVICE in Kconfig
A condition is added to the Kconfig file to disable config options which
will be supplied from the dts.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-03-05 11:22:47 -06:00
Philémon Jaermann 82b7433144 drivers: sensors: Enable LSM6DS0 GYRO sampling rate
Use correct sensor dependence in Kconfig
to enable GYRO sampling rate configuration.

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
2018-03-02 10:14:03 -06:00
Leandro Pereira 25a59cded9 drivers: sensor: vl53l0x: Use proper variable type for return code
VL53L0X_PerformSingleRangingMeasurement() returns a signed 8-bit
integer, not an unsigned 8-bit integer, making the "< 0" comparison
worthless.

Coverity-CID: 182593
Coverity-CID: 182597
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-02-17 09:19:35 -05:00
Erwan Gouriou 2ede6c67ff sensors: move lps25hb and lsm6ds0 to dts
Introduce yaml binding files for sensors LPS25HB and LSM6DS0.
Fix description issue in lps22hb yaml file

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-02-07 10:30:36 -06:00
Ding Tao cdcff62f92 sensor: adxl362: Fix typo on Kconfig file
Replace prefix "BMI160_" with "ADXL362".

Signed-off-by: Ding Tao <miyatsu@qq.com>
2018-02-07 08:35:29 -05:00
Ding Tao 68ca36f8f5 sensor: vl53l0x: Fix Kconfig warning of non-int value
The I2C address of vl53l0x are write in hex, but the VL53L0X_I2C_ADDR
type is int.

Fix this by replace "int" with "hex".

Signed-off-by: Ding Tao <miyatsu@qq.com>
2018-02-07 08:35:29 -05:00
Mark Vels 6324d11535 sensors: tmp112: Fix breakage on stm32f4 platform
It makes no sense to set the restart condition flag on a first message
and some i2c bus drivers (like the stm32 v1 driver) actually reject
them by returning an error from i2c_transfer().

This patch fixes that by using i2c_burst_read() in tmp112_reg_read()
instead. For consistency, tmp112_reg_write() is also changed to use
i2c_burst_write().

Signed-off-by: Mark Vels <mark.vels@team-embedded.nl>
2018-02-06 17:08:35 -05:00
Mark Vels 018b489aea sensors: tmp112: trivial: Add comment about using this driver for TMP102
I have been using this the TMP112 driver with success with a TMP102
connected to to nucleo-f411re board (via I2C1 using PB8/9).

According to the datasheets, both devices are both driver and pin
compatible although the TMP102 is less accurate.
This temperature sensor is not a thermopile sensor type as stated in
comments.

This patch updates that help info

Signed-off-by: Mark Vels <mark.vels@team-embedded.nl>
2018-02-06 17:08:35 -05:00
Manivannan Sadhasivam 9e88120fdf drivers: sensor: Add support for CCS811 Digital Gas Sensor
Add support for AMS CCS811 Digital Gas Sensor for monitoring
indoor air quality. This sensor reports the following parameters:

1. Co2 concentration
2. VOC concentration
3. Sensor voltage
4. Sensor current

This driver only supports polling mode as of now.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-02-06 11:16:26 -05:00
Punit Vara 6abdcdb789 drivers: vl53l0x: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 2fecb06104 drivers: tmp007: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 212bc9d25f drivers: th02: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 6aca882d08 drivers: sx9500: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 24d3ac5ba2 drivers: sht3xd: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara c26a00bf42 drivers: pms7003: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 5fafab34c6 drivers: mpu6050: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara ed1576af15 drivers: mcp9808: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 97a3c74191 drivers: lsm9ds0_mfd: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara c93ba2f017 drivers: lsm9ds0_gyro: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 1879a4a91f drivers: lsm6ds0: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 223a24d29e drivers: lps25hb: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 78339a6fab drivers: lis3dh: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 28916492dd drivers: lis2dh: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 5c15b68ba8 drivers: isl29035: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 49feececcc drivers: hts221: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara d377d63f57 drivers: hp206c: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 51d2a1bd4e drivers: hmc5883l: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 5b5390f84b drivers: hdc1008: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 7c8dada6bc drivers: dht: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 1f992e891c drivers: bma280: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 3754a4f77f drivers: ak8975: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Punit Vara 3a163fb4cb drivers: bmg160: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-02-05 12:04:20 -06:00
Paul Sokolovsky 91228142fe sensors: Redefine SENSOR_CHAN_DISTANCE to be in meters
Most of sensor channels defined by Zephyr use the main, unscaled
SI unit. We also have SENSOR_CHAN_ALTITUDE which is defined in
meters. So, it only makes sense to define distance in meters too

The only driver supporting SENSOR_CHAN_DISTANCE as of now is
vl53l0x.c, which was updated accordingly. Also, update doc links
in the driver based on the review comment.

Fixes: #5693

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 10:30:34 -06:00
Paul Sokolovsky b7623a85b0 sensors: Redefine SENSOR_CHAN_HUMIDITY in percents, not milli-percents.
Based on the discussion in #5693, the reason why humidity was defined
in milli-percent was likely following Linux which defines it as such
in its sensor subsystem:
http://elixir.free-electrons.com/linux/latest/source/Documentation/ABI/testing/sysfs-bus-iio#L263

However, Linux defines temperature in milli-degrees either, but
Zephyr uses degrees (similarly for most other quantities). Typical
sensor resolution/precision for humidity is also on the order of 1%.

One of the existing drivers, th02.c, already returned values in
percents, and few apps showed it without conversion and/or units,
leading to confusing output to user like "54500".

So, switching units to percents, and update all the drivers and
sample apps.

For few drivers, there was also optimized conversion arithmetics
to avoid u64_t operations. (There're probably more places to
optimize it, and temperature conversion could use such optimization
too, but that's left for another patch.)

Fixes: #5693

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 14:10:39 +01:00
Andy Gross 94afaa3845 sensor: hts221: Fix assert logical error
This patch fixes a logical error in a assert statement uncovered by
Coverity.

Coverity-CID: 182588

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-01-31 11:03:26 -06:00
Maureen Helm 641aa5c58a dts: sensor: Add dts yaml bindings for the max30101 sensor
Adds dts yaml bindings for the max30101 sensor to allow the sensor
driver name, i2c driver name, and i2c address to be extracted from dts
instead of kconfig.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 10:17:58 -06:00
Maureen Helm fd8a9ae89c dts: sensor: Add dts yaml bindings for the fxas21002 sensor
Adds dts yaml bindings for the fxas21002 sensor to allow the sensor
driver name, i2c driver name, and i2c address to be extracted from dts
instead of kconfig.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 10:17:58 -06:00
Maureen Helm 88d5949b94 dts: sensor: Add dts yaml bindings for the fxos8700 sensor
Adds dts yaml bindings for the fxos8700 sensor to allow the sensor
driver name, i2c driver name, and i2c address to be extracted from dts
instead of kconfig.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 10:17:58 -06: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
Kumar Gala 54c0caeb2b sensor: hts221: Cleanup Kconfig for driver & bus name
Move to use an if HAS_DTS_I2C_DEVICE instead of depends on so that the
Kconfig sybmols don't even show up if HAS_DTS_I2C_DEVICE is true.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 09:47:14 -06:00
Vincent Veron 096314872a drivers: sensor: vl53l0x: ST library customization for Zephyr
The generic library provided by ST in ext/hal/st/lib/sensor/vl53l0x
needs to be adapted to the platform. In this case, the main
modification is the way to use I2C. This is now using the Zephyr
I2C API.

Signed-off-by: Vincent Veron <vincent.veron@st.com>
2018-01-23 10:14:49 -06:00
Vincent Veron 347560459b driver: sensor: Add vl53l0x
Add driver for ST vl53l0x time of flight sensor.
This driver can be used in 2 modes :
  * proximity sensor :
      configure VL53L0X_PROXIMITY_THRESHOLD
      will return 1 if target is between sensor and threshold,
      else, 0
  * distance sensor :
      will return the distance in millimeters from sensor to target

This driver use the official STMicroelectronics library for vl53l0x.
(in ext/hal/st/lib/sensor/vl53l0x)

Signed-off-by: Vincent Veron <vincent.veron@st.com>
2018-01-23 10:14:49 -06:00
Erwan Gouriou 2867b8641a Revert "sensors: hts221: provide name to Kconfig choice"
This reverts commit 2a7efb7419.

"choice" section in board Kconfig.defconfig introduces a dependency
from the sensor to the board. As a consequence a warning was generated
whenever the sensor was used on another board.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-01-13 09:06:58 -08:00
Erwan Gouriou 11eac235bc Revert "sensors: lis3mdl: provide name to Kconfig choice"
This reverts commit 2e20f49167.

"choice" section in board Kconfig.default introduces a dependency
from the sensor to the board. Then a warning was generated
whenever the sensor is used on another board

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-01-13 09:06:58 -08:00
Johann Fischer 476f05d2f8 drivers: sensors: add driver for amg88xx sensor
This patch adds the driver for Panasonic AMG88xx
infrared array sensor.

The driver was developed within the framework of a student
internship in the development department. The task of the
student was to implement the trigger part of the driver,
transfer and visualization of the measured data.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-01-07 16:04:45 -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
Anas Nashif 429c2a4d9d kconfig: fix help syntax and add spaces
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-13 17:43:28 -06:00
Yongfa Zhou ce6f6f4985 drivers: sensor: Fix some code style issues
Signed-off-by: Yongfa Zhou <yongfa.zhou@intel.com>
2017-11-27 22:17:38 -05:00
Yongfa Zhou 85c6b060b0 drivers: sensor: Add plantower PMS7003 Driver
Tested on STM32F103 board

Origin: Original

Signed-off-by: Yongfa Zhou <yongfa.zhou@intel.com>
2017-11-27 22:17:38 -05:00
Sebastian Bøe 2224e22a6f drivers: sensor: Fixed include paths s/</"/
CMake no longer adds the source directory to the system include path.

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-10 11:21:41 -05:00
Sebastian Bøe 29bb2a8fbf cmake: Fixed drivers/sensor/CMakeLists.txt
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-10 11:21:41 -05: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
Erwan Gouriou 2a7efb7419 sensors: hts221: provide name to Kconfig choice
In order to be able to default Kconfig "Trigger mode" choice
in a board Kconfig.defconfig, this commit provides it with a name.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-11-03 13:52:57 -05:00
Erwan Gouriou 2e20f49167 sensors: lis3mdl: provide name to Kconfig choice
In order to be able to default Kconfig "Trigger mode" choice
in a board Kconfig.defconfig, this commit provides it with a name.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-11-03 13:52:57 -05:00
Andrew Boie 74446381d1 sensors: move userspace handlers location
Place driver handlers with the drivers, not somewhere separate under
subsys/

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Kumar Gala 0bfd810d13 i2c: deprecate use of union dev_config
There are several issues with the dev_config union used as a
convenience when calling the i2c_configure api.  One, the union is well
name spaced protected and doesn't convey use with just i2c.  Second
there are assumptions of how the bits might get packed by the union
which can't be guaranteed.  Since the API takes a u32_t lets change in
tree uses to using the macros to setup a u32_t and make the union as
deprecated.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-10-11 10:45:12 -04: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
Punit Vara 10c1799c88 drivers: bmc150_magn: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-17 10:26:52 -04:00
Punit Vara 54b1ff3bc1 driver: bmc150_magn: Use SYS_LOG_ERR instead of SYS_LOG_DBG for errors
Converts bmc150_magn error messages from SYS_LOG_DBG to SYS_LOG_ERR.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-17 10:26:52 -04:00
Kumar Gala eb23cd2650 sensor: bmi160: Update Kconfig dependancy for SPI
The driver uses the SPI legacy API so make it depend on the SPI legacy
API being enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-09-13 11:30:35 -05:00
Anas Nashif b1991eba94 cleanup: remove the whitespaces before the # character
Indenting preprocessor directives reduces the code readability, because
it make preprocessor directives harder to spot.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 12:41:07 -04:00
Punit Vara bd359d09c8 driver: sensor: Add BMM150 Geomagnetic sensor driver
This patch implements BMM150 driver with polling mode and its tested
with original BMM150 sensor hardware. Driver works on I2C
interface as of now.

Following datasheet is taken as reference while developing driver.
http://www.mouser.com/ds/2/783/BST-BMM150-DS001-01-786480.pdf

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-05 07:56:41 -04:00
Punit Vara f60fc94abd drivers: Add apds9960 sensor in polling mode
This patch implements following functionality in polling mode.

Ambient light
RGB light
proximity sensor

Following datasheet has been used to develop driver
https://docs.broadcom.com/docs/AV02-4191EN

Jira: ZEP-1552

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-03 15:29:35 -05:00
Leandro Pereira 732424f065 drivers, net: Clean up semaphore initialization
Change the common "init with 0" + "give" idiom to "init with 1".  This
won't change the behavior or performance, but should decrease the size
ever so slightly.

This change has been performed mechanically with the following
Coccinelle script:

    @@
    expression SEM;
    expression LIMIT;
    expression TIMEOUT;
    @@

    - k_sem_init(SEM, 0, LIMIT);
    - k_sem_give(SEM);
    + k_sem_init(SEM, 1, LIMIT);

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-07-27 15:23:07 -04:00
Kumar Gala 563f8f1464 i2c: mcux: Convert to supporting device tree
Update the MCUX I2C driver and related platforms to get their I2C
information from the device tree.  We also updated a few of the sensor
drivers found on the FRDM & Hexiwear boards to get their I2C bus name
from the device tree instead of directly from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-19 14:28:08 -05:00
Andrew Boie 2d4a36fc1c drivers: use K_THREAD_STACK_DEFINE macros
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Harry Jiang 364a2ac8a1 sensor: lps22hb: fix the pressure sensor fractional value
Signed-off-by: Harry Jiang <explora26@gmail.com>
2017-06-06 22:31:10 -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
Erwan Gouriou 411919661e sensor: lis3mdl: remove use of i2c_burst_write api
i2c_burst_write API implementation in some driver
and generate a sequence of messages that does not allow to
communicate with LIS3MDL sensor. This commit replaces use
of i2c_burst_write with a call to i2c_write, which enables
sensor configuration.
Meanwhile, description of LIS3MDL is completed in sensor
header file.

Change-Id: Ib1b4643365f3c70b31fbfc4b0c30cff294b475a3
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-05-15 14:50:38 -05:00
Erwan Gouriou 8ba04d595b sensors: add lps22hb sensor driver
Support for LPS22HB Pressure and temperature sensor provided
with bare minimum features.

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

Change-Id: I14992b954053094beb054d0dba7581f6e29a3e68
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-05-15 14:50:38 -05:00
Andrew Boie 33f80d7c85 drivers: sensor: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
David B. Kinder f930480e16 doc: misspellings in Kconfig files
fix misspelling in Kconfig files that would show up in configuration
documentation and screens.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-05-05 19:38:53 -04:00
Roger Lendenmann 0bc4a88bc7 sensor: lis2dh: Add support for lis2dh accelerometer
* lis2dh 3 axis accelerometer support on SPI and I2C bus
 * data ready and anymotion type of trigger support

 Tested on Dynastream module D52QD2M4IA-A using SPI

Origin: based on Zephyr lis3dh driver

Change-Id: I2c4e9418b87f09c957bba8f73522bd78830bc809
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
2017-05-04 09:39:46 -04:00
Erwan Gouriou 933e39d2a8 sensor: lsm6ds0: fix copy/paste error
LSM6DS0 kconfig option refers to LIS3MDL sensor.
This commit fixes the issue.

Change-Id: I2867973064389cc745fcd5636e65916fcbc0ea40
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-25 19:27:22 +00:00
David B. Kinder 93e4d7258d spell: fix Kconfig help typos: /boards /drivers
Fix misspellings in Kconfig help text

Change-Id: I3ae28a5d23d8e266612114bc0eb8a6e158129dc7
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-21 21:31:30 +00:00
Kumar Gala ccad5bf3e3 drivers: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 10:06:48 -05:00
Kumar Gala 789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
David B. Kinder 896cf7a00a spell: fix doxygen comment typos: /drivers
Fix doxygen comment typos used to generate API docs

Change-Id: I6fd5051c99bdcc731740c92001e525349c254d85
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-19 10:45:34 -07:00
Kumar Gala 8814f4f7b4 Revert "drivers/sensor: Convert formatter strings to use PRI defines"
This reverts commit e60af3be66.

We revert this as we intent to move away from {u}int{8,16,32,64}_t types
to our own internal types for sized variables so we shouldn't need the
PRI macros anymore.

Change-Id: I4a57eb2c23cb1b137112224f604602d40c7cce4f
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 10:50:51 -05:00
Anas Nashif 306e15e0a1 kernel: remove legacy kernel support
Change-Id: Iac1e21677d74f81a93cd29d64cce261676ae78a6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 15:48:37 +00:00
Kumar Gala e60af3be66 drivers/sensor: Convert formatter strings to use PRI defines
To allow for various libc implementations (like newlib) in which the way
various {u}int{8,16,32}_t types are defined vary between both libc
implementations and across architectures we need to utilize the PRI
defines.

Change-Id: I69e60e3823028389b314adaf6e279fd47fde1182
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-17 11:09:36 -05:00
Anas Nashif df60826037 sensor: hp206c: sensor does not support trigger
That option was not defined and the sensor does not have this feature,
probably was part of some copy/paste mistake.

Change-Id: Ib24d1f85cf90648b01fa81b285a1ec01fe28c545
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 16:07:48 +00:00
Maureen Helm 53678df5e2 sensor: max30101: Add heart rate sensor driver
Adds basic sensor driver support for the Maxim MAX30101 heart rate
sensor.

This driver does not yet support any sensor triggers such as the data
ready trigger, or runtime changing of sensor attributes.

Default configuration values were taken from the MikroE Hexiwear driver.
https://github.com/MikroElektronika/HEXIWEAR

Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX30101.pdf

Jira: ZEP-720
Change-Id: Ie8981e124da36a56a214f133bf9a11b9f47d60fa
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-04-06 11:47:17 +00:00
Maureen Helm de64c8394c fxos8700: Fix Kconfig help indentation
Fixes the fxos8700 Kconfig help indentation to be <tab><space><space>.

Change-Id: If6e9395b5d28044962ca568be5515658e7dc2627
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-03-30 21:21:22 +00:00
Maureen Helm f38ea1636a sensor: fxas21002: Add gyroscope driver
Adds sensor driver support for the NXP FXAS21002 3-axis gyroscope.
Includes statically configurable range and output data rate, as well as
the sensor data ready trigger.

Datasheet:
http://www.nxp.com/assets/documents/data/en/data-sheets/FXAS21002.pdf

Jira: ZEP-1392
Change-Id: I84587c4d5e76863245e9d045c6abb10b21b2615a
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-03-30 21:19:53 +00:00
Anas Nashif a53bc0eef0 sensors: sx9500: varables undeclared when in debug mode
Change-Id: I1625fffbe4c1d24b7976fe5b82dafc29e8ec8350
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-25 12:00:29 +00:00
Maureen Helm 4905e400ed fxos8700: Add support for temperature
The fxos8700 is primarily an accelerometer/magnetometer, but it does
also include a temperature sensor. Note that the temperature sensor is
uncalibrated and can only be used when the magnetometer is enabled
(magnetometer-only mode or hybrid mode).

Change-Id: I74c4ae68c30e0f9836caa70baed44ad8956b17ea
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-03-23 09:41:48 -05:00
Maureen Helm 1a344ed8fc fxos8700: Use SYS_LOG_ERR instead of SYS_LOG_DBG for errors
Converts fxos8700 error messages from SYS_LOG_DBG to SYS_LOG_ERR.

Change-Id: Ic2b3245fd46372d585df81deeafb56e31cdf542a
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-03-23 09:34:08 -05:00
Dario Pennisi 8e27ad430e Added sensor driver for ADXL362
The ADXL362 is a 3-axis MEMS accelerometer.

See
http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL362.pdf

Jira: ZEP-1695
Change-Id: I29d870b59e62412452494cf0bc06eac632bebba5
Signed-off-by: Dario Pennisi <dario@iptronix.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-22 08:36:07 -04:00
Anas Nashif 4679a5f413 sensor: bme280: fixed SPI device init
Change-Id: I92bc6cbe9cc9458e0aaedf42c3821bcea91e15be
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-22 07:49:00 -04:00
Anas Nashif 3dc9af66ca sensors: BME280: added support for SPI communication
Support connection via SPI and keep I2C as the default.

Jira: ZEP-1698
Change-Id: I42a76131577a37429375364deb07e451107f5d81
Signed-off-by: Dario Pennisi <dario@iptronix.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-21 10:39:27 +01:00
Anas Nashif df16cb92d4 arduino_101: bmi160: use new device name
Use new device name for SPI device

Jira: ZEP-1704
Change-Id: Iec39468bbef54423af2b3a681dd4ae1eee866d1e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-10 16:02:22 +00:00
Baohong Liu 08f5c26115 drivers: bmi160: add sample ready check
Add sensor sample ready check before fetching the sample.
Otherwise, invalid value will be returned.

Jira: ZEP-1532 ZEP-1358

Change-Id: I570151c8ae93fbb744dac857521f596fd63806a6
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2017-02-04 19:45:31 +00:00
Bogdan Davidoaia a45dd12f0c sensor: use SENSOR_CHAN_*_XYZ instead of SENSOR_CHAN_*_ANY
SENSOR_CHAN_*_ANY will be deprecated, so use the new SENSOR_CHAN_*_XYZ
enum values.

Change-Id: I91cf25864613a934feab65588969d10c52fd4fe6
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-27 19:07:17 +00:00
Maureen Helm 8575a36dbe fxos8700: Fix broken gpio callback implementation
Fixes fxos8700_gpio_callback() to pass a pin number to
gpio_pin_disable_callback() rather than a pin mask.

Jira: ZEP-1507

Change-Id: I15bfbf4d3377f22942aa549377472d2b1142c32b
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-26 11:57:22 +00:00
Bogdan Davidoaia 9f7a643310 sensor: fxos8700: expand trigger requirement to include pulse config
The pulse config option requires triggers enabled, so expand the
trigger requirement to also include all the pulse configs.

Change-Id: Ib94f4071cac757b24bfe940ca64fd11b07fed1c1
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-24 13:45:16 +00:00
Bogdan Davidoaia 4fadbbeebd sensor: fxos8700: fix missing dependency in Kconfig
FXOS8700_THREAD_PRIORITY and FXOS8700_THREAD_STACK_SIZE need to also
depend on FXOS8700_TRIGGER, else they will not show in the fxos8700
menu entry when running "make menuconfig".

Change-Id: I8f59125157f046592f3c92dcf2a92bd0e407cd6a
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-20 14:40:40 +00:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Anas Nashif b52a5450b0 legacy: use k_cycle_get_32 instead of legacy sys_cycle_get_32
Jira: ZEP-1585
Change-Id: Idac4685625f191771b90ce78234d97f5143413f0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-17 19:03:34 +00:00
Bogdan Davidoaia 30162aedf1 sensor: remove sensor value type
Remove the type field from the sensor value structure. All values will
have the type previously defined by SENSOR_VALUE_TYPE_INT_PLUS_MICRO.

This simplifies the interface, as apps will know what value type to
expect. Apps that prefer to use double values can optain them using the
sensor_value_to_double function.

Change-Id: I3588d74258030eb16c3f89d8eead13cca4606b18
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-15 01:09:33 +00:00
Anas Nashif f6e039062a kernel: remove dependency on CONFIG_NANO_TIMERS/TIMEOUTS
Remove legacy option and use SYS_CLOCK_EXISTS where appropriate.

Change-Id: I3d524ea2776e638683f0196c0cc342359d5d810f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-08 18:09:52 +00:00
Anas Nashif e161d08756 trivial: fix typo
Change-Id: Id6f486bf151c3fb1065e9dcfae445ec120e83a62
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-08 16:17:00 +00:00
Marcus Shawcroft 98f3f3b1a5 sensor/bmc150: Fix layout.
Change-Id: Ibbf5f74b6e3298586f40e35c3cb9a2414655db41
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-05 16:19:29 +00:00
Marcus Shawcroft 8386d2f3fa sensor/bmc150: Drop unncessary external definition.
Change-Id: Ic1e85685ca50a7f2568f327a0bf211c1ef4740e3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-05 16:19:28 +00:00
Marcus Shawcroft cc7f0e05b4 sensor/nrf5_temp: Drop unncessary attribute set callback.
The sensor_attr_set() wrapper deals with drivers that do not support
the attribute set API, there is no need to provide a per driver
implementation that only return -ENOTSUP.

Change-Id: I1568ab018988fc560bd89ab96f2f2256ddd5b7e1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-05 16:19:28 +00:00
Benjamin Walsh a1622472c3 drivers: hp206 driver does not need 2000 ticks/s frequency
From code inspection, the driver always took timeouts in milliseconds.
The only sub-ms wait uses k_busy_wait(), which has microseconds
granularity, but its granularity does not depend on the system clock
tick rate.

Change-Id: If48363fd1fbeeb8e5ff0f0f2ca86e671d63bc571
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-21 19:50:06 +00:00
Benjamin Walsh e863a77849 drivers: fix timeout in hp206
It receives a timeout in ms, but was still converting it to ticks, while
the unified kernel API takes a value in ms.

Change-Id: I8ff7f44090716385764fe4b2a087043a2e0d70af
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-21 19:50:06 +00:00
Maureen Helm 31862e3a63 fxos8700: Add support for tap and double tap triggers
Adds optional support for tap and double tap sensor triggers to the
fxos8700 driver using the pulse detection hardware function.

Default configuration values were taken from NXP AN4072, section 6.3.
http://cache.nxp.com/assets/documents/data/en/application-notes/AN4072.pdf

Change-Id: Ia95091628a853eb956f6fd1df099a9e6e101b707
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-12-21 08:06:56 -06:00
Flavio Santes 5799495a5b drivers/sensor: Add the ARG_UNUSED macro
Add the ARG_UNUSED macro to avoid compiler warnings.

Change-Id: I2e0d8ccdcd2d525e109cee6c3bd1035640618eb0
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:51 +00:00
Flavio Santes 3d7d373a2f drivers/sensor/bmi160: Remove compiler warnings
Remove the unused argument and comparing int to unsigned int
compiler warnings.

Change-Id: Iad79ec2ef8206b2494875a93551a0f47e234ff8d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:51 +00:00
Anas Nashif a9e879e273 logging: move sys_log to subsys/logging
Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:39 +00:00
Baohong Liu f2c1b4bb02 drivers: bmi160: use direct GPIO trigger instead of IPM
Directly use AON GPIO trigger instead of IPM.

In the past, SW did not allow arc to receive AON GPIO interrupt.
So, interrupt from BMI160 was routed to x86 cpu. Then, x86 cpu
passed the event to arc through IPM. But, SW was updated and arc
is able to directly receive interrupt from AON GPIO now. So, IPM
is not needed any more. Let's remove IPM related code and use
GPIO as the default trigger source.

This change is on top of the bmi160 sample app change to not use
IPM.

Change-Id: I49d8040764d03b24e09d89e66643c020ef63a3c9
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-16 15:56:33 +00:00
Qiu Peiyang 597349207a drivers: sensor: replace device sync APIs with semaphores
Device sync APIs are actually wrappers for semaphores.
Let's replace them with semaphores.

Jira: ZEP-1411

Change-Id: I77c5c749f9e263f172d2ea7c0c0088eb9e68d235
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-12-16 13:30:30 +00:00
Bogdan Davidoaia de4727ba3f sensor: update drivers to not return double values
Update drivers to return INT_PLUS_MICRO values instead of doubles.

This hides the fact that the drivers use floating point operations and
doesn't force the application to use them as well.

Change-Id: I14c6faecb35331c2fdbdab41bc624d751de984b8
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-12-13 21:51:11 +00:00
Bogdan Davidoaia 708fe8c1e3 sensor: use integers for simple value calculations
Use integers for sensor value calculations in which doubles are not
required.

Change-Id: I8662023ca596cb232e31849b0b77ae2bf0372cf0
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-12-13 21:51:10 +00:00
Bogdan Davidoaia 4946e3e6e6 sensor: remove SENSOR_VALUE_TYPE_INT
Remove SENSOR_VALUE_TYPE_INT as it is the same as
SENSOR_VALUE_TYPE_INT_PLUS_MICRO with val2 set to 0.

Change-Id: If5a9c579b7267701c27f40fd887acae47d64edc5
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-12-13 21:51:10 +00:00
Sergio Rodriguez 1e2e05c784 drivers: sensor: fxos8700: Fix uninitialized variable
This issue was reported by Coverity

Coverity-CID: 157621

Change-Id: I7f84c0868467ab55e033aecac037967da001a6db
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-12-13 11:36:27 +00:00
Marcus Shawcroft a94437c03c sensor: Add nRF5 temperature driver.
Basic interrupt driven driver for the nRF5 onboard temperature sensor.

Change-Id: Id0ac303293b8e8b8285b19bcda31284ee6617105
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-11 11:14:05 +00:00
Baohong Liu b3195581e7 drivers: sensor: add missing license header
Change-Id: I0d666ba8a83ea523dd15cdc94f0565fee9f7288e
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-09 17:39:05 -08:00
Flavio Santes b04cdcd6e6 drivers: Remove legacy nanokernel.h include
This commit replaces the nanokernel.h include by kernel.h.

Change-Id: Ib42fbf2d9f77a73c0831f569b3dbbfb342ea2e1d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-04 14:59:37 -06:00
Maureen Helm 550b02e438 fxos8700: Add support for data ready trigger
Adds general sensor triggering support to the fxos8700 driver, including
options for the driver to use its own thread or the global workqueue
thread to handle sensor interrupts. Adds specific support to handle the
data ready sensor trigger.

Jira: ZEP-1395
Change-Id: I092f22e35747b92a88eb71a3d162a4fc16227b45
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-12-04 12:37:47 +00:00
Anas Nashif 91b47b9d3c sensors: change init level from NANOKERNEL to POST_KERNEL
Change-Id: Iba788e2b0b60d89e6b9bf6f5de73ff2f5cdbebbc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 15:52:34 +00:00
Baohong Liu 313700e26f drivers: sensor: use unified kernel API
Change-Id: I5d51e65105f9dee3d5eb49c60b9e5636ebd14df6
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-30 23:54:58 +00:00
Qiu Peiyang 3763487575 sensor: fix typo in Kconfig
Change-Id: I0fc7e0f66ba994f42a04684e4862fc3218ddd075
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-11-29 12:59:35 +00:00
Marcus Shawcroft 7df7862749 sensor/bmc150: Limit name space, add static.
Change-Id: Ifd9ec1aec4e6486c14121b30bcd009b61456276d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft c3b2861572 sensor/bmc150: Fix filename in comment.
Change-Id: I0a5aaf0f3633034fabef351dc419899f9bb9c8fd
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft 91bc741255 sensor/bmc150: Fix logging configuration.
Change-Id: Iae06066b568f51c8b63f00e973a411dcbb396dac
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft 40d2572d12 sensor/lsm9ds0_gyro: Limit name space, add static.
Change-Id: Ifff624a2c0f619d7bb3e005b4e52b4602730a66d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft 8f92c5462e sensor/lsm9ds0_gyro: Fix filename in comment.
Change-Id: I6de8806fbe6ec25c83042bc52274fd91a76ae280
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft 9048cb91d0 sensor/lsm9ds0_gyro: Fix logging configuration.
Change-Id: I332d9515e61d83f243f49353d4b67f854fec7f2e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft 744e438a33 sensor/lsm9ds0_mfd: Fix logging configuration.
Change-Id: I925a683e0ac961f05065b25782fc30d007e1aba6
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft aba867d5e9 sensor/fxos8700: Switch to generic SYS_LOG_SENSOR_LEVEL
Change-Id: I21607836b2fe0cd1cd62759bed499af70a93e1be
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft f112e8e9bc sensor/lps25hb: Limit name space add static.
Change-Id: I707fd3666f27a982f9b4ef0facf7a3a211db8914
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft 5fe0a759ee sensor/lps25hb: Fix filename in comment.
Change-Id: Ie5529544248d408cb314be83a609b8d1d9ecaaa5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft 052a67f88d sensor: Remove unsued LPS25HB_SYS_LOG_LEVEL config.
Change-Id: I5af84fd420a9c50f943938faf7ed966385c19f08
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft 14cd63a92a sensor/lsm6ds0: Limit name space, add static.
Change-Id: I227865ebbb6bf66b63694639dede3f0276c4cf22
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft 9dc050d15e sensor/lsm6ds0: Fix filename in comment.
Change-Id: I50df25c209c322f404e7a78c5df57c2c7d75964b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft 79a4d35043 sensor: Remove unsued LSM6DS0_SYS_LOG_LEVEL config.
Change-Id: I7b994b33a1202cbc75a8ce5afd0385a45627f45d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:26:53 +00:00
Vincenzo Frascino ceca10828a sensor: Fix Unchecked return value in bma280 driver
This patch fixes two "Unchecked return value" conditions into the bma280
driver.

The issue was reported by Coverity (CID 151953).

Change-Id: I2e595b67619411594cec527f358f6c3d3d034550
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 13:30:11 +00:00
Baohong Liu d6ba1c0c3e drivers: bmi160: fix variable type mismatching issue
The variable type mismatching was caught by LLVM.

Jira: ZEP-1179

Change-Id: I1193a946ea5814510e6c07668c5d05a5d91445a8
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-16 02:08:21 +00:00
Sergey Kiselev 2e10266975 sensors: bme280: fix typo in reading trimming parameters
Change-Id: I32e72c2845bd06b10585ac8048f67ac754c2a6d6
Signed-off-by: Sergey Kiselev <sergey.kiselev@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-16 01:37:54 +00:00
Vincenzo Frascino 34b7fbfca7 sensor: Fix Unchecked return value issues in bme280 driver
This patch fixes unchecked return value conditions in the bme280
driver.

This issue was reported by Coverity (CID 151961, 151959, 151955).

Change-Id: I3a2dfbabd41ae52b00fa512a40e00c2e36c3b5ca
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 00:42:22 +00:00
Vincenzo Frascino 5912d7abe7 sensor: Fix less-than-zero comparison in bmi160 driver
This patch fixes a less-than-zero comparison of an unsigned value
condition present in bmi160 driver.

This issue was reported by Coverity (CID 152002, 152003).

Change-Id: I703066519652ac1ecdd9ddf7e97ec7dcbe2a9e27
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 00:42:21 +00:00
Anas Nashif 55273b0c76 drivers: sensor: use unified timer struct name in header
Change-Id: I2d2a1689d66ed4a9ab1ce1ed5bb70c8b65f7df31
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-13 13:53:52 +00:00
Anas Nashif 3fe2575f0d drivers: sensors: use unified kernel threads
convert all sensor drivers to use threads and the unified kernel API and
remove all legacy APIs.

Change-Id: Ica43ea74ecbbf85273f718f182c413a9dcd8abc6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 21:00:19 +00:00
Anas Nashif 8910c228a2 sensors: use unified kernel APIs for kernel objects
move both semaphores and nano_work objects to unified kernel APIs.

Change-Id: Icca8a091063544c451e47201cd8e956b95010513
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 21:00:19 +00:00
Andrew Boie 0b474eef9c kernel: deprecate old init levels
PRIMARY, SECONDARY, NANOKERNEL, MICROKERNEL init levels are now
deprecated.

New init levels introduced: PRE_KERNEL_1, PRE_KERNEL_2, POST_KERNEL
to replace them.

Most existing code has instances of PRIMARY replaced with PRE_KERNEL_1,
SECONDARY with POST_KERNEL as SECONDARY has had a longstanding bug
where the documentation specified SECONDARY ran before the kernel started
up, but actually ran afterwards.

Change-Id: I771bc634e9caf7f17dbf214a270bc9967eed7d32
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-09 17:59:44 +00:00
Benjamin Walsh 8cf56bcac7 unified: dissociate system workqueue from common workqueue module
Making a reference to the common work queue code should not necessarily
drag in the system workqueue, since it is possible to use a workqueue
that is not the system workqueue. This is done by moving the system
workqueue into its own code module.

Moving the system workqueue to its own code module allows removing the
NANO_WORKQUEUE and SYSTEM_WORKQUEUE kconfig options, and compiling the
common workqueue code and system workqueue all the time. They are only
linked in the final image if a reference to them exist, same as the
other kernel modules.

Change-Id: I6f48d2542bda24f4702e7c2e317818dd082b3c11
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-04 22:39:54 +00:00
Maureen Helm 3bdc77ee09 sensor: fxos8700: Add accelerometer/magnetometer driver
Adds basic sensor driver support for the NXP FXOS8700 6-axis
accelerometer/magnetometer. Currently this driver supports
accelerometer-only, magnetometer-only, and hybrid (accelerometer +
magnetometer) modes, as well as 2g, 4g, and 8g accelerometer full scale
ranges.

This driver does not yet support any sensor triggers such as the data
ready trigger, or runtime changing of sensor attributes.

Datasheet:
http://cache.nxp.com/files/sensors/doc/data_sheet/FXOS8700CQ.pdf

Origin: Original
Jira: ZEP-721

Change-Id: Iff0f751c737196f60d5c5d3448631b57093ece34
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-10-27 14:36:43 +00:00
Marcus Shawcroft 1a13bb8c40 sensor/hp206c: Limit namespace, add static.
Change-Id: I08d0029fae70434794e09a7c9563383d1db58fe0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 16:52:15 -04:00
Marcus Shawcroft a2e91dadb3 drivers/hp206c: Make driver_api structure const.
Change-Id: I6e3c7e4e420d9b9c55bbb49cf6f13b6e09ec4bb7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-26 16:52:15 -04:00
Marcus Shawcroft 2030855399 sensor/hp206c: Correct the SYS_CLOCK_TICKS_PER_SEC diagnostic text.
Correct the text of the SYS_CLOCK_TICKS_PER_SEC #error diagnostic to
reflect the actual logic of the gate.

Change-Id: I28ad324b0b246e4a8de29b64483a97577a1b6fb7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:09 +00:00
Marcus Shawcroft 94e460a92c drivers/isl29035: Make driver_api structure const.
Change-Id: If1d0adeee94663d84049bd8de0de529672ce4dbf
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:01 +00:00
Marcus Shawcroft 3eedeee041 drivers/hts221: Make driver_api structure const.
Change-Id: I81f6d0220ce95cbdb1f3e2b754164a6fd54d0796
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:47 +00:00
Marcus Shawcroft 2696170f11 sensor/th02: Make driver_api structure const.
Change-Id: I6493e84dabafcd301ad6e55d09fd69e02c513294
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:47 +00:00
Marcus Shawcroft 1aa7cbdae7 sensor/sht3xd: Make driver_api structure const.
Change-Id: I66c1fbad5e10a47019a6de00f0420c088954d0ff
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:46 +00:00
Marcus Shawcroft 1dddd19810 sensor/tmp112: Make driver_api structure const.
Change-Id: I32e53df25364572427be87716864118740da8f99
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:40 +00:00
Marcus Shawcroft 90d4354eef sensor/tmp007: Make driver_api structure const.
Change-Id: I1bdffc48038bc2221ce8f610e857f0be10d90987
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:39 +00:00
Marcus Shawcroft 593c2621a3 sensor/sx9500: Make driver_api structure const.
Change-Id: I96c17c776f37a63dd309c2cd4208239673033c14
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:39 +00:00
Marcus Shawcroft b230c98518 sensor/mpu6050: Make driver_api structure const.
Change-Id: I25a3d1ddbaae101043c5aaaeb0777c74df89242c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:38 +00:00
Marcus Shawcroft 5a1d4a2fd1 sensor/mcp9808: Make driver_api structure const.
Change-Id: Id27a5a5bb085a78747fea32bf94f9552a5e01f33
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:38 +00:00
Marcus Shawcroft 74acab89bc sensor/max44009: Make driver_api structure const.
Change-Id: I4e1226f30b420e7b26d8290543877a7b87665ec5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:37 +00:00
Marcus Shawcroft 38fac62e49 sensor/lsm9ds0_mfd: Make driver_api structure const.
Change-Id: Ifacfff048c95d7ac7061eadbaee2a15b1c01e9db
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:37 +00:00
Marcus Shawcroft f58647788a sensor/lsm9ds0_gyro: Make driver_api structure const.
Change-Id: I51947ce5f01b7ff615cca198b82b1aafe7e7d90e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:36 +00:00
Marcus Shawcroft 1c57f39633 sensor/lsm6ds0: Make driver_api structure const.
Change-Id: I5e689cc7c33ec471379f7506653a4627f983d4d9
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:36 +00:00
Marcus Shawcroft 409d6f87a5 sensor/lps25hb: Make driver_api structure const.
Change-Id: I8c11616b7c57ea165a358b446ea595e73a99e90b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:36 +00:00
Marcus Shawcroft b908f536d3 sensor/lis3mdl: Make driver_api structure const.
Change-Id: I4e6bb185c3ac1fe8f0bd5d186d5dc1c79274078e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:35 +00:00
Marcus Shawcroft 7b92b59c83 sensor/lis3dh: Make driver_api structure const.
Change-Id: Ieaaa1c4cb0268dd18a50e5ced338aa60320d6885
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:35 +00:00
Marcus Shawcroft bb08e1b524 sensor/hmc5883l: Make driver_api structure const.
Change-Id: I4a78f01126055518251c9f6d864174552604fa8b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:34 +00:00
Marcus Shawcroft ccd28b9523 sensor/hdc1008: Make driver_api structure const.
Change-Id: If2c79c29957a49a4fee492d0235060c653d1ef70
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:34 +00:00
Marcus Shawcroft dbb5380020 sensor/dht: Make driver_api structure const.
Change-Id: I49b4a0cc4342cb51e0bbf6ea925da1ae3f55ff78
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:33 +00:00
Marcus Shawcroft 0496b95391 sensor/bmi160: Make driver_api structure const.
Change-Id: I195f9ab2d3668d61c8fbdec5a3f3fa390b81948e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:33 +00:00
Marcus Shawcroft 1f2b984ece sensor/bmg160: Make driver_api structure const.
Change-Id: Iebf5d8dbe652a6839ba435720029b568ab0d7d87
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:32 +00:00
Marcus Shawcroft 1836c61d43 sensor/bme280: Make driver_api structure const.
Change-Id: I8fe4e4a9be88eb07f438e4c580d25fe9deedc343
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:32 +00:00
Marcus Shawcroft 3d8626e95c sensor/bmc150: Make driver_api structure const.
Change-Id: I9c7df241d66e7cc78330d2de3d3a3d1f3be4151f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:31 +00:00
Marcus Shawcroft 4be15a986c sensor/bma280: Make driver_api structure const.
Change-Id: Ia7601a99ca888b582227a0acea42ebd4018e5c44
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:31 +00:00
Marcus Shawcroft beacd063f8 sensor/ak8975: Make driver_api structure const.
Change-Id: I289f9ef59059cd7ed98e6644be2697d2f4d78ced
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:30 +00:00
Marcus Shawcroft 681a4df787 th02: Limit name space pollution by using 'static'
The name read16() collides with other definitions within Zephyr.  We
don't actually use this function here, so remove the definition.  Fix
various other unnecessary name exports while we are here by adding
'static'.

Change-Id: I7eee8c527a62fea4e6e1bdae8a4874d8ce66596c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-24 20:10:15 +00:00
Marcus Shawcroft abefffeda6 hdc1008: Limit name space pollution by using 'static'
The read16() name collides with other definitions within zephyr.  Make
it static and fix a few other unnecessary name exports while we are
here.

Change-Id: Id72d44a6b84b8d72c7ba2d0f34b29dbc1d02f2b6
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-24 20:10:15 +00:00
Marcus Shawcroft c7b0aaeb07 sensor/lsm9ds0_mfd: Make driver config_info structure const.
Change-Id: I1c8790feda28ccd29f9c3df1579b596dec7ee663
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:59 +00:00
Marcus Shawcroft 78f07b2b9a sensor/lsm9ds0: Make driver config_info structure const.
Change-Id: I126f0c8f2e8ecfa43740d70464f2829197000ef1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:59 +00:00
Marcus Shawcroft 515443f154 sensor/lsm6ds0: Make driver config_info structure const.
Change-Id: I2bb46ce28d5a74e152106301f358878cd8edc03b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:59 +00:00
Marcus Shawcroft 5cafbed740 sensor/lps25hb: Make driver config_info structure const.
Change-Id: I30af3ff45c1b12a6c9392a021d8ef6bfcaa53772
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:58 +00:00
Marcus Shawcroft 3b678f53fe sensor/bmi160: Make driver config_info structure const.
Change-Id: Ia4f5333f9440712224f07a517229f7d3b2dd92f7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:58 +00:00
Marcus Shawcroft 4577987ba7 sensor/bmg160: Make driver config_info structure const.
Change-Id: If39f09baa757623ea9ed550df0809b863b1cb8a2
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:57 +00:00
Marcus Shawcroft 07fd1b7746 sensor/bmc150: Make driver config_info structure const.
Change-Id: I375b8b08811c21a888d49e2b98c6a7a056520ce4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:57 +00:00
Bogdan Davidoaia f0bc96ee8c sensor: hdc1008: add missing dependency for I2C address config
The HDC1008_I2C_ADDR config option should be available only if HDC1008
is enabled.

Change-Id: I0d1813512396faefb609527ba5df2a0c4ea159a9
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-10-20 09:44:40 +00:00
Anas Nashif 71d6ad2619 sensors: bmi160: remove unused init priority config
Change-Id: I367d7b084fb93609000066b610e01a802fdd152e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-20 09:39:51 +00:00
Anas Nashif 348e61dcdc sensors: tmp112: move tmp112 to own directory under drivers/sensor/
Change-Id: I85023f60ee3c5303a6c065f8ee1b238106b13e49
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 14:49:56 -04:00
Anas Nashif 623b43f5dc sensors: tmp007: move tmp007 to own directory under drivers/sensor/
Change-Id: If5fd1277ec93455ee7a1e856357dfab0930a653c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 14:41:21 -04:00