RK3568平台 温度传感器芯片SD5075_rk3568 adc

文章介绍了如何使用SD5075芯片进行温度监控,通过ALARM引脚检测温度变化,通过I2C通信将数据存储在寄存器并读取。详细展示了Linux驱动程序中的代码实现,包括配置寄存器、I2C读写操作以及温度值的处理。
摘要由CSDN通过智能技术生成

SD5075芯片经过ALARM引脚检测温度的变化,经过模数转换器的转换,把温度值写入寄存器中,SOC再通过IIC读取寄存器的值,从而拿到温度值。

寄存器列表:

通过配置0x01寄存器为0x00,通过寄存器0x00读取到温度结果。

三.代码实现

#include <linux/miscdevice.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/i2c-dev.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/compat.h>
#include <linux/printk.h>
#include <linux/kobject.h>
#include <linux/version.h>


#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x00)
#define DRIVER_NAME "IST_TEMP"



/*define logging*/
#define IST_TEMP_DEBUG	0
#if IST_TEMP_DEBUG
#define DBG(format, args...)					\
	printk(KERN_DEBUG "%s: " format, DRIVER_NAME, ##args)
#define ERR(format, args...)					\
	printk(KERN_ERR "%s: " format, DRIVER_NAME, ##args)
#define WARNING(format, args...)				\
	printk(KERN_WARN "%s: " format, DRIVER_NAME, ##args)
#define INFO(format, args...)					\
	printk(KERN_INFO "%s: " format, DRIVER_NAME, ##args)
#else
#define DBG(format, args...)
#define ERR(format, args...)
#define WARNING(format, args...)
#define INFO(format, args...)
#endi
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值