Commit graph

1951 commits

Author SHA1 Message Date
Anas Nashif c31bbc32d8 sensors: bma280: move bma280 to own directory under drivers/sensor/
Change-Id: I1c73d36a51ea88fbda3707c7d6630d54f8fd3545
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:51 +00:00
Anas Nashif db04446964 sensors: ak8975: move ak8975 to own directory under drivers/sensor/
Change-Id: Ib3a8e8a74430d30843db77954737c3ce5dfdce14
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:51 +00:00
Anas Nashif 915eac4625 sensors: add TH02 temperature sensor (Grove)
Support for the Temperature&Humidity Sensor (High-Accuracy &Mini)
v1.0 sensor, see:

http://wiki.seeed.cc/Grove-TemptureAndHumidity_Sensor-High-Accuracy_AndMini-v1.0/

Change-Id: I439eafc863116f21e3b3385175d1935e60a5e9b1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 00:24:33 +00:00
Marcus Shawcroft 67d6b592cf sensor/lsm9ds0_gyro: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I8fd83236ecf5357a0a192650a26e91045a6116a7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:34:01 +00:00
Marcus Shawcroft cfb5196f07 sensor/lsm9ds0_gyro: Fix failure to compile, undefined CONFIG_LSM9DS0_SENSOR_INIT_PRIORITY
Change-Id: Ibaeaa1a7df692c044310ba116285e1898d806d0e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:34:00 +00:00
Marcus Shawcroft dee749b213 sensor/lsm64s0: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: If977cc39bab3e838d1ff6d8de2cb4b667974ee17
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:59 +00:00
Marcus Shawcroft db35cc6838 sensor/bmi160: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: Ia4639d65ab4ee64a2ee0ba41677bab40894d65b4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:55 +00:00
Marcus Shawcroft a6f681c782 sensor/bmg160: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I2e9b7e7e8245e60e66554b4d631d71a453cf7ffd
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:54 +00:00
Marcus Shawcroft 1ec5093c04 sensor/bmc150: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: Ic4563561cff930533e920031767218023d4746b0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:53 +00:00
Marcus Shawcroft 58c8199aa6 sensor/lps25hb: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I9f510669710ae8fab897d4047e4d7324c3a84e00
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:52 +00:00
Marcus Shawcroft 6cfe874a0f sensor/lsm9ds0_mfd: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I3b781f09e15d57ae4d00c11d6b7a328b31bc25aa
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:51 +00:00
Anas Nashif 16c5416d70 sensors: use one single sys log config for sensors
Change-Id: I27aadd15ad0ebbaf6373591d52e63fe3f4560378
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 16:15:54 +00:00
Anas Nashif e3706c98f3 sensors: cleanup duplicate includes
zephyr.h includes nanokernel.h which includes cpu.h, so make it
simple and just include nanokernel.h. zephyr.h should only be
included in applications.

Change-Id: I11a9ad8608d23af4f2a40a97eb71c09516c3399b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 14:07:26 +00:00
Marcus Shawcroft fccfbf2e21 sensor: Fix Kconfig LSM9DS0_MFD I2C slave address type
Change the Kconfig parameter type for the I2C slave address from
string to hex.  The code that consumes this configuration parameter
expects an integer and fails to compile when presented with a string.

Change-Id: I493002ea6f1266344cac863ac305e59e93a5b1fe
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 10:34:36 +01:00
Anas Nashif f320338066 sensors: do not use choice for I2C address
Set the value for the I2C address directly and use only
one per sensor.

Change-Id: I24d06a964e8e372eddf262b70fe5d9854a04563c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-06 04:17:52 +00:00
Anas Nashif efd6b94929 sensors: HDC1000: check for manufacturer and device IDs
Make sure we are connected to the right device.

Change-Id: I09e696563191392d23a316ad065bb7e320df76bb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-06 04:17:44 +00:00
Anas Nashif 6a534710c0 sensors: use one init priority config for all sensors
Sensors are end-devices and usually nothing depends on them,
so set a global priority for all sensors and use it instead of
individual values per sensor.

Change-Id: I5847411e783ef8a8517f0ab1d8234810513707b4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-05 23:01:23 +00:00
Javier B Perez 453d172bff sensor: HP206C: fix kconfig sys log help
Changed help message to be in compliance with the rest of sensors.

Change-Id: Ia18f7623eda5f86fe6f7d99ac934f1a9beda55a8
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-09-12 10:35:41 -05:00
Laurentiu Palcu 3ef2e059c3 sensor: add driver for HP206C sensor
This sensor is a high precision barometer, altimeter and temperature
sensor. It can also be found on the Grove Barometer module (v1.0).

