handling events.

classic Classic list List threaded Threaded
6 messages Options
james osburn james osburn
Reply | Threaded
Open this post in threaded view
|

handling events.

Can elua scripts be called on the basis of timer interrupts?
James

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: handling events.

On 24 July 2012 22:24, james osburn <[hidden email]> wrote:
> Can elua scripts be called on the basis of timer interrupts?
> James

Yes.
With the Lua interrupt mechanism available from eLua 0.8, you can make
timer, UART, ADC or GPIO-edge-triggered interrupts cause a Lua
function to be called. The only caveat is that the Lua interpreter
must be doing running code (not waiting for an event) for the
interrupts to be serviced, as it can only call the Lua interrupt
routine when the interpreter is in a clean state, i.e. between
"instructions". In practice this just means that your main routine has
to be a busy-wait loop.
See http://www.eluaproject.net/doc/v0.8/en_inthandlers.html

     M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Tim Van Der Hulst Tim Van Der Hulst
Reply | Threaded
Open this post in threaded view
|

Re: handling events.

Martin,

How does this work if you want to track only one event, for example your interupt is trigger happy and generates a bunch of interupts in a very short period of time but you only want one. In C you could simply disable the interupt until you have finished processing.

Cheers,

Web guy..



----- Original Message -----
From: "Martin Guy" <[hidden email]>
To: "eLua Users and Development List (www.eluaproject.net)" <[hidden email]>
Sent: Wednesday, July 25, 2012 9:44:08 PM
Subject: Re: [eLua-dev] handling events.

On 24 July 2012 22:24, james osburn <[hidden email]> wrote:
> Can elua scripts be called on the basis of timer interrupts?
> James

Yes.
With the Lua interrupt mechanism available from eLua 0.8, you can make
timer, UART, ADC or GPIO-edge-triggered interrupts cause a Lua
function to be called. The only caveat is that the Lua interpreter
must be doing running code (not waiting for an event) for the
interrupts to be serviced, as it can only call the Lua interrupt
routine when the interpreter is in a clean state, i.e. between
"instructions". In practice this just means that your main routine has
to be a busy-wait loop.
See http://www.eluaproject.net/doc/v0.8/en_inthandlers.html

     M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: handling events.

I think it has a maximum number of pending interrupt requests but
don't know what happens to "lost" ones.
You could check the elua source code if the documentation doesn't specify it.

For your other question, I don't know what you're asking. You could try reading
www.catb.org/~esr/faqs/smart-questions.html
for guidelines

    M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Thiago Naves Thiago Naves
Reply | Threaded
Open this post in threaded view
|

Re: handling events.

In reply to this post by Tim Van Der Hulst

The lost ones will give you elua_int_add errors on terminal.
I think you always loose the last ones.

Best,
Thiago

On Jul 25, 2012 5:49 PM, "Tim Van Der Hulst" <[hidden email]> wrote:
Martin,

How does this work if you want to track only one event, for example your interupt is trigger happy and generates a bunch of interupts in a very short period of time but you only want one. In C you could simply disable the interupt until you have finished processing.

Cheers,

Web guy..



----- Original Message -----
From: "Martin Guy" <[hidden email]>
To: "eLua Users and Development List (www.eluaproject.net)" <[hidden email]>
Sent: Wednesday, July 25, 2012 9:44:08 PM
Subject: Re: [eLua-dev] handling events.

On 24 July 2012 22:24, james osburn <[hidden email]> wrote:
> Can elua scripts be called on the basis of timer interrupts?
> James

Yes.
With the Lua interrupt mechanism available from eLua 0.8, you can make
timer, UART, ADC or GPIO-edge-triggered interrupts cause a Lua
function to be called. The only caveat is that the Lua interpreter
must be doing running code (not waiting for an event) for the
interrupts to be serviced, as it can only call the Lua interrupt
routine when the interpreter is in a clean state, i.e. between
"instructions". In practice this just means that your main routine has
to be a busy-wait loop.
See http://www.eluaproject.net/doc/v0.8/en_inthandlers.html

     M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: handling events.

On Thu, Jul 26, 2012 at 10:01 PM, Thiago Naves <[hidden email]> wrote:
> The lost ones will give you elua_int_add errors on terminal.
> I think you always loose the last ones.

Yes, that is correct. All the interrupts handled on the Lua side are
put in a queue (the size of the queue is given by the
PLATFORM_INT_QUEUE_LOG_SIZE macro at build time, currently this is set
to 5 on all platform, which gives a queue of 32 entries). This queue
is NOT circular. If it fills, you'll get "elua_int_add" errors on the
terminal (a debatable decision, I agree, we might change this
behaviour in the future).

Best,
Bogdan

>
> Best,
> Thiago
>
> On Jul 25, 2012 5:49 PM, "Tim Van Der Hulst" <[hidden email]> wrote:
>>
>> Martin,
>>
>> How does this work if you want to track only one event, for example your
>> interupt is trigger happy and generates a bunch of interupts in a very short
>> period of time but you only want one. In C you could simply disable the
>> interupt until you have finished processing.
>>
>> Cheers,
>>
>> Web guy..
>>
>>
>>
>> ----- Original Message -----
>> From: "Martin Guy" <[hidden email]>
>> To: "eLua Users and Development List (www.eluaproject.net)"
>> <[hidden email]>
>> Sent: Wednesday, July 25, 2012 9:44:08 PM
>> Subject: Re: [eLua-dev] handling events.
>>
>> On 24 July 2012 22:24, james osburn <[hidden email]> wrote:
>> > Can elua scripts be called on the basis of timer interrupts?
>> > James
>>
>> Yes.
>> With the Lua interrupt mechanism available from eLua 0.8, you can make
>> timer, UART, ADC or GPIO-edge-triggered interrupts cause a Lua
>> function to be called. The only caveat is that the Lua interpreter
>> must be doing running code (not waiting for an event) for the
>> interrupts to be serviced, as it can only call the Lua interrupt
>> routine when the interpreter is in a clean state, i.e. between
>> "instructions". In practice this just means that your main routine has
>> to be a busy-wait loop.
>> See http://www.eluaproject.net/doc/v0.8/en_inthandlers.html
>>
>>      M
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev