LibDriver MLX90614  1.0.0
MLX90614 full-featured driver
driver_mlx90614.c File Reference

driver mlx90614 source file More...

#include "driver_mlx90614.h"
#include <math.h>

Go to the source code of this file.

Macros

#define CHIP_NAME   "Melexis MLX90614"
 chip information definition More...
 
#define MANUFACTURER_NAME   "Melexis"
 
#define SUPPLY_VOLTAGE_MIN   4.5f
 
#define SUPPLY_VOLTAGE_MAX   5.5f
 
#define MAX_CURRENT   2.5f
 
#define TEMPERATURE_MIN   -40.0f
 
#define TEMPERATURE_MAX   125.0f
 
#define DRIVER_VERSION   1000
 
#define COMMAND_READ_FLAGS   0xF0
 chip command definition More...
 
#define COMMAND_ENTER_SLEEP   0xFF
 
#define MLX90614_REG_RAM_RAW_DATA_IR_CHANNEL_1   0x04
 chip register definition More...
 
#define MLX90614_REG_RAM_RAW_DATA_IR_CHANNEL_2   0x05
 
#define MLX90614_REG_RAM_TA   0x06
 
#define MLX90614_REG_RAM_TOBJ1   0x07
 
#define MLX90614_REG_RAM_TOBJ2   0x08
 
#define MLX90614_REG_EEPROM_TO_MAX   0x20
 
#define MLX90614_REG_EEPROM_TO_MIN   0x21
 
#define MLX90614_REG_EEPROM_PWM_CTRL   0x22
 
#define MLX90614_REG_EEPROM_TA_RANGE   0x23
 
#define MLX90614_REG_EEPROM_EMISSIVITY   0x24
 
#define MLX90614_REG_EEPROM_CONFIG1   0x25
 
#define MLX90614_REG_EEPROM_ADDRESS   0x2E
 
#define MLX90614_REG_EEPROM_ID1_NUMBER   0x3C
 
#define MLX90614_REG_EEPROM_ID2_NUMBER   0x3D
 
#define MLX90614_REG_EEPROM_ID3_NUMBER   0x3E
 
#define MLX90614_REG_EEPROM_ID4_NUMBER   0x3F
 

Functions

uint8_t mlx90614_set_addr (mlx90614_handle_t *handle, uint8_t addr)
 set the address More...
 
uint8_t mlx90614_get_addr (mlx90614_handle_t *handle, uint8_t *addr)
 get the address More...
 
uint8_t mlx90614_write_addr (mlx90614_handle_t *handle, uint8_t addr)
 write the address More...
 
uint8_t mlx90614_read_addr (mlx90614_handle_t *handle, uint8_t *addr)
 read the address More...
 
uint8_t mlx90614_set_fir_length (mlx90614_handle_t *handle, mlx90614_fir_length_t len)
 set the ir sensor fir length More...
 
uint8_t mlx90614_get_fir_length (mlx90614_handle_t *handle, mlx90614_fir_length_t *len)
 get the ir sensor fir length More...
 
uint8_t mlx90614_set_iir (mlx90614_handle_t *handle, mlx90614_iir_t iir)
 set the iir param More...
 
uint8_t mlx90614_get_iir (mlx90614_handle_t *handle, mlx90614_iir_t *iir)
 get the iir param More...
 
uint8_t mlx90614_set_mode (mlx90614_handle_t *handle, mlx90614_mode_t mode)
 set the mode More...
 
uint8_t mlx90614_get_mode (mlx90614_handle_t *handle, mlx90614_mode_t *mode)
 get the mode More...
 
uint8_t mlx90614_set_ir_sensor (mlx90614_handle_t *handle, mlx90614_ir_sensor_t sensor)
 set the ir sensor mode More...
 
uint8_t mlx90614_get_ir_sensor (mlx90614_handle_t *handle, mlx90614_ir_sensor_t *sensor)
 get the ir sensor mode More...
 
uint8_t mlx90614_set_ks (mlx90614_handle_t *handle, mlx90614_ks_t ks)
 set the ks param More...
 
