Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Loading...
Searching...
No Matches
sht_drv.h
Go to the documentation of this file.
1/*
2 * MikroSDK - MikroE Software Development Kit
3 * Copyright© 2020 MikroElektronika d.o.o.
4 *
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge,
9 * publish, distribute, sublicense, and/or sell copies of the Software,
10 * and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22 * OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
33// ----------------------------------------------------------------------------
34
35#ifndef SHT_DRV_H
36#define SHT_DRV_H
37
38#include "drv_digital_in.h"
39#include "drv_digital_out.h"
40#include "drv_i2c_master.h"
41
42#define SHT_I2C_ADDR0 0x44
43#define SHT_I2C_ADDR1 0x45
44
50#define SHT_MPS_05 0x20 // 0.5 measurements per second
51#define SHT_MPS_1 0x21 // 1 measurements per second
52#define SHT_MPS_2 0x22 // 2 measurements per second
53#define SHT_MPS_4 0x23 // 4 measurements per second
54#define SHT_MPS_10 0x27 // 10 measurements per second
62#define SHT_RPT_HIGH 0 // High repeatability
63#define SHT_RPT_MEDIUM 1 // Medium repeatability
64#define SHT_RPT_LOW 2 // Low repeatability
65
66#define SHT_STR_ENABLE 0x2C // Stretching enabled
67#define SHT_STR_DISABLE 0x24 // Stretching disabled
75#define SHT_CRC_POLYNOMIAL 0x31
76#define SHT_FETCH_DATA 0xE000
77#define SHT_PERIODIC_ART 0x2B32
78#define SHT_BREAK 0x3093
79#define SHT_SOFT_RESET 0x30A2
80#define SHT_HEATER 0x30
81#define SHT_READ_STATUS 0xF32D
82#define SHT_CLEAR_STATUS1 0x3041
// End group macro
86// --------------------------------------------------------------- PUBLIC TYPES
92typedef struct
93{
96 uint8_t mps;
97
99
103typedef struct
104{
105 // Output pins
106
107 digital_out_t rst;
108 // Input pins
109
110 digital_in_t int_pin;
111
112 // Modules
113
114 i2c_master_t i2c;
115
116 // ctx variable
117
119
120 // driver variables
121
123
124} sht_t;
125
129typedef struct
130{
131 // Communication gpio pins
132
133 pin_name_t scl;
134 pin_name_t sda;
135
136 // Additional gpio pins
137
138 pin_name_t rst;
139 pin_name_t int_pin;
140
141 // static variable
142
143 uint32_t i2c_speed;
144 uint8_t i2c_address;
145
146 //driver variable's config
147
149
150} sht_cfg_t;
151
// End types group
153// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
154
160#endif // SHT_DRV_H
161
// End public_function group
164
165// ------------------------------------------------------------------------- END
Definition sht_drv.h:93
uint8_t clk_stretching
Definition sht_drv.h:94
uint8_t repeatability
Definition sht_drv.h:95
uint8_t mps
Definition sht_drv.h:96
Click configuration structure definition.
Definition sht_drv.h:130
pin_name_t int_pin
Definition sht_drv.h:139
pin_name_t sda
Definition sht_drv.h:134
pin_name_t scl
Definition sht_drv.h:133
uint32_t i2c_speed
Definition sht_drv.h:143
pin_name_t rst
Definition sht_drv.h:138
drv_variables_t vars_cfg
Definition sht_drv.h:148
uint8_t i2c_address
Definition sht_drv.h:144
Click ctx object definition.
Definition sht_drv.h:104
digital_in_t int_pin
Definition sht_drv.h:110
i2c_master_t i2c
Definition sht_drv.h:114
drv_variables_t vars
Definition sht_drv.h:122
uint8_t slave_address
Definition sht_drv.h:118
digital_out_t rst
Definition sht_drv.h:107