Introduce new sensor API
Sensor drivers expose one or more channels, corresponding to each
individual quantity they can measure. Such quantities may be different
altogether (e.g. temperature and pressure) or different axes for the
same unit (e.g. three axes of acceleration). Before reading channels, a
driver must be explicitly instructed to obtain a sample from the device.
This helps accommodate sensors which can only read all channels at once,
and also helps ensure coherence of measurements and optimize I2C/SPI
traffic.
Channels can be read as floating point values or struct sensor_value.
The latter consists of a pair of integers and a type field which
dictates how to interpret said integers. The most common type is INT
(where the second value is ignored) or INT_PLUS_MICRO, which means the
second value should be multiplied by 1.0e-6 and added to the first.
A sensor driver may support one or more triggers, corresponding to
interrupts or timers. Registering for a trigger involves supplying the
driver with a callback which is called when a condition is reached.
Examples of trigger types are: data ready, timer expiration, any-motion,
near/far.
Finally, sensors support attributes such as sample frequency,
measurement accuracy or threshold values for triggers. However, runtime
configuration is discouraged, in the interest of keeping code simple.
Origin: Original
Change-Id: Id290fe544b6f7eccc4b109f3912fca1692e55623
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-01-22 20:59:10 +08:00
|
|
|
/*
|
2019-06-26 03:54:00 +08:00
|
|
|
* Copyright (c) 2019 Intel Corporation
|
Introduce new sensor API
Sensor drivers expose one or more channels, corresponding to each
individual quantity they can measure. Such quantities may be different
altogether (e.g. temperature and pressure) or different axes for the
same unit (e.g. three axes of acceleration). Before reading channels, a
driver must be explicitly instructed to obtain a sample from the device.
This helps accommodate sensors which can only read all channels at once,
and also helps ensure coherence of measurements and optimize I2C/SPI
traffic.
Channels can be read as floating point values or struct sensor_value.
The latter consists of a pair of integers and a type field which
dictates how to interpret said integers. The most common type is INT
(where the second value is ignored) or INT_PLUS_MICRO, which means the
second value should be multiplied by 1.0e-6 and added to the first.
A sensor driver may support one or more triggers, corresponding to
interrupts or timers. Registering for a trigger involves supplying the
driver with a callback which is called when a condition is reached.
Examples of trigger types are: data ready, timer expiration, any-motion,
near/far.
Finally, sensors support attributes such as sample frequency,
measurement accuracy or threshold values for triggers. However, runtime
configuration is discouraged, in the interest of keeping code simple.
Origin: Original
Change-Id: Id290fe544b6f7eccc4b109f3912fca1692e55623
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-01-22 20:59:10 +08:00
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
Introduce new sensor API
Sensor drivers expose one or more channels, corresponding to each
individual quantity they can measure. Such quantities may be different
altogether (e.g. temperature and pressure) or different axes for the
same unit (e.g. three axes of acceleration). Before reading channels, a
driver must be explicitly instructed to obtain a sample from the device.
This helps accommodate sensors which can only read all channels at once,
and also helps ensure coherence of measurements and optimize I2C/SPI
traffic.
Channels can be read as floating point values or struct sensor_value.
The latter consists of a pair of integers and a type field which
dictates how to interpret said integers. The most common type is INT
(where the second value is ignored) or INT_PLUS_MICRO, which means the
second value should be multiplied by 1.0e-6 and added to the first.
A sensor driver may support one or more triggers, corresponding to
interrupts or timers. Registering for a trigger involves supplying the
driver with a callback which is called when a condition is reached.
Examples of trigger types are: data ready, timer expiration, any-motion,
near/far.
Finally, sensors support attributes such as sample frequency,
measurement accuracy or threshold values for triggers. However, runtime
configuration is discouraged, in the interest of keeping code simple.
Origin: Original
Change-Id: Id290fe544b6f7eccc4b109f3912fca1692e55623
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-01-22 20:59:10 +08:00
|
|
|
*/
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_INCLUDE_SENSOR_H_
|
|
|
|
#define ZEPHYR_INCLUDE_SENSOR_H_
|
Introduce new sensor API
Sensor drivers expose one or more channels, corresponding to each
individual quantity they can measure. Such quantities may be different
altogether (e.g. temperature and pressure) or different axes for the
same unit (e.g. three axes of acceleration). Before reading channels, a
driver must be explicitly instructed to obtain a sample from the device.
This helps accommodate sensors which can only read all channels at once,
and also helps ensure coherence of measurements and optimize I2C/SPI
traffic.
Channels can be read as floating point values or struct sensor_value.
The latter consists of a pair of integers and a type field which
dictates how to interpret said integers. The most common type is INT
(where the second value is ignored) or INT_PLUS_MICRO, which means the
second value should be multiplied by 1.0e-6 and added to the first.
A sensor driver may support one or more triggers, corresponding to
interrupts or timers. Registering for a trigger involves supplying the
driver with a callback which is called when a condition is reached.
Examples of trigger types are: data ready, timer expiration, any-motion,
near/far.
Finally, sensors support attributes such as sample frequency,
measurement accuracy or threshold values for triggers. However, runtime
configuration is discouraged, in the interest of keeping code simple.
Origin: Original
Change-Id: Id290fe544b6f7eccc4b109f3912fca1692e55623
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-01-22 20:59:10 +08:00
|
|
|
|
2019-06-26 03:54:00 +08:00
|
|
|
#ifndef CONFIG_COMPAT_INCLUDES
|
|
|
|
#warning "This header file has moved, include <drivers/sensor.h> instead."
|
2019-01-25 19:23:37 +08:00
|
|
|
#endif
|
|
|
|
|
2019-06-26 03:54:00 +08:00
|
|
|
#include <drivers/sensor.h>
|
Introduce new sensor API
Sensor drivers expose one or more channels, corresponding to each
individual quantity they can measure. Such quantities may be different
altogether (e.g. temperature and pressure) or different axes for the
same unit (e.g. three axes of acceleration). Before reading channels, a
driver must be explicitly instructed to obtain a sample from the device.
This helps accommodate sensors which can only read all channels at once,
and also helps ensure coherence of measurements and optimize I2C/SPI
traffic.
Channels can be read as floating point values or struct sensor_value.
The latter consists of a pair of integers and a type field which
dictates how to interpret said integers. The most common type is INT
(where the second value is ignored) or INT_PLUS_MICRO, which means the
second value should be multiplied by 1.0e-6 and added to the first.
A sensor driver may support one or more triggers, corresponding to
interrupts or timers. Registering for a trigger involves supplying the
driver with a callback which is called when a condition is reached.
Examples of trigger types are: data ready, timer expiration, any-motion,
near/far.
Finally, sensors support attributes such as sample frequency,
measurement accuracy or threshold values for triggers. However, runtime
configuration is discouraged, in the interest of keeping code simple.
Origin: Original
Change-Id: Id290fe544b6f7eccc4b109f3912fca1692e55623
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-01-22 20:59:10 +08:00
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_INCLUDE_SENSOR_H_ */
|