0

I am trying to interface a heart rate sensor with my processor. All the register in it are 24-bits in size . My doubt was can I use the spi driver code from github for this purpose. I am not sure if it would read or write 24-bits. I have taken the spi code from the open source (github). Can anyone please help me out if i could use that code or not? I am providing the link for the spi driver code. Please guide me.

https://github.com/warpboard/linux-imx6/blob/warp/jb4.3_1.1.0-ga/include/linux/spi/spi.h

spi driver header file

Regards,

Sathya Prasad P

4

1 回答 1

0

如果你的处理器运行的是 linux,我看不出你为什么不使用它。就在读取和写入寄存器时,您必须读取和写入 3 个字符并将这些字符复制到整数表示中或从整数表示中复制。

实际上,您可能必须将字符复制到具有其他字节的帧和整个帧的十个中,而在接收时则相反。

如果您没有运行 linux,则最好直接访问 SPI 的硬件寄存器并直接发送和接收字节,也许使用 makres 示例代码,

于 2014-12-11T04:57:25.280 回答