uint8_t mlx90614_get_ks (mlx90614_handle_t *handle, mlx90614_ks_t *ks)
 get the ks param More...
 
uint8_t mlx90614_set_kt2 (mlx90614_handle_t *handle, mlx90614_kt2_t kt2)
 set the kt2 param More...
 
uint8_t mlx90614_get_kt2 (mlx90614_handle_t *handle, mlx90614_kt2_t *kt2)
 get the kt2 param More...
 
uint8_t mlx90614_set_gain (mlx90614_handle_t *handle, mlx90614_gain_t gain)
 set the gain param More...
 
uint8_t mlx90614_get_gain (mlx90614_handle_t *handle, mlx90614_gain_t *gain)
 get the gain param More...
 
uint8_t mlx90614_set_sensor_test (mlx90614_handle_t *handle, mlx90614_bool_t enable)
 enable or disable the sensor test More...
 
uint8_t mlx90614_get_sensor_test (mlx90614_handle_t *handle, mlx90614_bool_t *enable)
 get the sensor test status More...
 
uint8_t mlx90614_set_repeat_sensor_test (mlx90614_handle_t *handle, mlx90614_bool_t enable)
 enable or disable the repeat sensor test More...
 
uint8_t mlx90614_get_repeat_sensor_test (mlx90614_handle_t *handle, mlx90614_bool_t *enable)
 get the repeat sensor test status More...
 
uint8_t mlx90614_set_emissivity_correction_coefficient (mlx90614_handle_t *handle, uint16_t value)
 set the emissivity correction coefficient More...
 
uint8_t mlx90614_get_emissivity_correction_coefficient (mlx90614_handle_t *handle, uint16_t *value)
 get the emissivity correction coefficient More...
 
uint8_t mlx90614_emissivity_correction_coefficient_convert_to_register (mlx90614_handle_t *handle, double s, uint16_t *reg)
 convert the emissivity correction coefficient to the register raw data More...
 
uint8_t mlx90614_emissivity_correction_coefficient_convert_to_data (mlx90614_handle_t *handle, uint16_t reg, double *s)
 emissivity correction coefficient convert to data More...
 
uint8_t mlx90614_read_raw_ir_channel (mlx90614_handle_t *handle, uint16_t *channel_1, uint16_t *channel_2)
 read the ir channel raw data More...
 
uint8_t mlx90614_read_ambient (mlx90614_handle_t *handle, uint16_t *raw, float *celsius)
 read the ambient More...
 
uint8_t mlx90614_read_object1 (mlx90614_handle_t *handle, uint16_t *raw, float *celsius)
 read the object1 More...
 
uint8_t mlx90614_read_object2 (mlx90614_handle_t *handle, uint16_t *raw, float *celsius)
 read the object2 More...
 
uint8_t mlx90614_get_id (mlx90614_handle_t *handle, uint16_t id[4])
 get the chip id More...
 
uint8_t mlx90614_get_flag (mlx90614_handle_t *handle, uint16_t *flag)
 get the flag More...
 
uint8_t mlx90614_enter_sleep_mode (mlx90614_handle_t *handle)
 enter to sleep mode More...
 
uint8_t mlx90614_pwm_to_smbus (mlx90614_handle_t *handle)
 change pwm mode to smbus mode More...
 
uint8_t mlx90614_exit_sleep_mode (mlx90614_handle_t *handle)
 exit from sleep mode More...
 
uint8_t mlx90614_init (mlx90614_handle_t *handle)
 initialize the chip More...
 
uint8_t mlx90614_deinit (mlx90614_handle_t *handle)
 close the chip More...
 
uint8_t mlx90614_set_reg (mlx90614_handle_t *handle, uint8_t reg, uint16_t data)
 set the chip register More...
 
uint8_t mlx90614_get_reg (mlx90614_handle_t *handle, uint8_t reg, uint16_t *data)
 get the chip register More...
 
uint8_t mlx90614_info (mlx90614_info_t *info)
 get chip information More...
 

Detailed Description

