zephyr/drivers/sensor/th02/th02.h
Anas Nashif 915eac4625 sensors: add TH02 temperature sensor (Grove)
Support for the Temperature&Humidity Sensor (High-Accuracy &Mini)
v1.0 sensor, see:

http://wiki.seeed.cc/Grove-TemptureAndHumidity_Sensor-High-Accuracy_AndMini-v1.0/

Change-Id: I439eafc863116f21e3b3385175d1935e60a5e9b1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 00:24:33 +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_TH02
#define _SENSOR_TH02
#include <device.h>
#include <misc/util.h>
#define TH02_I2C_DEV_ID 0x40
#define TH02_REG_STATUS 0x00
#define TH02_REG_DATA_H 0x01
#define TH02_REG_DATA_L 0x02
#define TH02_REG_CONFIG 0x03
#define TH02_REG_ID 0x11
#define TH02_STATUS_RDY_MASK 0x01
#define TH02_CMD_MEASURE_HUMI 0x01
#define TH02_CMD_MEASURE_TEMP 0x11
#define TH02_WR_REG_MODE 0xC0
#define TH02_RD_REG_MODE 0x80
struct th02_data {
struct device *i2c;
uint16_t t_sample;
uint16_t rh_sample;
};
#define SYS_LOG_DOMAIN "TH02"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
#include <misc/sys_log.h>
#endif /* _SENSOR_TH02_ */