bmg160: use MRAA::Edge for interrupt edge specification

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson 2017-03-24 15:03:37 -06:00
parent 22a6c52795
commit 3c5a5b87c8
2 changed files with 14 additions and 12 deletions

View File

@ -279,10 +279,11 @@ uint8_t BMG160::getInterruptStatus3()
} }
void BMG160::installISR(BMG160_INTERRUPT_PINS_T intr, int gpio, void BMG160::installISR(BMG160_INTERRUPT_PINS_T intr, int gpio,
mraa_gpio_edge_t level, mraa::Edge level,
void (*isr)(void *), void *arg) void (*isr)(void *), void *arg)
{ {
if (bmg160_install_isr(m_bmg160, intr, gpio, level, isr, arg)) if (bmg160_install_isr(m_bmg160, intr, gpio,
(mraa_gpio_edge_t)level, isr, arg))
throw std::runtime_error(string(__FUNCTION__) throw std::runtime_error(string(__FUNCTION__)
+ ": bmg160_install_isr() failed"); + ": bmg160_install_isr() failed");
} }

View File

@ -28,12 +28,13 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <mraa/gpio.hpp>
#include "bmg160.h" #include "bmg160.h"
namespace upm { namespace upm {
/** /**
* @library bmx050 * @library bmg160
* @sensor bmg160 * @sensor bmg160
* @comname 3-axis Gyroscope Sensor * @comname 3-axis Gyroscope Sensor
* @type gyro * @type gyro
@ -410,7 +411,7 @@ namespace upm {
#if defined(SWIGJAVA) || defined(JAVACALLBACK) #if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(BMG160_INTERRUPT_PINS_T intr, int gpio, void installISR(BMG160_INTERRUPT_PINS_T intr, int gpio,
mraa_gpio_edge_t level, jobject runnable) mraa::Edge level, jobject runnable)
{ {
installISR(intr, gpio, level, mraa_java_isr_callback, runnable); installISR(intr, gpio, level, mraa_java_isr_callback, runnable);
} }
@ -418,19 +419,19 @@ namespace upm {
/** /**
* install an interrupt handler. * install an interrupt handler.
* *
* @param intr one of the BMG160_INTERRUPT_PINS_T values * @param intr One of the BMG160_INTERRUPT_PINS_T values
* specifying which interrupt pin you are installing. * specifying which interrupt pin you are installing.
* @param gpio gpio pin to use as interrupt pin * @param gpio GPIO pin to use as interrupt pin.
* @param level the interrupt trigger level (one of the * @param level The interrupt trigger level (one of the
* mraa_gpio_edge_t values). Make sure that you have * mraa::Edge values). Make sure that you have
* configured the interrupt pin properly for whatever level * configured the interrupt pin properly for whatever level
* you choose. * you choose.
* @param isr the interrupt handler, accepting a void * argument * @param isr The interrupt handler, accepting a void * argument.
* @param arg the argument to pass the the interrupt handler * @param arg The argument to pass the the interrupt handler.
* @throws std::runtime_error on failure. * @throws std::runtime_error on failure.
*/ */
void installISR(BMG160_INTERRUPT_PINS_T intr, int gpio, void installISR(BMG160_INTERRUPT_PINS_T intr, int gpio,
mraa_gpio_edge_t level, mraa::Edge level,
void (*isr)(void *), void *arg); void (*isr)(void *), void *arg);
#endif #endif
@ -476,7 +477,7 @@ namespace upm {
// needs to be private for SWIG Java builds // needs to be private for SWIG Java builds
#if defined(SWIGJAVA) || defined(JAVACALLBACK) #if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(BMG160_INTERRUPT_PINS_T intr, int gpio, void installISR(BMG160_INTERRUPT_PINS_T intr, int gpio,
mraa_gpio_edge_t level, mraa::Edge level,
void (*isr)(void *), void *arg); void (*isr)(void *), void *arg);
#endif #endif
}; };