Sensor datasheet:
http://www.hoperf.com/upload/sensor/HP206C_DataSheet_EN_V2.0.pdf

Grove link:
http://www.seeedstudio.com/depot/Grove-Barometer-HighAccuracy-p-1865.html

Origin: Original
Change-Id: I99986b26b6b4447e31e12a1fc17ede3e6bb4c586
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-09-12 12:18:55 +00:00
Bogdan Davidoaia 966118ee18 sensor: hmc5883l: fix data sample axis order
The data sample registers are ordered as X, Z, Y (not X, Y, Z), so the
driver also needs to extract the sample components in this order.

Jira: ZEP-679

Change-Id: I317994bb545539b049e2ebf3d2af94e63c7d2511
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-08-11 17:29:50 +00:00
Baohong Liu 538d8d184d sensor: fix BMI160 sensor hang issue
Fix several issues which are causing the BMI160 app hang.

For SPI duplex transfer, QMSI only supports equal length.
For SPI freq, divider is used. Actual freq is no longer used.

Jira: ZEP-461

Change-Id: I1a1bcc12c6514c3797686dfdad1ce1b852f7dc78
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-08-05 17:35:42 +00:00
Javier B Perez dfc15d3a48 driver: sensor: lsm6ds: remove dead code by kconfig options
Removed dead code inside sensor_lsm6ds0.h. There is no kconfig option
CONFIG_LSM6DS0_I2C_ADDR_6A neither 6B.
Also the #define LSM6DS0_I2C_ADDR is not in use.

Change-Id: Ib5a7f40d0d61542ed81687227df3795ba52ec725
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-08-02 06:47:39 +00:00
Javier B Perez 33f048073f sensor: isl29035: fix undefined CONFIG LUX RANGE 4k in elif
Fixed undefined CONFIG_ISL29035_LUX_RANGE_4 in #elif

Change-Id: I2a7a6e46ffa0236da126d4e2c321e59302e54527
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-07-28 15:40:13 +00:00
Kumar Gala 902ddbe9c7 sensor: max44009: Fix Kconfig dev name typo
Code was using CONFIG_MAX44009_I2C_MASTER_DEV_NAME which doesn't exist.
Use CONFIG_MAX44009_I2C_DEV_NAME instead.

Change-Id: I6bf6eedd2229bb91f64264dc5b32e4a3c00921b6
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-28 07:21:49 -05:00
Andrew Boie 0529c931a0 sensors: fix incorrect use of __ASSERT
__ASSERT was being used when __ASSERT_NO_MSG was appropriate.
This problem was previously only visible if CONFIG_ASSERT=y,
but a recent change to the assert macros fixed them so they
can't be improperly used with assertions disabled either.

Change-Id: I1e13c796873d79826d177a01246d2ca0e8f0a107
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-27 16:56:08 -07:00
Murtaza Alexandru 0c83039a67 sensor: add driver for LPS25HB
Add driver for LPS25HB pressure and temperature sensor.

Datasheet:
http://www.st.com/content/ccc/resource/technical/document/datasheet/9a/4c/aa/72/1f/45/4e/24/DM00141379.pdf/files/DM00141379.pdf/jcr:content/translations/en.DM00141379.pdf

Change-Id: I6b616e879777b52f16f4e867c330e8beacf59fd3
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-07-21 16:22:03 +00:00
Andrew Boie df72692fb6 sensor_bmi160: fix incorrect use of __ASSERT()
Change-Id: Ieb1d8b1aed3e9906d1377e1e4117b69eb8cae751
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-20 22:00:44 +00:00
Baohong Liu a3488d13e0 sensor: add driver for MAX44009 light sensor
Add device driver for MAX44009 light sensor

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

Jira: ZEP-357

Origin: Original
Change-Id: I6b5c8e0afc36c22de0a6432d01cd5b7eb2e12f1b
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-07-12 19:31:09 +00:00
Mariusz Ryndzionek 57afc5f851 sensor: tmp112: use arithmetic_shift_right helper function
Use the function provided in misc/util.h to do the sample
conversion.

Change-Id: I21179982b6001bf79448e4eb289e9cffaf97f3fb
Signed-off-by: Mariusz Ryndzionek <mariusz.ryndzionek@firmwave.com>
2016-07-06 22:04:25 +00:00
Bogdan Davidoaia e8d0090808 sensor: tmp007: fix negative sample values bug
Fix bug that caused negative temperature values to be computed incorrectly.
The sign bit needs to be perserved, when extracting the data sample from
the TMP007_REG_TOBJ register.

