Commit graph

741 commits

Author SHA1 Message Date
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