Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
sif_si7021.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  */
37 #ifndef SIF_SI7021_H
38 #define SIF_SI7021_H
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /* slave addresses */
45 #define SIF_SAD_SI7021 0x40 /* Si7021 temperature / humidity sensor */
46 
47 /* master measurement (read access) modes */
49 {
51  /* master hold mode (clock streching, clock suspend) */
53  /* no-hold master hold mode (wait while NACKs) */
55  /* wait for maximum conversion time */
56 };
57 
58 /* measurement mode */
59 #define SIF_SI7021_MODE SIF_SI7021_MODE_HOLD_MASTER
60 
61 /* max. conversion times for measurement [ms] */
62 #define SIF_SI7021_TCONV_MAX_TEMP 10 /* temperature */
63 #define SIF_SI7021_TCONV_MAX_HUM 20 /* humidity */
64 
65 /* functions */
66 
67 /******************************************************************************/
68 /***************************************************************************/
74 u8_t SIF_SI7021_ReadTemperature(void); /* measure temperature, -128 to +127 'C */
75 
76 /******************************************************************************/
77 /***************************************************************************/
83 u8_t SIF_SI7021_ReadHumidity(void); /* measure humidity, 0 to 100 % */
84 
85 /******************************************************************************/
86 /***************************************************************************/
90 void SIF_SI7021_Reset(void); /* device soft-reset */
91 
92 /******************************************************************************/
93 /***************************************************************************/
99 u8_t SIF_SI7021_ReadID(void); /* device read device identification */
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
109 #endif // SIF_SI7021_H
unsigned char u8_t
Definition: cascoda_types.h:46
u8_t SIF_SI7021_ReadID(void)
SI7021: Read ID byte of Electronic Serial Number.
Definition: sif_si7021.c:199
void SIF_SI7021_Reset(void)
SI7021: Soft Reset Command.
Definition: sif_si7021.c:179
u8_t SIF_SI7021_ReadTemperature(void)
SI7021: Read Temperature.
Definition: sif_si7021.c:42
sif_si7021_mode
Definition: sif_si7021.h:49
u8_t SIF_SI7021_ReadHumidity(void)
SI7021: Read Humidity.
Definition: sif_si7021.c:111
@ SIF_SI7021_MODE_TCONV_WAIT
SIF_SI7021_MODE_NACK_WAIT.
Definition: sif_si7021.h:54
@ SIF_SI7021_MODE_HOLD_MASTER
Definition: sif_si7021.h:50
@ SIF_SI7021_MODE_NACK_WAIT
SIF_SI7021_MODE_HOLD_MASTER.
Definition: sif_si7021.h:52