Jira: ZEP-499
Change-Id: Idbebd48b3164d7d4883352ef7128ef73be70e1b2
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-30 17:50:05 +00:00
Mariusz Ryndzionek 65cc01ac16 sensor: adjust Kconfig file formatting
Add hyphens so that the .rst file is formatted properly

Change-Id: Ic798590d4a892f4f4d5312e86949db23a3b3abe0
Signed-off-by: Mariusz Ryndzionek <mariusz.ryndzionek@firmwave.com>
2016-06-30 17:49:50 +00:00
Mariusz Ryndzionek c8a589e06e sensor: add driver for TMP112 temperature sensor
Add device driver for the TMP112 I2C temperature sensor

Datasheet:
	http://www.ti.com/lit/ds/slos887d/slos887d.pdf

Change-Id: I08208204cd8f377dc65378aaf2b92c7cdefe8d2b
Origin: Original
Signed-off-by: Mariusz Ryndzionek <mariusz.ryndzionek@firmwave.com>
2016-06-29 05:09:11 +00:00
Bogdan Davidoaia 4f80a44b1b sensor: add driver for HMC5883L magnetometer
Add driver for the I2C-based Honeywell HMC5883L magnetometer.

Datasheet:
	https://cdn-shop.adafruit.com/datasheets/HMC5883L_3-Axis_Digital_Compass_IC.pdf

Change-Id: I9ad56a7533d8d67402aa2ae2862ba339b04d3525
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-29 04:58:44 +00:00
Kumar Gala 556b66f468 More cleanup whitespace in Kconfig files
Some additional whitespace converted to TABs

Change-Id: I945383f70960ad97e9cbc11ea96b099bcc558404
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-06-01 22:39:54 +00:00
Bogdan Davidoaia 4b00a69989 sensor: hts221: fix sensor type in Kconfig
The driver for the HTS221 sensor was added with the wrong type stated in
the Kconfig file, as it is a temperature and humidity sensor and not a
magnetometer.

Change-Id: Icc50c9b7ccc491b1c22e13d00607123a45338b11
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-01 14:25:27 +00:00
Murtaza Alexandru b3a485147f sensor: add driver for LSM6DS0
Add driver for LSM6DS0 accelerometer, gyroscope and temperature sensor.

Change-Id: Ic04fa8d0bbf935e7f04ed7981554d8095ceb5ccf
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-06-01 11:48:50 +00:00
Bogdan Davidoaia caa506102e sensor: ak8975: add support for MPU9150
The AK8975 chip can be packaged together with a MPU6050 chip, resulting
in a MPU9150 chip. In this format, the MPU6050 part of the MPU9150 chip
needs to be turned on and pass-through mode enable in order to communicate
with the AK8975 chip.

Datasheet:
	http://43zrtwysvxb2gf29r5o0athu.wpengine.netdna-cdn.com/wp-content/uploads/2015/02/MPU-9150-Datasheet.pdf

Register Map:
	http://43zrtwysvxb2gf29r5o0athu.wpengine.netdna-cdn.com/wp-content/uploads/2015/02/MPU-9150-Register-Map.pdf

Change-Id: I120dff11c187689e2e6968c812aae2e3e3578bc6
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-01 14:02:20 +03:00
Bogdan Davidoaia c4c01a92f3 sensor: add driver for AK8975 magnetometer
Add driver for the AK8975 3-axis electonic compass.

Datasheet:
	http://www.akm.com/akm/en/file/datasheet/AK8975.pdf

Change-Id: I427f954396c8991a153e4447d746b855d19cb60d
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-01 14:02:20 +03:00
Bogdan Davidoaia 01062d97aa sensor: add driver for MPU6050 sensor
Add driver to MPU6050 six-axis motion tracking device. The driver has support
for accelerometer, gyroscope and temperature channels.

Datasheet:
	http://43zrtwysvxb2gf29r5o0athu.wpengine.netdna-cdn.com/wp-content/uploads/2015/02/MPU-6000-Datasheet1.pdf

Register Map:
	http://43zrtwysvxb2gf29r5o0athu.wpengine.netdna-cdn.com/wp-content/uploads/2015/02/MPU-6000-Register-Map1.pdf

