move sensor.h to drivers/sensor.h and create a shim for backward-compatibility. No functional changes to the headers. A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES. Related to #16539 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
34 lines
860 B
C
34 lines
860 B
C
/*
|
|
* Copyright (c) 2018 Bosch Sensortec GmbH
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <zephyr.h>
|
|
#include <device.h>
|
|
#include <drivers/sensor.h>
|
|
#include <stdio.h>
|
|
|
|
void main(void)
|
|
{
|
|
struct device *dev = device_get_binding(DT_INST_0_BOSCH_BME680_LABEL);
|
|
struct sensor_value temp, press, humidity, gas_res;
|
|
|
|
printf("Device %p name is %s\n", dev, dev->config->name);
|
|
|
|
while (1) {
|
|
k_sleep(3000);
|
|
|
|
sensor_sample_fetch(dev);
|
|
sensor_channel_get(dev, SENSOR_CHAN_AMBIENT_TEMP, &temp);
|
|
sensor_channel_get(dev, SENSOR_CHAN_PRESS, &press);
|
|
sensor_channel_get(dev, SENSOR_CHAN_HUMIDITY, &humidity);
|
|
sensor_channel_get(dev, SENSOR_CHAN_GAS_RES, &gas_res);
|
|
|
|
printf("T: %d.%06d; P: %d.%06d; H: %d.%06d; G: %d.%06d\n",
|
|
temp.val1, temp.val2, press.val1, press.val2,
|
|
humidity.val1, humidity.val2, gas_res.val1,
|
|
gas_res.val2);
|
|
}
|
|
}
|