fever 2.0.0.0
fever.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 FEVER_H
36#define FEVER_H
37
38#include "drv_digital_in.h"
39#include "drv_i2c_master.h"
40
41// -------------------------------------------------------------- PUBLIC MACROS
51#define FEVER_MAP_MIKROBUS( cfg, mikrobus ) \
52 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
53 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );\
54 cfg.os = MIKROBUS( mikrobus, MIKROBUS_INT )
61#define FEVER_RETVAL uint8_t
62
63#define FEVER_OK 0x00
64#define FEVER_INIT_ERROR 0xFF
71#define FEVER_TEMP 0x00
72#define FEVER_CONFIG 0x01
73#define FEVER_THYST 0x02
74#define FEVER_TOS 0x03
81#define FEVER_SHUTDOWN 0x01
82#define FEVER_POWERUP 0xFE
83#define FEVER_INTERUPT_MODE 0x02
84#define FEVER_COMPARATOR_MODE 0xFD
91#define FEVER_OS_ACTIVE_HIGH 0x04
92#define FEVER_OS_ACTIVE_LOW 0xFB
99#define FEVER_FAULT_QUEUE_1 0xE7
100#define FEVER_FAULT_QUEUE_2 0x08
101#define FEVER_FAULT_QUEUE_4 0x10
102#define FEVER_FAULT_QUEUE_6 0x18
109#define FEVER_EXTENDED_DATA_FORMAT 0x20
110#define FEVER_NORMAL_DATA_FORMAT 0xDF
117#define FEVER_TIMEOUT_DISABLE 0x40
118#define FEVER_TIMEOUT_ENABLE 0xBF
125#define FEVER_ONE_SHOT_MEASURE 0x80 // End group macro
129// --------------------------------------------------------------- PUBLIC TYPES
138typedef struct
139{
140 // Input pins
141
142 digital_in_t os;
143
144 // Modules
145
146 i2c_master_t i2c;
147
148 // ctx variable
149
151
152} fever_t;
153
157typedef struct
158{
159 // Communication gpio pins
160
161 pin_name_t scl;
162 pin_name_t sda;
163
164 // Additional gpio pins
165
166 pin_name_t os;
167
168 // static variable
169
170 uint32_t i2c_speed;
171 uint8_t i2c_address;
172
174 // End types group
176// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
177
183#ifdef __cplusplus
184extern "C"{
185#endif
186
196
206
215
226void fever_generic_write ( fever_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
227
238void fever_generic_read ( fever_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
239
248
249#ifdef __cplusplus
250}
251#endif
252#endif // _FEVER_H_
253 // End public_function group
256
257// ------------------------------------------------------------------------- END
#define FEVER_RETVAL
Definition: fever.h:61
void fever_default_cfg(fever_t *ctx)
Click Default Configuration function.
FEVER_RETVAL fever_init(fever_t *ctx, fever_cfg_t *cfg)
Initialization function.
void fever_generic_read(fever_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void fever_generic_write(fever_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
float fever_get_temperature(fever_t *ctx)
Get temperature.
void fever_cfg_setup(fever_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition: fever.h:158
uint32_t i2c_speed
Definition: fever.h:170
pin_name_t scl
Definition: fever.h:161
pin_name_t sda
Definition: fever.h:162
pin_name_t os
Definition: fever.h:166
uint8_t i2c_address
Definition: fever.h:171
Click ctx object definition.
Definition: fever.h:139
i2c_master_t i2c
Definition: fever.h:146
uint8_t slave_address
Definition: fever.h:150
digital_in_t os
Definition: fever.h:142