2016-02-26 20:40:25 +08:00
|
|
|
/*
|
|
|
|
* 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_HDC1008
|
|
|
|
#define _SENSOR_HDC1008
|
|
|
|
|
|
|
|
#include <nanokernel.h>
|
|
|
|
|
|
|
|
#if CONFIG_HDC1008_I2C_ADDR_0
|
|
|
|
#define HDC1008_I2C_ADDRESS 0x40
|
|
|
|
#elif CONFIG_HDC1008_I2C_ADDR_1
|
|
|
|
#define HDC1008_I2C_ADDRESS 0x41
|
|
|
|
#elif CONFIG_HDC1008_I2C_ADDR_2
|
|
|
|
#define HDC1008_I2C_ADDRESS 0x42
|
|
|
|
#elif CONFIG_HDC1008_I2C_ADDR_3
|
|
|
|
#define HDC1008_I2C_ADDRESS 0x43
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define HDC1008_REG_TEMP 0x0
|
|
|
|
#define HDC1008_REG_HUMIDITY 0x1
|
2016-10-04 22:19:18 +08:00
|
|
|
#define HDC1000_MANUFID 0xFE
|
|
|
|
#define HDC1000_DEVICEID 0xFF
|
2016-02-26 20:40:25 +08:00
|
|
|
|
|
|
|
struct hdc1008_data {
|
|
|
|
struct device *i2c;
|
|
|
|
struct device *gpio;
|
2016-04-06 20:52:53 +08:00
|
|
|
struct gpio_callback gpio_cb;
|
2016-02-26 20:40:25 +08:00
|
|
|
uint16_t t_sample;
|
|
|
|
uint16_t rh_sample;
|
|
|
|
struct nano_sem data_sem;
|
|
|
|
};
|
|
|
|
|
2016-04-22 00:08:51 +08:00
|
|
|
#define SYS_LOG_DOMAIN "HDC1008"
|
|
|
|
#define SYS_LOG_LEVEL CONFIG_HDC1008_SYS_LOG_LEVEL
|
|
|
|
#include <misc/sys_log.h>
|
2016-02-26 20:40:25 +08:00
|
|
|
#endif
|