irthermo3v3  2.0.0.0
irthermo3v3.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2020 MikroElektronika d.o.o.
3 ** Contact: https://www.mikroe.com/contact
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 ** of this software and associated documentation files (the "Software"), to deal
7 ** in the Software without restriction, including without limitation the rights
8 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 ** copies of the Software, and to permit persons to whom the Software is
10 ** furnished to do so, subject to the following conditions:
11 ** The above copyright notice and this permission notice shall be
12 ** included in all copies or substantial portions of the Software.
13 **
14 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 ** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 ** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19 ** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 ** USE OR OTHER DEALINGS IN THE SOFTWARE.
21 ****************************************************************************/
22 
28 #ifndef IRTHERMO3V3_H
29 #define IRTHERMO3V3_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
38 
60 #define IRTHERMO3V3_SET_DEV_ADDR 0x5A
61  // irthermo3v3_set
63 
78 #define IRTHERMO3V3_MAP_MIKROBUS( cfg, mikrobus ) \
79  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
80  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
81  cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM )
82  // irthermo3v3_map // irthermo3v3
85 
90 typedef struct
91 {
92  // Input pins
93 
94  digital_in_t pwm;
95 
96  // Modules
97  i2c_master_t i2c;
99  // I2C slave address
100  uint8_t slave_address;
102 } irthermo3v3_t;
103 
108 typedef struct
109 {
110  pin_name_t scl;
111  pin_name_t sda;
113  pin_name_t pwm;
114 
115  uint32_t i2c_speed;
116  uint8_t i2c_address;
119 
124 typedef enum
125 {
127  IRTHERMO3V3_ERROR = -1
128 
130 
148 
165 
176 
187 
198 uint16_t irthermo3v3_read_reg ( irthermo3v3_t* ctx, uint8_t address );
199 
200 
201 #ifdef __cplusplus
202 }
203 #endif
204 #endif // IRTHERMO3V3_H
205  // irthermo3v3
207 
208 // ------------------------------------------------------------------------ END
irthermo3v3_return_value_t
irthermo3v3_return_value_t
IrThermo 3V3 Click return value data.
Definition: irthermo3v3.h:123
irthermo3v3_get_t_object
float irthermo3v3_get_t_object(irthermo3v3_t *ctx)
Reads Temperature object1 from sensor.
irthermo3v3_init
err_t irthermo3v3_init(irthermo3v3_t *ctx, irthermo3v3_cfg_t *cfg)
IrThermo 3V3 initialization function.
irthermo3v3_cfg_setup
void irthermo3v3_cfg_setup(irthermo3v3_cfg_t *cfg)
IrThermo 3V3 configuration object setup function.
IRTHERMO3V3_ERROR
Definition: irthermo3v3.h:126
irthermo3v3_t
IrThermo 3V3 Click context object.
Definition: irthermo3v3.h:89
IRTHERMO3V3_OK
Definition: irthermo3v3.h:125
irthermo3v3_get_t_ambient
float irthermo3v3_get_t_ambient(irthermo3v3_t *ctx)
Reads Temperature ambient from sensor.
irthermo3v3_cfg_t
IrThermo 3V3 Click configuration object.
Definition: irthermo3v3.h:107
irthermo3v3_read_reg
uint16_t irthermo3v3_read_reg(irthermo3v3_t *ctx, uint8_t address)
Generic function for reading values from RAM.