driver mlx90614 source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2021-10-03

history

Date Version Author Description
2021/10/03 1.0 Shifeng Li first upload

Definition in file driver_mlx90614.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "Melexis MLX90614"

chip information definition

chip name

Definition at line 43 of file driver_mlx90614.c.

◆ COMMAND_ENTER_SLEEP

#define COMMAND_ENTER_SLEEP   0xFF

enter sleep command

Definition at line 56 of file driver_mlx90614.c.

◆ COMMAND_READ_FLAGS

#define COMMAND_READ_FLAGS   0xF0

chip command definition

read flags command

Definition at line 55 of file driver_mlx90614.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 50 of file driver_mlx90614.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Melexis"

manufacturer name

Definition at line 44 of file driver_mlx90614.c.

◆ MAX_CURRENT

#define MAX_CURRENT   2.5f

chip max current

Definition at line 47 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_ADDRESS

#define MLX90614_REG_EEPROM_ADDRESS   0x2E

eeprom address register

Definition at line 72 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_CONFIG1

#define MLX90614_REG_EEPROM_CONFIG1   0x25

eeprom config1 register

Definition at line 71 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_EMISSIVITY

#define MLX90614_REG_EEPROM_EMISSIVITY   0x24

eeprom emissivity register

Definition at line 70 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_ID1_NUMBER

#define MLX90614_REG_EEPROM_ID1_NUMBER   0x3C

eeprom id1 number register

Definition at line 73 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_ID2_NUMBER

#define MLX90614_REG_EEPROM_ID2_NUMBER   0x3D

eeprom id2 number register

Definition at line 74 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_ID3_NUMBER

#define MLX90614_REG_EEPROM_ID3_NUMBER   0x3E

eeprom id3 number register

Definition at line 75 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_ID4_NUMBER

#define MLX90614_REG_EEPROM_ID4_NUMBER   0x3F

eeprom id4 number register

Definition at line 76 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_PWM_CTRL

#define MLX90614_REG_EEPROM_PWM_CTRL   0x22

eeprom pwm ctrl register

Definition at line 68 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_TA_RANGE

#define MLX90614_REG_EEPROM_TA_RANGE   0x23

eeprom ta range register

Definition at line 69 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_TO_MAX

#define MLX90614_REG_EEPROM_TO_MAX   0x20

eeprom to max register

Definition at line 66 of file driver_mlx90614.c.

◆ MLX90614_REG_EEPROM_TO_MIN

#define MLX90614_REG_EEPROM_TO_MIN   0x21

eeprom to min register

Definition at line 67 of file driver_mlx90614.c.

◆ MLX90614_REG_RAM_RAW_DATA_IR_CHANNEL_1

#define MLX90614_REG_RAM_RAW_DATA_IR_CHANNEL_1   0x04

chip register definition

ram raw data ir channel 1 register

Definition at line 61 of file driver_mlx90614.c.

◆ MLX90614_REG_RAM_RAW_DATA_IR_CHANNEL_2

#define MLX90614_REG_RAM_RAW_DATA_IR_CHANNEL_2   0x05

ram raw data ir channel 2 register

Definition at line 62 of file driver_mlx90614.c.

◆ MLX90614_REG_RAM_TA

#define MLX90614_REG_RAM_TA   0x06

ram ta register

Definition at line 63 of file driver_mlx90614.c.

◆ MLX90614_REG_RAM_TOBJ1

#define MLX90614_REG_RAM_TOBJ1   0x07

ram tobj1 register

Definition at line 64 of file driver_mlx90614.c.

◆ MLX90614_REG_RAM_TOBJ2

#define MLX90614_REG_RAM_TOBJ2   0x08

ram tobj2 register

Definition at line 65 of file driver_mlx90614.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   5.5f

chip max supply voltage

Definition at line 46 of file driver_mlx90614.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   4.5f

chip min supply voltage

Definition at line 45 of file driver_mlx90614.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   125.0f

chip max operating temperature

Definition at line 49 of file driver_mlx90614.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 48 of file driver_mlx90614.c.