Main Site Documentation

RLP events on Panda


#1

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.


#2

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.


#3

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

He has an interrupt handler in use.

Cheers Ian


#4

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.


#5

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
http://www.ghielectronics.com/beta_01979/Library%20Documentation/Index.html

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


#6

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


#7

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);


#8

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…


#9

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


#10

correct


#11

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

Now it works again. Thanks.


#12

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.