a110x: Add interrupt support and a suitable example

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: John Van Drasek <john.r.van.drasek@intel.com>
This commit is contained in:
Jon Trulson
2015-03-25 12:58:02 -06:00
committed by John Van Drasek
parent 317ad35180
commit 4bb077e70b
4 changed files with 118 additions and 2 deletions

View File

@ -50,7 +50,10 @@ namespace upm {
* whether it is detecting a magnetic field with south polarity
* perpendicular to the sensor element.
*
* An example showing a simple test for the presence of a field
* @snippet a110x.cxx Interesting
* An example demonstrating the use of an interrupt handler to count pulses
* @snippet a110x-intr.cxx Interesting
*/
class A110X {
public:
@ -71,7 +74,24 @@ namespace upm {
*/
bool magnetDetected();
/**
* Install an Interrupt Service Routine (ISR) to be called when
* the appropriate magnetic field is detected.
*
* @param fptr function pointer to function to be called on interrupt
* @param arg pointer to an object that will be supplied as an
* arguement to the ISR.
*/
void installISR(void (*isr)(void *), void *arg);
/**
* Uninstall the previously installed Interrupt Service Routine (ISR)
*
*/
void uninstallISR();
private:
bool m_isrInstalled;
mraa_gpio_context m_gpio;
};
}