Contiki-NG
Loading...
Searching...
No Matches
tmp102.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010, Swedish Institute of Computer Science.
3 * Copyright (c) 2016, Zolertia <http://www.zolertia.com>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the Institute nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * This file is part of the Contiki operating system.
31 *
32 */
33
34/**
35 * \file
36 * Device drivers header file for tmp102 temperature sensor in Zolertia
37 * Z1 WSN Platform.
38 * \author
39 * Enric M. Calvo, Zolertia <ecalvo@zolertia.com>
40 * Marcus Lundén, SICS <mlunden@sics.se>
41 * Antonio Lignan, Zolertia <alinan@zolertia.com>
42 */
43/* -------------------------------------------------------------------------- */
44#ifndef TMP102_H_
45#define TMP102_H_
46#include <stdio.h>
47#include "lib/sensors.h"
48#include "i2cmaster.h"
49/* -------------------------------------------------------------------------- */
50void tmp102_init(void);
51void tmp102_write_reg(uint8_t reg, uint16_t val);
52uint16_t tmp102_read_reg(uint8_t reg);
53uint16_t tmp102_read_temp_raw();
54int8_t tmp102_read_temp_simple();
55int16_t tmp102_read_temp_x100();
56/* -------------------------------------------------------------------------- */
57#define TMP102_ADDR 0x48
58#define TMP102_TEMP 0x00
59#define TMP102_CONF 0x01
60#define TMP102_TLOW 0x02
61#define TMP102_THIGH 0x03
62
63/* TMP102 pin-out */
64#define TMP102_PWR_DIR P5DIR
65#define TMP102_PWR_SEL P5SEL
66#define TMP102_PWR_SEL2 P5SEL2
67#define TMP102_PWR_REN P5REN
68#define TMP102_PWR_OUT P5OUT
69#define TMP102_PWR_PIN (1<<0) /* P5.0 */
70/* -------------------------------------------------------------------------- */
71#define TMP102_SUCCESS 0
72#define TMP102_ERROR (-1)
73#define TMP102_READ 0x01
74/* -------------------------------------------------------------------------- */
75#define TMP102_SENSOR "TMP102 sensor"
76/* -------------------------------------------------------------------------- */
77extern const struct sensors_sensor tmp102;
78/* -------------------------------------------------------------------------- */
79#endif /* ifndef TMP102_H_ */
void tmp102_init(void)
Initialiser for the TMP102 sensor driver.
Definition tmp102.c:59
I2C communication device driver header file for Zolertia Z1 sensor node.