39 lines
824 B
C
39 lines
824 B
C
//
|
|
// Created by dell on 24-9-26.
|
|
//
|
|
|
|
#ifndef MLX90614_H
|
|
#define MLX90614_H
|
|
|
|
#include "gd32e23x.h"
|
|
|
|
#define I2C_SPEED 100000
|
|
#define IR_I2C I2C0
|
|
#define RCU_IR_GPIO RCU_GPIOF
|
|
#define RCU_I2C RCU_I2C0
|
|
#define I2C_SCL_PORT GPIOF
|
|
#define I2C_SCL_PIN GPIO_PIN_1
|
|
#define I2C_SDA_PORT GPIOF
|
|
#define I2C_SDA_PIN GPIO_PIN_0
|
|
#define I2C_GPIO_AF GPIO_AF_1
|
|
|
|
#define I2C_TIME_OUT (uint16_t)(5000)
|
|
|
|
typedef enum {
|
|
I2C_START = 0,
|
|
I2C_SEND_ADDR,
|
|
I2C_CLEAR_ADDRESS_FLAG,
|
|
I2C_TRANSMIT_DATA,
|
|
I2C_STOP
|
|
} i2c_process_enum;
|
|
|
|
// #define I2C_EVENT_MASTER_MODE_SELECT ((uint32_t)(I2C_FLAG_I2CBSY | I2C_FLAG_MASTER | I2C_FLAG_RBNE))
|
|
#define SLAVE_ADDR (0x5A << 1)
|
|
#define REG_ADDR_OBJ_TEMP 0x07
|
|
#define REG_ADDR_AMB_TEMP 0x06
|
|
|
|
void i2c_config(void);
|
|
uint32_t read_ir_mlx90614(void);
|
|
|
|
#endif //MLX90614_H
|