MLX90614红外温度传感器_linux驱动源码,已经在产品中使用过。android 6.0 ,内核版本为3.4.39,可以做为你的学习设计参考。
#include
#include
#include
#include
#include
#include
#include
#include
#include //__gpio_set_value
#include //script_item_u
#include //pin_config_set
#include //SUNXI_PINCFG_TYPE_*
#include
#include
#include
#include
#define ACK 0
#define NACK 1
#define SA 0x5a //Slave address 单个MLX90614时地址为0x00,多个时地址默认为0x5a
#define RAM_ACCESS 0x00 //RAM access command
#define EEPROM_ACCESS 0x20 //EEPROM access command
#define RAM_TOBJ1 0x07 //To1 address in the eeprom
#define RAM_TOBJ2 0x08
#define RAM_TA 0x06
#define DEVICE_NAME "mlx90614"
//struct gpio_config {
// u32 gpio; /* gpio global index, must be unique */
// u32 mul_sel; /* multi sel val: 0 - input, 1 - output... */
// u32 pull; /* pull val: 0 - pull up/down disable, 1 - pull up... */
// u32 drv_level; /* driver level val: 0 - level 0, 1 - level 1... */
// u32 data; /* data val: 0 - low, 1 - high, only vaild when mul_sel is input/output */
//};
#define SCL_NAME "sensor_sck"
#define SDA_NAME "sensor_sda"
struct gpio_func_desc {
unsigned short pin;
char *name;
};
struct gpio_func_desc SCLK ={0,SCL_NAME};//蓝色
struct gpio_func_desc SDIN ={0,SDA_NAME};//白色
struct gpio_config *sclk_gpio_p = NULL;
struct gpio_config *sdin_gpio_p = NULL;
void SMBus_StartBit(void);
void SMBus_StopBit(void);