完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,
我遇到了HTS221设备驱动程序集成的问题(对于FreeRTOS应用程序)。 ST提供独立于平台的驱动程序(参见 http://www.st.com/en/mems-and-sensors/hts221.html )。但是那些驱动程序具有需要重新映射的功能://用户必须重新定义正确的HTS221_WriteReg #define HTS221_WriteReg(RegAddr,NumByteToWrite,Data)HAL_WriteReg(HTS221_I2C_ADDRESS,RegAddr,NumByteToWrite,Data)我想用I2C驱动这个驱动程序,但我不知道如何,因为我不习惯使用驱动程序。 有人已经这样做了吗?或者使用另一个类似的驱动程序和imx6板? QD 以上来自于谷歌翻译 以下为原文 Hi, I'm having trouble with HTS221 device driver integration (for a FreeRTOS app). ST provides a platform independent driver (see http://www.st.com/en/mems-and-sensors/hts221.html ). But those drivers have functions which need to be remapped : // the user must redefine the proper HTS221_WriteReg #define HTS221_WriteReg(RegAddr, NumByteToWrite, Data) HAL_WriteReg(HTS221_I2C_ADDRESS, RegAddr, NumByteToWrite, Data)I want to use this driver with I2C but I don't find how, since I'm not use to play with drivers. Did someone already do this ? Or use another similary driver with an imx6 board ? QD |
|
相关推荐
4个回答
|
|
你好,
我没有使用这些驱动程序,但我已经编写了自己的驱动程序,我想我可以为您提供一个简短的描述,这是什么。 驱动程序本身(.c文件)及其头文件(.h文件)提供传感器功能和必要的功能等声明。但是,为了平***立,a https://en.wikipedia.org/wiki/Hardware_abstraction 用来。 ST提供的所有代码通常在不使用访问特定硬件的任何代码的情况下工作。这是它可以保持平***立的唯一方式。由于HTS221是I2C / SPI传感器,它假定程序员只会编写(定义)您上面提到的功能。因此,您的工作是编写系统特定部分的代码(这意味着适合您的RTOS和HW)。您需要找到RTOS的文档(可能还有您的微控制器并学习),如何初始化和使用I2C总线(如果这是您要使用的总线)。如果您已熟悉I2C,则唯一要实现的方法是在主模式下启动I2C的方法,在某个器件的地址写入寄存器(具有参数计数)的方法以及读取寄存器的方法(同样,使用参数化计数)他们来自某个设备的地址。 大卫 以上来自于谷歌翻译 以下为原文 Hello, I haven't used these drivers, but I have written my own and I think I can provide you a brief description, what is this about. The driver itself (.c file) and its header file (.h file) provide the sensor functionality and necessary function etc. declarations. However, in order to be platform independent, a https://en.wikipedia.org/wiki/Hardware_abstraction is used. All the code provided by ST is generally working without using any code accessing a specific hardware. That is the only way it can remain platform independent. Since HTS221 is an I2C / SPI sensor, it assumes the programmer will just write (define) the functions you mentioned above.So, your job is to write the code for the system specific part (this means suited to your RTOS and HW). You need to find a documentation to your RTOS (and probably also your micro-controller and learn), how the I2C bus (if this is the bus you want to use) is initialized and used. If you are familiar with I2C already, the only thing to implement are methods to start the I2C in master mode, method to write registers (with parametrised count of them) at some device's address and a method to read registers (again, with parametrised count of them) from some device's address. David |
|
|
|
谢谢回答。我清楚地看到了我必须做的事情,但是我找不到任何帮助我开发预期功能的例子。我刚刚找到了i.MX6SoloX的freertos BSP的API参考手册:
以上来自于谷歌翻译 以下为原文 Thanks for answering. I see clearly the stuff I have to do, but I don't find any example helping me to develop the expected function. I've just found the API reference manual for the freertos BSP of i.MX6SoloX : |
|
|
|
那是一个很好的一步!
正如我上面所写,我将重点关注三件事: 1)I2C初始化:这正是您在9.2.2节中参考手册中粘贴的内容 2)读取多个字节:这只是写一个周期,通过I2C_ReadByte发送更多字节,如9.2.3节所述 3)使用I2C_WriteByte写入多个字节:与2)相同 如果您在使用FreeRTOS时遇到困难,请尝试在FreeRTOS论坛上寻求帮助。如果您在使用i.MX设备时遇到困难,请尝试询问 https://community.nxp.com/ 。你必须非常幸运地在这里找到帮助,因为你的问题根源不在传感器本身...... 以上来自于谷歌翻译 以下为原文 That is a good step! As I wrote above, I would focus on three things: 1) I2C initialization: that is exactly what you pasted in the reference manual in section 9.2.2 2) Read multiple bytes: that is just about writing a cycle to send more bytes via I2C_ReadByte as stated in section 9.2.3 3) Write multiple bytes: the same as for 2) using I2C_WriteByte If you struggle with the FreeRTOS, try to ask for help on FreeRTOS forum. If you struggle with the i.MX device, try to ask on https://community.nxp.com/ . You would have to be quite lucky to find a help here, since your question roots are not in the sensor itself... |
|
|
|
谢谢大卫,我会专注于你给我的指示!希望它能奏效!
以上来自于谷歌翻译 以下为原文 Thanks David, I'll focus on the indications you gave me ! Hope it will work ! |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
1408 浏览 1 评论
2058 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1507 浏览 1 评论
2803 浏览 6 评论
5186 浏览 21 评论
351浏览 4评论
503浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
276浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
561浏览 3评论
479浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-20 00:04 , Processed in 1.337919 second(s), Total 74, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号