irgrid3 2.0.0.0
irgrid3.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 IRGRID3_H
29#define IRGRID3_H
30
31#ifdef __cplusplus
32extern "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_i2c_master.h"
51
78#define IRGRID3_SET_DEV_ADDR 0x33
79
80 // irgrid3_set
81
96#define IRGRID3_MAP_MIKROBUS( cfg, mikrobus ) \
97 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
98 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
99
100 // irgrid3_map
101 // irgrid3
102
107typedef struct
108{
109 int16_t k_vdd;
110 int16_t vdd_25;
111 float kv_ptat;
112 float kt_ptat;
113 uint16_t v_ptat_25;
115 int16_t gain_eeprom;
116 float tgc;
117 float cp_kv;
118 float cp_kta;
121 float ks_ta;
122 float ks_to[ 4 ];
123 int16_t ct[ 4 ];
124 float alpha[ 768 ];
125 int16_t offset[ 768 ];
126 float kta[ 768 ];
127 float kv[ 768 ];
128 float cp_alpha[ 2 ];
129 int16_t cp_offset[ 2 ];
130 float il_chess_c[ 3 ];
131 uint16_t broken_pixels[ 5 ];
132 uint16_t outlier_pixels[ 5 ];
134
139typedef struct
140{
141 // Modules
142 i2c_master_t i2c;
144 // I2C slave address
147
148} irgrid3_t;
149
154typedef struct
155{
156 pin_name_t scl;
157 pin_name_t sda;
159 uint32_t i2c_speed;
160 uint8_t i2c_address;
163
182
200
217
232
248void irgrid3_generic_write ( irgrid3_t *ctx, uint16_t reg, uint8_t *data_buf, uint16_t len );
249
266void irgrid3_generic_read ( irgrid3_t *ctx, uint16_t reg, uint8_t *rx_buf, uint16_t rx_len );
267
277void irgrid3_read_eeprom ( irgrid3_t *ctx, uint16_t *eeprom_data );
278
288uint8_t irgrid3_extract_parameters ( irgrid3_t *ctx, uint16_t *eeprom_data );
289
299void irgrid3_set_refresh_rate ( irgrid3_t *ctx, uint8_t refresh_rate );
300
310uint16_t irgrid3_get_frame_data ( irgrid3_t *ctx, uint16_t *frame_data );
311
321void irgrid3_set_resolution ( irgrid3_t *ctx, uint8_t resolution );
322
331
340
350
360
370
381void irgrid3_get_pixel_temperature ( irgrid3_t *ctx, float *temp_ambient, float *pixel_temp );
382
392float irgrid3_get_temp_ambient ( irgrid3_t *ctx, uint16_t *frame_data );
393
403uint16_t irgrid3_get_subpage_number ( uint16_t *frame_data );
404
412float irgrid3_get_vdd ( irgrid3_t *ctx, uint16_t *frame_data );
413
425void irgrid3_calculate_temp_obj ( irgrid3_t *ctx, uint16_t *frame_data, float tr_data, float *px_matrix );
426
437void irgrid3_get_image ( irgrid3_t *ctx, uint16_t *frame_data, float *px_matrix );
438#ifdef __cplusplus
439}
440#endif
441#endif // IRGRID3_H
442
443 // irgrid3
444
445// ------------------------------------------------------------------------ END
float irgrid3_get_temp_ambient(irgrid3_t *ctx, uint16_t *frame_data)
Function for getting Ambient temperature.
void irgrid3_cfg_setup(irgrid3_cfg_t *cfg)
IR Grid 3 configuration object setup function.
void irgrid3_default_cfg(irgrid3_t *ctx)
IR Grid 3 default configuration function.
float irgrid3_get_vdd(irgrid3_t *ctx, uint16_t *frame_data)
Function for getting Vdd.
void irgrid3_generic_read(irgrid3_t *ctx, uint16_t reg, uint8_t *rx_buf, uint16_t rx_len)
IR Grid 3 I2C reading function.
void irgrid3_get_pixel_temperature(irgrid3_t *ctx, float *temp_ambient, float *pixel_temp)
Function for getting pixels temperature.
uint16_t irgrid3_get_subpage_number(uint16_t *frame_data)
Function for getting sub page number.
uint16_t irgrid3_get_frame_data(irgrid3_t *ctx, uint16_t *frame_data)
Function for getting frame data.
void irgrid3_set_refresh_rate(irgrid3_t *ctx, uint8_t refresh_rate)
Function for setting refresh rate.
void irgrid3_set_resolution(irgrid3_t *ctx, uint8_t resolution)
Function for setting resolution.
uint16_t irgrid3_get_current_mode(irgrid3_t *ctx)
Function for getting current mode.
void irgrid3_get_image(irgrid3_t *ctx, uint16_t *frame_data, float *px_matrix)
Function for getting Image.
uint16_t irgrid3_get_refresh_rate(irgrid3_t *ctx)
Function for getting current refresh Rate.
err_t irgrid3_init(irgrid3_t *ctx, irgrid3_cfg_t *cfg)
IR Grid 3 initialization function.
void irgrid3_set_chess_mode(irgrid3_t *ctx)
Function for setting chess mode.
uint16_t irgrid3_get_current_res(irgrid3_t *ctx)
Function for getting current resolution.
void irgrid3_calculate_temp_obj(irgrid3_t *ctx, uint16_t *frame_data, float tr_data, float *px_matrix)
Function for calculating temperature objects.
void irgrid3_set_interleaved_mode(irgrid3_t *ctx)
Function for setting interleaved mode.
void irgrid3_read_eeprom(irgrid3_t *ctx, uint16_t *eeprom_data)
Function for reading EEPROM.
uint8_t irgrid3_extract_parameters(irgrid3_t *ctx, uint16_t *eeprom_data)
Parameters storage function.
void irgrid3_generic_write(irgrid3_t *ctx, uint16_t reg, uint8_t *data_buf, uint16_t len)
IR Grid 3 I2C writing function.
irgrid3_return_value_t
IR Grid 3 Click return value data.
Definition irgrid3.h:169
@ IRGRID3_ERROR
Definition irgrid3.h:171
@ IRGRID3_EEPROM_OK
Definition irgrid3.h:173
@ IRGRID3_2_PIX_ERROR
Definition irgrid3.h:179
@ IRGRID3_ADJ_PIXELS_ERROR
Definition irgrid3.h:175
@ IRGRID3_INIT_ERROR
Definition irgrid3.h:172
@ IRGRID3_ADJ_PIXELS_OK
Definition irgrid3.h:176
@ IRGRID3_BROKEN_PIX_ERROR
Definition irgrid3.h:177
@ IRGRID3_EEPROM_ERROR
Definition irgrid3.h:174
@ IRGRID3_OUTLIER_PIX_ERROR
Definition irgrid3.h:178
@ IRGRID3_OK
Definition irgrid3.h:170
IR Grid 3 Click configuration object.
Definition irgrid3.h:155
uint32_t i2c_speed
Definition irgrid3.h:159
pin_name_t scl
Definition irgrid3.h:156
pin_name_t sda
Definition irgrid3.h:157
uint8_t i2c_address
Definition irgrid3.h:160
IR Grid 3 Click params definition.
Definition irgrid3.h:108
int16_t k_vdd
Definition irgrid3.h:109
float ks_ta
Definition irgrid3.h:121
float kt_ptat
Definition irgrid3.h:112
uint8_t calibration_mode_eeprom
Definition irgrid3.h:120
float cp_kv
Definition irgrid3.h:117
float alpha_ptat
Definition irgrid3.h:114
int16_t vdd_25
Definition irgrid3.h:110
float kv_ptat
Definition irgrid3.h:111
float cp_kta
Definition irgrid3.h:118
uint8_t resolution_eeprom
Definition irgrid3.h:119
uint16_t v_ptat_25
Definition irgrid3.h:113
int16_t gain_eeprom
Definition irgrid3.h:115
float tgc
Definition irgrid3.h:116
IR Grid 3 Click context object.
Definition irgrid3.h:140
irgrid3_params_t params
Definition irgrid3.h:146
i2c_master_t i2c
Definition irgrid3.h:142
uint8_t slave_address
Definition irgrid3.h:145