aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Robertson <jj.robertson@asu.edu>2015-11-19 22:57:45 -0700
committerMihai Tudor Panu <mihai.tudor.panu@intel.com>2015-11-25 11:45:20 -0800
commit287250b32dc18c781e45c103b0b4e3e5917d6c2e (patch)
treec89f55918ee7cbd783cc45824a208a69dfe7fe47
parent758b49f51d63ab13c7088dbca4fef855dea692ec (diff)
hcsr04: Pass reference to current object to ISR.
This will allow users to call ackEdgeDetected() on the object passed into the function pointer, instead of requiring them to have a global reference to the object. Signed-off-by: JJ Robertson <jjrob13@gmail.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-rw-r--r--src/hcsr04/hcsr04.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hcsr04/hcsr04.cxx b/src/hcsr04/hcsr04.cxx
index b89ee0b..f30e9d8 100644
--- a/src/hcsr04/hcsr04.cxx
+++ b/src/hcsr04/hcsr04.cxx
@@ -63,7 +63,7 @@ HCSR04::HCSR04 (uint8_t triggerPin, uint8_t echoPin, void (*fptr)(void *)) {
}
mraa_gpio_dir(m_echoPinCtx, MRAA_GPIO_IN);
- mraa_gpio_isr(m_echoPinCtx, MRAA_GPIO_EDGE_BOTH, fptr, NULL);
+ mraa_gpio_isr(m_echoPinCtx, MRAA_GPIO_EDGE_BOTH, fptr, (void*)this);
}
HCSR04::~HCSR04 () {