RLP events on Panda

I’ve just tested RLP on Panda and its working as expected.

However I couldnt find on the documentation how to use the event handler.

What I’m trying to do is the following:
Collect samples at 1Khz from AD put them on a Queue and after getting 50 samples generate an event on C# side to read those samples and send them via USB CDC to host.

I do not know if this is the best aproach.

Another posible solution would be having the C# checking the queue size and read 50 when there is 50 or more items on queue… But this will be wasting time on checking the queue size on the C# thread…

I suppose the 1st. aproach is better but dont know how to use event handler. What do you think ?

By the way thank GHI for letting me test this SDK without having enough experience points.

I would think definately #1 as well. But have not looked into RLP. I have been resisting looking at gcc again. To many *nix memories and dreaming of failed production cron jobs.

Check out this forum thread
[url]http://www.tinyclr.com/forum/10/2535/[/url]

He has an interrupt handler in use.

Cheers Ian

IanR, I’ve just succesed in hooking an interrupt (And it is extremly easy), but I need to generate a C# event from native code, to notify .NETMF to do something.

There is a function in RLPext:

[quote]PostManagedEvent void PostManagedEvent(unsigned int data) Queues a managed event to be sent to RLPEvent (not sent immediately).
data: User supplied data. [/quote]

And the event named RLPEvent
[url]http://www.ghielectronics.com/beta_01979/Library%20Documentation/Index.html[/url]

Not sure if it can help you, but from name it seems just what you are looking for.

Rimvis is correct.
Sample data in a native task that it schedules itself automatically.
Then at 50 samples or so, call PostMangedEvent(some number up to you).
Then in managed code event you have to call RLP with a “Read the current buffer(byte[])”…etc

I didnt understand how to hook the event on C#. I do understand know, just to be sure this is the proper way right ?


            RLP.RLPEvent += new RLPEventHandler(myHandler);

Sorry I mean now not know in the previous post. The modify button is not working for me right now, i think this is due to the site being upgraded…

You can edit your messages and correct any typos. :wink:

correct

It wasnt working the modify button earlier, at least in my machine.

Now it works again. Thanks.

By the way, does anyone knows how to include the elf as a linked resource not embedded ?

Becasue if I click the add file and chose the elf, I need to erase and include it again every time I change the elf. Its very tedious.

I’ve been succesfull in comunicating between C# and native using events and sending a byte array to Native side and return data.

Now i only have to manage to get adc working on native side.

Thanks to all who answer. I will put the whole project on fezzer after finished.