zephyr/drivers/sensor/sensor_max44009.h
Baohong Liu a3488d13e0 sensor: add driver for MAX44009 light sensor
Add device driver for MAX44009 light sensor

Datasheet:
https://datasheets.maximintegrated.com/en/ds/MAX44009.pdf

Jira: ZEP-357

Origin: Original
Change-Id: I6b5c8e0afc36c22de0a6432d01cd5b7eb2e12f1b
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-07-12 19:31:09 +00:00

48 lines
1.3 KiB
C

/*
* Copyright (c) 2016 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _SENSOR_MAX44009
#define _SENSOR_MAX44009
#include <misc/util.h>
#define SYS_LOG_DOMAIN "MAX44009"
#define SYS_LOG_LEVEL CONFIG_MAX44009_SYS_LOG_LEVEL
#include <misc/sys_log.h>
#if CONFIG_MAX44009_I2C_ADDR_0
#define MAX44009_I2C_ADDRESS 0x4a
#elif CONFIG_MAX44009_I2C_ADDR_1
#define MAX44009_I2C_ADDRESS 0x4b
#endif
#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;
uint16_t sample;
};
#endif /* _SENSOR_MAX44009_ */