100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 瑞芯微读取寄存器_【rockchip PX30平台】uboot中读取I2C设备的寄存器值

瑞芯微读取寄存器_【rockchip PX30平台】uboot中读取I2C设备的寄存器值

时间:2022-10-13 19:16:55

相关推荐

瑞芯微读取寄存器_【rockchip PX30平台】uboot中读取I2C设备的寄存器值

前言

最近项目中有块rockchip的板子需要同时适配两块LCD,但是没看到RK平台本身有这个功能,所以我们想到通过TP本身提供的sensor id去判断,然后做相应的初始化动作。

所以我们需要先看一下在uboot中怎么去获取TP的sensor id值。

正文

TP本身是有寄存器给我们去获取一些信息,包括sensor id:

如红色框起来的地方,读取寄存器0x814A的低4位就可以知道sensor id了。

我的TP是通过I2C去和CPU通信的,所以我们就可以通过I2C提供的接口去读取TP寄存器的值:

/*

* Read/Write interface:

* chip: I2C chip address, range 0..127

* addr: Memory (register) address within the chip

* alen: Number of bytes to use for addr (typically 1, 2 for larger

* memories, 0 for register type devices with only one

* register)

* buffer: Where to read/write the data

* len: How many bytes to read/write

*

* Returns: 0 on su

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。