Private
Public Access
2
0

gpio: Added args param to maa_gpio_isr and added documentation

Signed-off-by: Kiveisha Yevgeniy <yevgeniy.kiveisha@intel.com>
This commit is contained in:
Kiveisha Yevgeniy
2014-06-19 16:23:43 +00:00
parent 93acdf3789
commit 6fbe2a7e53
5 changed files with 38 additions and 16 deletions

View File

@@ -115,9 +115,10 @@ maa_result_t maa_gpio_edge_mode(maa_gpio_context dev, gpio_edge_t mode);
* @param edge The edge mode to set the gpio into
* @param fptr Function pointer to function to be called when interupt is
* triggered
* @param args Arguments passed to the interrupt handler (fptr)
* @return Result of operation
*/
maa_result_t maa_gpio_isr(maa_gpio_context dev, gpio_edge_t edge, void (*fptr)(void));
maa_result_t maa_gpio_isr(maa_gpio_context dev, gpio_edge_t edge, void (*fptr)(void *), void * args);
/**
* Stop the current interupt watcher on this Gpio, and set the Gpio edge mode

View File

@@ -104,17 +104,21 @@ class Gpio {
return maa_gpio_edge_mode(m_gpio, (gpio_edge_t) mode);
}
#if defined(SWIGPYTHON)
maa_result_t isr(Edge mode, PyObject *pyfunc) {
return maa_gpio_isr(m_gpio, (gpio_edge_t) mode, (void (*) ()) pyfunc);
maa_result_t isr(Edge mode, PyObject *pyfunc, PyObject* args) {
return maa_gpio_isr(m_gpio, (gpio_edge_t) mode, (void (*) (void *)) pyfunc, (void *) args);
}
#else
/**
* Sets a callback to be called when pin value changes
*
* @param mode The edge mode to set
* @param fptr Function pointer to function to be called when interupt is
* triggered
* @param args Arguments passed to the interrupt handler (fptr)
* @return Result of operation
*/
maa_result_t isr(Edge mode, void (*fptr)(void)) {
return maa_gpio_isr(m_gpio, (gpio_edge_t) mode, fptr);
maa_result_t isr(Edge mode, void (*fptr)(void *), void * args) {
return maa_gpio_isr(m_gpio, (gpio_edge_t) mode, fptr, args);
}
#endif
/**