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 
39 #ifdef PREINIT_SUPPORTED
40 #include "preinit.h"
41 #endif
42 
43 #ifdef MikroCCoreVersion
44  #if MikroCCoreVersion >= 1
45  #include "delays.h"
46  #endif
47 #endif
48 
49 #include "drv_digital_out.h"
50 #include "drv_digital_in.h"
51 #include "drv_i2c_master.h"
52 
74 #define IRTHERMO3V3_SET_DEV_ADDR 0x5A
75  // irthermo3v3_set
77 
92 #define IRTHERMO3V3_MAP_MIKROBUS( cfg, mikrobus ) \
93  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
94  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
95  cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM )
96  // irthermo3v3_map // irthermo3v3
99 
104 typedef struct
105 {
106  // Input pins
107 
108  digital_in_t pwm;
109 
110  // Modules
111  i2c_master_t i2c;
113  // I2C slave address
114  uint8_t slave_address;
116 } irthermo3v3_t;
117 
122 typedef struct
123 {
124  pin_name_t scl;
125  pin_name_t sda;
127  pin_name_t pwm;
128 
129  uint32_t i2c_speed;
130  uint8_t i2c_address;
133 
138 typedef enum
139 {
141  IRTHERMO3V3_ERROR = -1
142 
144 
162 
179 
190 
201 
212 uint16_t irthermo3v3_read_reg ( irthermo3v3_t* ctx, uint8_t address );
213 
214 
215 #ifdef __cplusplus
216 }
217 #endif
218 #endif // IRTHERMO3V3_H
219  // irthermo3v3
221 
222 // ------------------------------------------------------------------------ END
irthermo3v3_t::i2c
i2c_master_t i2c
Definition: irthermo3v3.h:111
irthermo3v3_return_value_t
irthermo3v3_return_value_t
IrThermo 3V3 Click return value data.
Definition: irthermo3v3.h:139
irthermo3v3_get_t_object
float irthermo3v3_get_t_object(irthermo3v3_t *ctx)
Reads Temperature object1 from sensor.
irthermo3v3_cfg_t::sda
pin_name_t sda
Definition: irthermo3v3.h:125
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
@ IRTHERMO3V3_ERROR
Definition: irthermo3v3.h:141
irthermo3v3_t
IrThermo 3V3 Click context object.
Definition: irthermo3v3.h:105
irthermo3v3_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: irthermo3v3.h:129
irthermo3v3_cfg_t::scl
pin_name_t scl
Definition: irthermo3v3.h:124
irthermo3v3_cfg_t::pwm
pin_name_t pwm
Definition: irthermo3v3.h:127
IRTHERMO3V3_OK
@ IRTHERMO3V3_OK
Definition: irthermo3v3.h:140
irthermo3v3_t::slave_address
uint8_t slave_address
Definition: irthermo3v3.h:114
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:123
irthermo3v3_t::pwm
digital_in_t pwm
Definition: irthermo3v3.h:108
irthermo3v3_read_reg
uint16_t irthermo3v3_read_reg(irthermo3v3_t *ctx, uint8_t address)
Generic function for reading values from RAM.
irthermo3v3_cfg_t::i2c_address
uint8_t i2c_address
Definition: irthermo3v3.h:130