Getting events from a pin change interrupt

ChibiOS public support forum for topics related to the Atmel AVR family of micro-controllers.

Moderator: tfAteba

Post Reply
JetForMe
Posts: 99
Joined: Mon Jan 31, 2011 8:12 am

Getting events from a pin change interrupt

Post by JetForMe »

The AVR has support for pin-change interrupts. My GPS has a 1-pulse per second signal I'd like to see if I can connect to a pin, and then get an event in my app code every time that pulse occurs.

I realize I need to write an interrupt handler. I guess inside that I need to generate the event, but I need to create some kind of source, too, right?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Getting events from a pin change interrupt

Post by Giovanni »

You may use as example the serial driver interrupt handlers. In ChibiOS/RT the interrupt handlers are written in the same way on all architectures, learn once use everywhere. There is also an "how to" in the documentation that may help you.

Giovanni
wicky
Posts: 1
Joined: Fri Nov 14, 2014 7:23 am

Re: Getting events from a pin change interrupt

Post by wicky »

I realize I need to write an interrupt handler. I guess inside that I need to generate the event, but I need to create some kind of source, too, right?


__________________
dhoom
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Getting events from a pin change interrupt

Post by Giovanni »

wicky wrote:I realize I need to write an interrupt handler. I guess inside that I need to generate the event, but I need to create some kind of source, too, right?
dhoom


The object is called EventSource, you just have to initialize it and then broadcast events using it.

Giovanni
Post Reply