Change-Id: Id3930fc666195051093fee80c15cf2deb0eaedff
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-01 14:02:13 +03:00
Bogdan Davidoaia 34f63de901 sensor: add driver for HTS221 sensor
Add driver for HTS221 temeprature and relative humidity sensor.

Datasheet:
	http://www.st.com/resource/en/datasheet/hts221.pdf

Interpreting humidity and temperature readings document:
	http://www.st.com/resource/en/technical_note/dm00208001.pdf

Change-Id: I1fee9d8372ad71b22bc85a60939c82f81569e135
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-05-29 22:25:19 +00:00
Bogdan Davidoaia a2605e50d7 sensor: add driver for LIS3MDL magnetometer
Add driver for the LIS3MDL ultra-low-power high-performance three-axis
magnetic sensor.

Datasheet:
	http://www.st.com/resource/en/datasheet/lis3mdl.pdf

Application note:
	http://www.st.com/resource/en/application_note/dm00136626.pdf

Change-Id: Id2d65e7525bef6c4fe50f86169a80f84197f8983
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-05-29 22:25:03 +00:00
Kumar Gala 9ec2f3be80 Cleanup whitespace in Kconfig files
Convert leading whitespace into tabs in Kconfig files.  Also replaced
double spaces between config and <prompt>.

Change-Id: I341c718ecf4143529b477c239bbde88e18f37062
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-05-25 13:28:07 -05:00
Murtaza Alexandru c4425fd816 sensor: fix typo resulting in compile error
Fix a compile error when trying to set I2C address of LSM9DS0 Gyro to
VCC (0x6B) caused by a typo.

Change-Id: I27850ecd70e715a10b96572aedea0d237dd55cd5
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-05-24 11:36:33 +00:00
Bogdan Davidoaia 72786486c6 sensor: remove CONFIG_SENSOR_DEBUG
Remove the CONFIG_SENSOR_DEBUG as it is no longer needed since switching
to SYS_LOG_* in the sensor susbsystem.

Also, use __ASSERT where CONFIG_SENSOR_DEBUG was used to validate
function parameters.

Change-Id: I80ed7209abfb92220fa229d246c5b3a43b887e32
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-05-21 21:20:13 +00:00
Murtaza Alexandru 310ed1e2e9 sensor: add support for BME280
* Rename BMP280 to BME280 which is a superset for the former.
* Autodetect device based on chip ID.
* Implement humidity fetching and reading for BME280
* Rename sample BMP280 to BME280

Change-Id: I565c769a7011e7496c9f1cad861d5ee311839b4f
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-05-17 20:07:34 +00:00
Murtaza Alexandru 261a448f33 sensor: remove unnecessary return variables
Remove unnecessary return variables (ret/rc) to reduce memory footprint.

Change-Id: Ifc22fd993b4f8f2d0cf992f620f53cc510add1fa
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-05-17 20:07:29 +00:00
Murtaza Alexandru 2d7ae8b249 sensor: migrate all drivers to new error code standard
Check if return value is negative when checking for errors, instead of
checking if it's 0.

Change-Id: I0b0af28c02b3760f3128e8cbe48908dabc89af88
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-05-17 20:07:24 +00:00
Murtaza Alexandru df20e3e4a7 sensor: add support for *_ANY get channel
Update all drivers that have vectorial data to return all 3 channels (X,
Y and Z) if the chan parameter is _ANY.
Also fix a compile bug in LSM9DS0 MFD driver.

Change-Id: I5bf261846bcd68c288b96997ff164726f75c151c
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-05-17 20:07:05 +00:00
Bogdan Davidoaia c9caf1806a sensors: add driver for DHTxx sensors
Add driver for the DHT temperature and relative himidity sensor family.
The sensor has a single signal pin (in addition to GND and VDD) over
which communication is done in a half-duplex manner (see datasheet for
more details).

Datasheets:
	http://www.micropik.com/PDF/dht11.pdf
	https://www.sparkfun.com/datasheets/Sensors/Temperature/DHT22.pdf
	http://akizukidenshi.com/download/ds/aosong/AM2302.pdf

Origin: Original
Change-Id: If8c8be73d7fdfef2ab2091bf9b8fe72bcd700ed1
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-05-14 00:31:43 +00:00
Vlad Dogaru 3a66946b0f sensor: Rework core to use workqueue API
Remove the homegrown sensor delayed work API in favor of using the
system-wide workqueue.  Drivers still have the option of using their own
fiber.

In a second step, drivers can be refactored to start and use their own
workqueue.

Change-Id: I70dea6fc2abcbc9e04ac1ed3c837483a3d3c4424
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-05-12 15:27:40 +00:00
Vlad Dogaru 77850daf11 sensor: sx9500: fix compile error
Looks like this snuck in with the GPIO API migration.

Change-Id: Ib58142e134a779431bacf9ca75a66541bf63d5b0
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-05-05 19:06:16 +00:00
Vlad Dogaru 149decdcf5 sensor: bmg160: fix compile error when not using trigger
Change-Id: If681ace87439daf6e6aa0ad70ac79a19827a2e73
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-05-05 12:00:20 +00:00
Laurentiu Palcu 6f11e868b0 sensor: add support for BMG160 gyroscope
Datasheet:
http://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMG160-DS000-09.pdf

Origin: Original
Change-Id: I27469da8ff04c2eb26e92cc5d747b1bb8fee627b
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-05-04 13:13:59 +00:00
Murtaza Alexandru f169a66205 sensor: migrate all drivers to new SYS_LOG
Refactor all sensor drivers so that they use SYS_LOG instead of
decentralized systems/functions.

Change-Id: Ibd9443e06004341bc5e9afaf5b49bbec547e073d
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:11:05 +00:00
Murtaza Alexandru 52ccdada9c sensor: split lsm9ds0_gyro driver
Split driver for LSM9DS0 gyroscope in core functionalities and trigger.

Change-Id: I19736b65f45a6c4fc79a1f16423097b89accff24
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:10:56 +00:00
Murtaza Alexandru 28cf0c210a sensor: split bmc150_magn driver
Split BMC150 magnetometer driver in core functionalities and trigger.

Change-Id: I955ac39c2e995a81fa830776da9c0bcc38d9490a
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:10:41 +00:00
Murtaza Alexandru 075d081811 sensor: add driver for LSM9DS0 accel and magn
Add device driver for the multi function device (MFD) part of LSM9DS0:
accelerometer, magnetometer and temperature.

Datasheet:
  https://www.adafruit.com/datasheets/LSM9DS0.pdf

Change-Id: I00b9db2c69c6e5229269afacb02bf5f921edabe9
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:10:41 +00:00
Murtaza Alexandru 676b89cd1a sensor: make runtime configurable attrs continuous
Runtime configurable attributes are now matched with the smallest
available value that is greater or equal to the parameter instead of
returning -EINVAL.

Change-Id: I9ca8e2eba443fcd247c329c6ce71dc2167fb7f03
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:10:40 +00:00
Murtaza Alexandru f1b95df34e sensor: rename SENSOR_TYPE_* to SENSOR_VALUE_TYPE_*
Rename sensor_value_type enums from SENSOR_TYPE_* to more concludent
name SENSOR_VALUE_TYPE_*. This change is required if we want to
introduce SENSOR_TYPE_* (SENSOR_TYPE_ACCEL - if the sensor/driver
supports accelerometer, SENSOR_TYPE_MAGN - etc.) in the future.
Also it is more clear with this notation what these enums are referring
to.

Change-Id: Ic58e29288669e10c0695e0f86f59b0e57f7ac38c
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:09:41 +00:00
Murtaza Alexandru 1be6d1f6c8 sensor: add the posibility to fetch one data type
Now you can specify the sensor type you want to fetch using
sensor_sample_fetch_chan. This will inform the driver that you want only
one type of data updated, leaving the others unchanged and enabling
different sampling rates for multi function devices (MFDs).

Change-Id: I403e422dffadc697c19a5372ed55ed8f486a2607
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:09:41 +00:00
Murtaza Alexandru 82cca9c56e sensor: fix bmc150_magn compile error
Fix bmc150_magn compile error introduced in I2C register access API
migration patch.

Change-Id: I48f4d6405b4b7ae25beb0fbd46169eac3689ec8e
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:08:38 +00:00
Murtaza Alexandru db06b853d3 sensor: fix init driver_api
Assign driver_api only if *_init is successful.

Change-Id: Ib95cd358af358aec4fc58ff10dcede05fad00d0a
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:08:38 +00:00
Murtaza Alexandru 6542e03a33 sensor: refactor bmc150 and lsm9ds0
* Fix coding style so line length does not exceed 80 chars.
* Remove unnecessary casts
* Remove unnecessary variable prefixes (from *_fiber_stack to
fiber_stack)
* Rewrite lsm9ds0_gyro_channel_get into more readable form

Change-Id: I086562644f707d9d6538cb34d000012464b02fe3
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:08:38 +00:00
Bogdan Davidoaia fb1ea43be2 sensors: use I2C register access API
Use I2C register access API in drivers of sensors that have
8-bit registers.

Change-Id: I33e016feff09be396eae70fb312de055c49caca7
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-26 11:06:50 +00:00
Laurentiu Palcu e7a8c7609a sensor: bmi160: fix regression
The regression was introduced by the following commit:

sensor: bmi160: Use the new GPIO callback API

The problem was that ipm context was not set when registering the
callback.

Change-Id: Icbe8fb9670b9e7e7d489e70adf93ff62fed98935
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-26 10:57:56 +00:00
Anas Nashif 9d8c332b21 i2c: use I2C_X nameing instead of I2CX
Other IOs use this format, so lets be consistent and use

I2C_0 instead of I2C0 and I2C_1 an instead of I2C1.

Change-Id: I591ab08e14bd533ef0fac38e596559da783863b8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-25 17:01:48 +00:00
Tomasz Bursztyka 559b768340 sensor: bmi160: Use the new GPIO callback API
gpio_set_callback() is meant to be deprecated and thus modifying the
driver to use the new GPIO callback API.

Taking the opportunity to use ipm API properly in order to remove the
struct bmi160_data singleton.

Change-Id: Iafcf3fed10bd286962829a4157effd054dd78c1e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-25 14:58:16 +00:00
Tomasz Bursztyka 62fcd4ca82 sensors: Using new GPIO API callbacks
Adapting GPIO based sensors to use the new callback format.

Change-Id: Ibdc68bf80a2ee42dcaf25c7a6e4431f9b64dc20a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-22 22:17:25 -04:00
Laurentiu Palcu e5dc7ac363 sensor: bmi160: switch to the new logging API
Change-Id: Id370e06e95528c223e09bb4110eeec3dcc2d4aef
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:15 +00:00
Laurentiu Palcu 8943f6c5ce sensor: bmi160: add support for triggers
Add support for anymotion and data ready triggers. Also, the user can
choose at configuration time the source of the triggers. For quark, in
particular, since the current driver for ARC does not allow receiving
interrupts from AON GPIO controller, IPM is used: a helper app on x86,
registers a gpio callback and will 'relay' the interrupt, through IPM,
to arc core.

Origin: Original
Change-Id: I170d723425c6280f9aa8c240b66275647723edd9
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:14 +00:00
Laurentiu Palcu f71df44204 sensor: bmi160: make some read/write functions global
These will be needed by the trigger implementation.

Change-Id: Ib408ae540571447059301046a3486cedffa735d5
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:14 +00:00
Laurentiu Palcu 5609ec95ee sensor: bmi160: fix bmi160_reg_field_update function
A mask was not applied on the shifted value, hence allowing one to pass
a val that would change other fields in the register.

Change-Id: I3c7bdb24c7b3a0ce94f664dbba303db35660ce7b
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:14 +00:00
Laurentiu Palcu 77e28d2263 sensor: bmi160: create two wrappers for bmi160_reg_val_to_range
These will be used in the trigger implementation, which is a different
file, and will allow for the arrays to be static.

Change-Id: Ia34ebe9bde7d09abe8e93f3ace9e282cee1169db
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:13 +00:00
Laurentiu Palcu 6330388bf5 sensor: bmi160: move the printing macro to the header
The macro will be used in the upcoming trigger file.

Change-Id: I57a570fde37f31771b3d8bb9c028520fdc41da8f
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:13 +00:00
Bogdan Davidoaia b628aa8a87 sensors: bma280: add support for BMC150 accelerometer
Add support for BMC150 accelerometer which differs from BMA280 only in
id, I2C address and acceleration data width.

Change-Id: Iccf47ecc5de9fdb1b9e45f1561c5dbb54f720806
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-19 18:40:43 +00:00
Bogdan Davidoaia 0eec9492fc sensors: bma280: fix accel data sample calculation
The values from the accel data sample msb and lsb registers need to
be concatenated (using bitwise or) and not added, since together they
represent a single 14-bit value.

Change-Id: I476f05512beb3d6b81bacefd4c52e4b2a541708b
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-19 18:40:43 +00:00
Bogdan Davidoaia 62fca8fcc1 sensors: bma280: compute accel scales based on data width
Compute acceleration data and threshold scales based on data width and
acceleration measurement range instead of defining LSB values for each
measurement range.

