完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在尝试使用这个驱动程序(这是在Alpha发行注释中标注为alpha),所以这对我的智慧来说并不多。到目前为止,它的工作方式是多方面的。然而,回调函数上的文档(DrimeRealReaveSeV111的第424页)似乎表明我可以使用上下文并在回调上下文中拥有它。当调用EvEnthDrand函数时,参数的值将被传递回客户端。它可以用来标识任何客户端特定的数据对象,该对象标识客户端模块的实例(例如,它可能是指向客户端模块的状态结构的指针)。但是,无论我用BuffReEvEnthDeleLSET发送到上下文中,都在回调上下文=0x00中。在驱动状态机中快速查看,我注意到这看起来像在不包含上下文的情况下触发回调……但是它对我来说很神秘,所以我可以解释它是错误的。有人知道这件事吗?更新:看起来,如果你改变了看起来像上面ToT的线条使上下文特征工作。那么我想我正在得到alpha’d。也许有人应该解决这个问题,或者我可能在文档中漏掉了,因为它说它没有实现。
以上来自于百度翻译 以下为原文 I am trying to use this driver (which is labeled Alpha in the HARMony release notes so this doesn't say much for my wisdom). It is working in most ways so far. However, the documentation (page 424 of DriverLibraries_v111) on the callback function seems to indicate I can use the context and have it in the callback. context The value of parameter will be passed back to the client unchanged, when the eventHandler function is called. It can be used to identify any client specific data object that identifies the instance of the client module (for example, it may be a pointer to the client module's state structure).But whatever I send into context using BufferEventHandlerSet, inside the callback context = 0x00. A quick look in the driver state machine and I noticed this /* Give an indication to the higher layer upon successful transmission */ _DRV_I2C_CLIENT_OBJ(((DRV_I2C_CLIENT_OBJ *)lBufferObj->clientHandle), callback) ( DRV_I2C_BUFFER_EVENT_COMPLETE, (DRV_I2C_BUFFER_HANDLE)lBufferObj, 0x00 ); Which looks like firing the callback without including the context...but it's pretty cryptic to me so I could be interpreting it wrong. Anybody know anything about this? UPDATE: Looks like if you change the lines that look like the above to /* Give an indication to the higher layer upon successful transmission */ _DRV_I2C_CLIENT_OBJ(((DRV_I2C_CLIENT_OBJ *)lBufferObj->clientHandle), callback) ( _DRV_I2C_CLIENT_OBJ(lBufferObj, status), (DRV_I2C_BUFFER_HANDLE)lBufferObj, ((DRV_I2C_CLIENT_OBJ *)lBufferObj->clientHandle)->context); It makes the context feature work. So I guess I am getting Alpha'd. Probably somebody important should fix this or possibly I missed in the documentation where it says it is unimplemented. |
|
相关推荐
5个回答
|
|
文档中有两行表示上下文值被保留。但是,CALBACK上下文——不是实现的,是未来扩展的,它正在被存储,所以你可以用你所指示的方式去使用它。我会创建一张票,看看它是否至少可以使用。请注意,它可能会在某个时间点发生变化。
以上来自于百度翻译 以下为原文 There are a couple of lines in the documentation which indicate that the context value is reserved. "callbackContext - Not implemented, future expansion" However, it is being stored so you can probably get away with using it the way you indicate. I'll create a ticket and see if it can at least become usable. Please be aware that it might change at some point. |
|
|
|
我在接收/传输/传输接收函数上看到了这一点,但是在DRCJI2CYBuffErrEnEdand函数中,我觉得它们意味着要实现它。谢谢你和我一起看
以上来自于百度翻译 以下为原文 I saw that on the Receive/Transmit/TransmitThenReceive functions, but on the DRC_I2C_BufferEventHandlerSet function it looked to me like they meant it to be implemented. Thanks for looking at it with me |
|
|
|
我将研究一下文档的一致性。谢谢,玛塔。
以上来自于百度翻译 以下为原文 I will take a look at making the documentation consistent as well. Thanks, matta. |
|
|
|
我不认为没有上下文调用回调函数是一个好的设计。您必须有全局变量才能访问某些上下文。如果你有几个实例,每一个都有不同的上下文,事情就会变得更加丑陋。因此,您需要为每个实例实现回调函数,并具有多个全局VAR。一旦你正在动态创建实例,你就几乎失去了!上下文指针必须保持!删除文档中的“未实现,…”的所有事件并在代码中实现它们。Nick
以上来自于百度翻译 以下为原文 I don't think that having a callback function being called without a context is a good design. You'd have to have global variables to get access to some context. Things get more ugly, if you do have several instances that each do have a different context. So you need to implement a callback function for each instance and have several global vars. And as soon as you are creating instances dynamically, you are almost lost! The context pointer has to stay! Remove all occurences of "not implemented, ..." in the documentation and implement them in code. Nick |
|
|
|
是的,事实上,真正需要的是通过调用、接收等调用不同上下文的能力。这样,如果在I2C总线上有多个东西,就不必在一个高级别上保持一个回调,并通过所有缓冲句柄迭代来知道什么是成功的。d.
以上来自于百度翻译 以下为原文 Yes, in fact what is really needed is the ability to pass a different context with each call to transmit, receive, etc. This way if you have multiple things on the I2C Bus you don't have to keep one callback at a high level and iterate through all the buffer handles to know what has succeeded/failed. |
|
|
|
只有小组成员才能发言,加入小组>>
5195 浏览 9 评论
2013 浏览 8 评论
1937 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3185 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2240 浏览 5 评论
751浏览 1评论
637浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
522浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
648浏览 0评论
549浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-2 17:09 , Processed in 1.176839 second(s), Total 57, Slave 50 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号