drivers: sensor: ccs811: uncrustify

Run the code formatter over the source files for the CCS811.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
Peter A. Bigot 2018-11-21 14:43:31 -06:00 committed by Maureen Helm
commit 6c15968322
3 changed files with 28 additions and 28 deletions

View file

@ -61,8 +61,8 @@ static int ccs811_sample_fetch(struct device *dev, enum sensor_channel chan)
}
static int ccs811_channel_get(struct device *dev,
enum sensor_channel chan,
struct sensor_value *val)
enum sensor_channel chan,
struct sensor_value *val)
{
struct ccs811_data *drv_data = dev->driver_data;
u32_t uval;
@ -83,7 +83,7 @@ static int ccs811_channel_get(struct device *dev,
* Raw ADC readings are contained in least significant 10 bits
*/
uval = (drv_data->resistance & CCS811_VOLTAGE_MASK)
* CCS811_VOLTAGE_SCALE;
* CCS811_VOLTAGE_SCALE;
val->val1 = uval / 1000000U;
val->val2 = uval % 1000000;
@ -161,7 +161,7 @@ int ccs811_init(struct device *dev)
drv_data->i2c = device_get_binding(DT_INST_0_AMS_CCS811_BUS_NAME);
if (drv_data->i2c == NULL) {
LOG_ERR("Failed to get pointer to %s device!",
DT_INST_0_AMS_CCS811_BUS_NAME);
DT_INST_0_AMS_CCS811_BUS_NAME);
return -EINVAL;
}

View file

@ -12,35 +12,35 @@
#include <sys/util.h>
/* Registers */
#define CCS811_REG_STATUS 0x00
#define CCS811_REG_MEAS_MODE 0x01
#define CCS811_REG_ALG_RESULT_DATA 0x02
#define CCS811_REG_RAW_DATA 0x03
#define CCS811_REG_HW_ID 0x20
#define CCS811_REG_HW_VERSION 0x21
#define CCS811_REG_HW_VERSION_MASK 0xF0
#define CCS811_REG_ERR 0xE0
#define CCS811_REG_APP_START 0xF4
#define CCS811_REG_STATUS 0x00
#define CCS811_REG_MEAS_MODE 0x01
#define CCS811_REG_ALG_RESULT_DATA 0x02
#define CCS811_REG_RAW_DATA 0x03
#define CCS811_REG_HW_ID 0x20
#define CCS811_REG_HW_VERSION 0x21
#define CCS811_REG_HW_VERSION_MASK 0xF0
#define CCS811_REG_ERR 0xE0
#define CCS811_REG_APP_START 0xF4
#define CCS881_HW_ID 0x81
#define CCS811_HW_VERSION 0x10
#define CCS881_HW_ID 0x81
#define CCS811_HW_VERSION 0x10
/* Status register fields */
#define CCS811_STATUS_ERROR BIT(0)
#define CCS811_STATUS_DATA_READY BIT(3)
#define CCS811_STATUS_APP_VALID BIT(4)
#define CCS811_STATUS_FW_MODE BIT(7)
#define CCS811_STATUS_ERROR BIT(0)
#define CCS811_STATUS_DATA_READY BIT(3)
#define CCS811_STATUS_APP_VALID BIT(4)
#define CCS811_STATUS_FW_MODE BIT(7)
/* Measurement modes */
#define CCS811_MODE_IDLE 0x00
#define CCS811_MODE_IAQ_1SEC 0x10
#define CCS811_MODE_IAQ_10SEC 0x20
#define CCS811_MODE_IAQ_60SEC 0x30
#define CCS811_MODE_RAW_DATA 0x40
#define CCS811_MODE_IDLE 0x00
#define CCS811_MODE_IAQ_1SEC 0x10
#define CCS811_MODE_IAQ_10SEC 0x20
#define CCS811_MODE_IAQ_60SEC 0x30
#define CCS811_MODE_RAW_DATA 0x40
#define CCS811_VOLTAGE_SCALE 1613
#define CCS811_VOLTAGE_SCALE 1613
#define CCS811_VOLTAGE_MASK 0x3FF
#define CCS811_VOLTAGE_MASK 0x3FF
struct ccs811_data {
struct device *i2c;

View file

@ -21,9 +21,9 @@ static void do_main(struct device *dev)
sensor_channel_get(dev, SENSOR_CHAN_CURRENT, &current);
printk("Co2: %d.%06dppm; VOC: %d.%06dppb\n", co2.val1, co2.val2,
voc.val1, voc.val2);
voc.val1, voc.val2);
printk("Voltage: %d.%06dV; Current: %d.%06dA\n\n", voltage.val1,
voltage.val2, current.val1, current.val2);
voltage.val2, current.val1, current.val2);
k_sleep(K_MSEC(1000));
}