重构代码结构(拆分为多文件),并添加了XLSW通信协议。
This commit is contained in:
@@ -6,27 +6,19 @@
|
||||
#define MLX90614_H
|
||||
|
||||
#include "gd32e23x.h"
|
||||
#include "i2c.h"
|
||||
#include "gd32e23x.h"
|
||||
#include "systick.h"
|
||||
#include <stdio.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)
|
||||
#define MLX90614_ADDR (0x5A << 1)
|
||||
#define MLX90614_OBJ_TEMP_REG 0x07
|
||||
#define MLX90614_AMB_TEMP_REG 0x06
|
||||
|
||||
#define SLAVE_ADDR (0x5A << 1)
|
||||
#define REG_ADDR_OBJ_TEMP 0x07
|
||||
#define REG_ADDR_AMB_TEMP 0x06
|
||||
/******************************************************************************/
|
||||
|
||||
/* function declarations */
|
||||
/* this function configures I2C Peripheral & GPIO AF for I2C */
|
||||
void MLX90614_I2CConfig(void);
|
||||
/* this function reads object temperature */
|
||||
int MLX90614_GetObjectTemperature(void);
|
||||
uint16_t mlx90614_get_objrct_temperature(void);
|
||||
|
||||
#endif //MLX90614_H
|
||||
|
||||
Reference in New Issue
Block a user