Change-Id: I2a15877cef00d49d7a64fd6f6003722bb9f80b92
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-19 18:40:42 +00:00
Bogdan Davidoaia b53b27701a sensors: add driver for TMP007 infrared thermopile sensor
Add driver for the TMP007 intrared thermopile sensor which measures
the temperature of an object without direct contact.

Datasheet:
	http://www.ti.com/lit/ds/symlink/tmp007.pdf

Origin: Original
Change-Id: I29857b2e424a2144370d75e2ee40c4ff8b619afd
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-16 05:32:35 +00:00
Bogdan Davidoaia 176c2525a6 sensors: bma280: fix slope threshold measurement unit
Slope threshold attribute values should be received in m/s^2 instead
of Gs, since accel channels return data in m/s^2.

Change-Id: I0669345ff8af8559e47895bca8225e15d2576a06
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-13 17:27:08 +00:00
Bogdan Davidoaia 69793bb320 sensors: use SENSOR_G constant in all accelerometer drivers
Use the SENSOR_G constant from sensor.h in all accelerometer
drivers, instead of having the constant redefined in each
driver header file.

Since GRAVITY_CONST was measured in mili-m/s^2 and SENSOR_G
is measured in micro-m/s^2, some changes to the calculation
of the acceleration data were added.

Change-Id: Ia323dfc46bee00035e24b37e1b7fbc886dfbe029
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-13 17:27:08 +00:00
Murtaza Alexandru fbd45861f3 sensor: lsm9ds0-gyro: fix FULL_SCALE attribute
SENSOR_ATTR_FULL_SCALE attribute now expects the value as radians per
second.

Change-Id: I8082a1f112f1ed8efb511de39e3a8e5ae3d3ed0c
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-07 17:00:09 +00:00
Bogdan Davidoaia 3bdf498716 sensors: fix coding style regarding max line length
Fix coding style so line length does not exceed 80 chars.

Change-Id: Iddebdf55593736cfa288a03a750cc927665f9065
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-07 01:03:40 +00:00
Laurentiu Palcu 5d2a200381 sensor: add driver for BMI160
This patch adds support for the Curie's BMI160 IMU chip. Only polling is
supported in this version.

Datasheet:
http://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMI160-DS000-07.pdf

Origin: Original
Change-Id: I759856d4bf123c21e9e4928f32bdf8f00aeeed24
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-02 23:08:48 +00:00
Vlad Dogaru 320651281c sensor: bmp280: fix pressure value
The comments in the sensor header specify that pressure should be
expressed in kPa, but the bmp280 driver returns a value in Pa.

Change-Id: I6d5346db250d1a01a1e5e31fb1d8685ab5dc405b
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-04-01 14:48:00 +03:00
Vlad Dogaru 0e702a6ce3 sensor: add driver for BMP280
This is a temperature and atmospheric pressure chip.  The datasheet is
available at:
	https://www.adafruit.com/datasheets/BST-BMP280-DS001-11.pdf

Change-Id: I3406eb6c2c4da564757b8315323d0681d648b541
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-03-27 00:34:38 +00:00
Bogdan Davidoaia a302451cc4 sensor: add driver for LIS3DH accelerometer
Add device driver for the LIS3DH I2C-based triaxial accelerometer
sensor, which supports reading data from the accel-x, accel-y and
accel-z channels.

Datasheet:
	http://www.st.com/web/en/resource/technical/document/datasheet/CD00274221.pdf

Application note:
	http://www.st.com/web/en/resource/technical/document/application_note/CD00290365.pdf

Change-Id: Ib51bd6346798249d850376e50d1c938eda8a3d28
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-03-27 00:34:30 +00:00
Murtaza Alexandru b1ea13413e sensor: add driver for LSM9DS0 gyroscope
Add device driver for the gyroscope part of LSM9DS0 gyroscope.

Datasheet:
  https://www.adafruit.com/datasheets/LSM9DS0.pdf

Change-Id: I25e0c8470c9b68c594bc4a0d2a9a13f8f41ee309
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-03-24 08:03:31 +00:00
Anas Nashif 2f20933cad sensors: Convert return codes to errno.h
Change-Id: Ifdcc26c903e70c4f72ac94e0511cc3f01fa6dc6e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-21 09:16:40 +00:00
Murtaza Alexandru 3b6d4cb9cf sensor: add driver for BMC150 magnetometer
Add device driver for the magnetometer part of BMC150 sensor.

Datasheet:
  https://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS000-04.pdf

