Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
sif_tmp102.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, Cascoda Ltd.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
36 #ifndef SIF_TMP102_H
37 #define SIF_TMP102_H
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /* slave addresses */
44 /* Note that the slave address is hardware progammable by 7 bits and a direction bit
45  * according to table 4 in the datasheet
46  * SIF_SAD_TMP102 has to match table 4 (bits 7:1 in address+r/w transfer byte,
47  * not address(6:0)).
48  */
49 
50 #define SIF_SAD_TMP102 0x48 /* ADD0 pin connection = GND */
51 
52 /* Pin configuration */
53 #define SIF_TMP102_ALERT_PIN 33
54 
55 /* master measurement (read access) modes */
57 {
58  SIF_TMP102_MODE_POLL_ONE_SHOT, /* poll D7 in configuration register */
59  SIF_TMP102_MODE_TCONV_WAIT, /* wait for maximum conversion time */
60 };
61 
62 /* measurement mode */
63 #define SIF_TMP102_MODE SIF_TMP102_MODE_TCONV_WAIT
64 
65 /* max. conversion times for measurement [ms] */
66 #define SIF_TMP102_TCONV_MAX_TEMP 60 /* temperature */
67 
68 /* configuration register bit mapping */
69 #define SIF_TMP102_CONFIG_ONESHOT 0x80
70 #define SIF_TMP102_CONFIG_INTERRUPT 0x02 /* The AL pin is activated until being any pin being read */
71 
72 /* functions */
73 
74 /******************************************************************************/
75 /***************************************************************************/
82 u16_t SIF_TMP102_ReadTemperature(void); /* measure temperature */
83 
84 /******************************************************************************/
85 /***************************************************************************/
92 
93 /******************************************************************************/
94 /***************************************************************************/
98 void SIF_TMP102_Reset(void);
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
108 #endif // SIF_TMP102_H
unsigned char u8_t
Definition: cascoda_types.h:46
unsigned short u16_t
Definition: cascoda_types.h:48
void SIF_TMP102_Reset(void)
TMP102: Soft Reset Command.
Definition: sif_tmp102.c:354
sif_TMP102_mode
Definition: sif_tmp102.h:57
u16_t SIF_TMP102_ReadTemperature(void)
TMP102: Read Temperature.
Definition: sif_tmp102.c:254
u8_t SIF_TMP102_Initialise(void)
TMP102: Initialise Sensor.
Definition: sif_tmp102.c:333
@ SIF_TMP102_MODE_POLL_ONE_SHOT
Definition: sif_tmp102.h:58
@ SIF_TMP102_MODE_TCONV_WAIT
Definition: sif_tmp102.h:59