2016-07-08 09:33:29 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Intel Corporation
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-07-08 09:33:29 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SENSOR_MAX44009
|
|
|
|
#define _SENSOR_MAX44009
|
|
|
|
|
|
|
|
#include <misc/util.h>
|
|
|
|
|
|
|
|
#define SYS_LOG_DOMAIN "MAX44009"
|
2016-10-06 00:49:41 +08:00
|
|
|
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
|
2016-12-18 01:56:56 +08:00
|
|
|
#include <logging/sys_log.h>
|
2016-07-08 09:33:29 +08:00
|
|
|
|
2016-10-05 20:45:54 +08:00
|
|
|
#define MAX44009_I2C_ADDRESS CONFIG_MAX44009_I2C_ADDR
|
2016-07-08 09:33:29 +08:00
|
|
|
|
|
|
|
#define MAX44009_SAMPLING_CONTROL_BIT BIT(7)
|
|
|
|
#define MAX44009_CONTINUOUS_SAMPLING BIT(7)
|
|
|
|
#define MAX44009_SAMPLE_EXPONENT_SHIFT 12
|
|
|
|
#define MAX44009_MANTISSA_HIGH_NIBBLE_MASK 0xf00
|
|
|
|
#define MAX44009_MANTISSA_LOW_NIBBLE_MASK 0xf
|
|
|
|
|
|
|
|
#define MAX44009_REG_CONFIG 0x02
|
|
|
|
#define MAX44009_REG_LUX_HIGH_BYTE 0x03
|
|
|
|
#define MAX44009_REG_LUX_LOW_BYTE 0x04
|
|
|
|
|
|
|
|
struct max44009_data {
|
|
|
|
struct device *i2c;
|
2017-04-21 23:03:20 +08:00
|
|
|
u16_t sample;
|
2016-07-08 09:33:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _SENSOR_MAX44009_ */
|