You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.4 KiB

1 year ago
/*******************************************************************************
* Filename: bsp_mlx90615.h
* Revised: All copyrights reserved to Roger.
* Date: 2022-05-04
* Revision: v1.0
* Writer: Roger-WY.
*
* Description: ()
*******************************************************************************/
#ifndef __BSP_MLX90615_H__
#define __BSP_MLX90615_H__
#include "msp_iicMx.h"/////使用iic1 作为
#include "c_type51.h"/////
#include "stc_8_delay.h"/////
#define MLX90615_TEMP_READ_ERR_CODE -99
/* MLX90615 内部寄存器地址定义 */
/* Private defines -----------------------------------------------------------*/
/* DEFAULT SLAVE ADDRESS */
#define MLX90615_ADDR 0x5B
#define MLX90615_ADDR_WR (MLX90615_ADDR << 1)
#define MLX90615_EEPROM_SA 0x10
#define MLX90615_EEPROM_PWMT_MIN MLX90615_EEPROM_SA
#define MLX90615_EEPROM_PWMT_RNG 0x11
#define MLX90615_EEPROM_CONFIG 0x12
#define MLX90615_EEPROM_EMISSIVITY 0x13
#define MLX90615_RAW_IR_DATA 0x25
#define MLX90615_AMBIENT_TEMPERATURE 0x26
#define MLX90615_OBJECT_TEMPERATURE 0x27
#define MLX90615_SLEEP 0xC6
// DEPRECATED! (just emissivity, not the whole EEPROM)
#define AccessEEPROM MLX90615_EEPROM_EMISSIVITY
#define Default_Emissivity 0x4000
/* MLX90615 供外部调用函数 */
u8 bsp_Mlx90615Init(void);
int8_t bsp_Mlx90615ScanDevice(uint8_t *pSlaveAddr);
int8_t bsp_Mlx90615ReadTempAmbient(uint8_t slaveAddr, float *ao);
int8_t bsp_Mlx90615ReadTempObject(uint8_t slaveAddr, float *to);
int8_t bsp_Mlx90615ReadIrData(uint8_t slaveAddr, uint16_t *ir);
int8_t bsp_Mlx90615ReadEmissivity(uint8_t slaveAddr, float *emissivity);
int8_t bsp_Mlx90615SetEmissivity(uint8_t slaveAddr, float emissivity);
#define L0_mlx95_wakeup() L0_IICMx_SCL(D_iicch_mlx96015,1);\
delay_ms2(1);\
L0_IICMx_SCL(D_iicch_mlx96015,0);\
delay_ms2(40);\
L0_IICMx_SCL(D_iicch_mlx96015,1);
typedef struct
{
u8 d[12];
u8 Object[3];
u8 Ambient[3];
u16 tmp;
/// u32 u32a;
u16 u16b;
u16 u16t;
u16 u16out_o;///目标温度 放大100倍
u16 u16out_a;///环境温度 放大100倍
}TS_mx95_;
extern TS_mx95_ ts_mx95;
void L1_mlx95_get_tmp(void);
#endif
/***************************** (END OF FILE) **********************************/