Change-Id: Id7cbfd872a0a37e20afb03a8155c1f6851710a16
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-03-19 06:39:42 -04:00
Bogdan Davidoaia ef65f155c2 sensor: add driver for HDC1008 temperature and humidity sensor
Add driver for the HDC1008 temperature and relative humidity
sensor.

Datasheet:
	http://www.ti.com/lit/ds/symlink/hdc1008.pdf

Origin: Original
Change-Id: I63cb4cdd94120b80d0d6f3205da073f0817c4f17
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-03-19 06:39:42 -04:00
Bogdan Davidoaia 653874c73f sensor: add driver for SHT3xD sensors
Add device driver for the SHT3xD temperature and humidity sensors.

Datasheets:
	https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Datasheet_digital.pdf
	https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Application_Note_Alert_Mode_DIS_V1.pdf

Origin: Original
Change-Id: I9cda2f1bc7172e93ce34fde63c6febf0b8b28289
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-03-19 06:39:42 -04:00
Bogdan Davidoaia babb62a0ed sensor: add isl29035 light sensor
Add device driver for the isl29035 ambient light and infrared
light sensor.

Datasheet:
    http://www.intersil.com/content/dam/Intersil/documents/isl2/isl29035.pdf

Origin: Original
Change-Id: Ib285f8def32d78d50f1d92998dca5f55d6603ca5
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-03-19 10:38:39 +00:00
Bogdan Davidoaia fe9c947fee sensor: add driver for BMA280 accelerometer
Add device driver for the BMA280 I2C-based triaxial accelerometer
sensor, which supports reading data from the accel-x, accel-y, accel-z
and temperature channels. The driver also has support for data-ready
and any-motion triggers.

Datasheet:
	http://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMA280-DS000-11_published.pdf

Origin: Original
Change-Id: Iff7246d7dd4a9358ec7a71e8ffbcfcccd49e393c
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
Signed-off-by: Teodora Baluta <teodora.baluta@intel.com>
2016-03-19 00:13:18 +00:00
Bogdan Davidoaia aad3e2a21e sensor: move driver specific options to separate Kconfig files
Move driver specific config options to separate Kconfig sub-files
as this is a more scalable approach when considering that multiple
sensor drivers will be added in the future.

Change-Id: Ia1d62afd628723be33868d6c1a956ca7b27eba88
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-03-17 15:59:17 +00:00
Andre Guedes b3cb3a1f68 drivers: Replace DEV_INVALID_CONF by -EINVAL
This patch replaces all occurences of the macro DEV_INVALID_CONF by
-EINVAL at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: Idae0d5af8dd780416977c9261a5fb6188c3aab64
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 245e140da6 drivers: Replace DEV_INVALID_OP by -ENOTSUP
This patch replaces all occurences of the macro DEV_INVALID_OP by
-ENOTSUP at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I46aec3c65963018c479b01602e4a3eec8650eaff
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 024cfe754e drivers: Replace DEV_OK by 0
This patch replaces all occurences of the macro DEV_OK by the actual
value 0 at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I69980ecb9755f2fb026de5668ae9c21a4ae62d1e
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Vlad Dogaru 447489dc84 sensor: Add sx9500 SAR proximity driver
Support for data-ready and near/far triggers is included.  Datasheet the
sensor available at <http://www.semtech.com/images/datasheet/sx9500_ag.pdf>.

Origin: Original
Change-Id: Idd491a8bad7e119b0ed66e655955228ffdac6e76
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-03-15 18:04:19 -04:00
Vlad Dogaru 49d96d95ab sensor: Add threshold trigger support for MCP9808
The MCP9808 supports threshold triggering.  Add support for this feature
in the driver and the sample application.

If triggering is activated, the driver can create its own fiber or use
the system-wide sensor fiber.

Origin: Original
Change-Id: Ie825a22245cb48cbdffba3049011e4d305975d53
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-03-15 18:04:19 -04:00
Vlad Dogaru 68be7b7d26 sensor: Add driver for MCP9808 temperature sensor
The driver only supports simple temperature readings.  It does not
support the alarm feature.  Datasheet available at
<http://ww1.microchip.com/downloads/en/DeviceDoc/25095A.pdf>.

Origin: Original
Change-Id: I283e6697fc6947975323d280f5ff0ba625fac5a9
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-03-15 18:04:19 -04:00
Vlad Dogaru 48bdd70a07 Add infrastructure for sensor drivers
Origin: Original
Change-Id: I846b1601f1bdf15ad068b27baefc4b23ffab81e3
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-03-15 19:00:08 +00:00