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>
This commit is contained in:
John Robertson 2015-11-19 22:57:45 -07:00 committed by Mihai Tudor Panu
parent 758b49f51d
commit 287250b32d

View File

@ -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 () {