2014-01-06 09:27:51 -05:00
|
|
|
#include <jni.h>
|
|
|
|
|
#include <assert.h>
|
2015-12-17 16:19:44 -08:00
|
|
|
#include <atomic>
|
|
|
|
|
#include <condition_variable>
|
|
|
|
|
#include <mutex>
|
|
|
|
|
#include <thread>
|
2014-05-02 17:54:01 -04:00
|
|
|
#include "Log.hpp"
|
2014-01-06 09:27:51 -05:00
|
|
|
|
|
|
|
|
#include "edu_wpi_first_wpilibj_hal_InterruptJNI.h"
|
2014-08-04 14:19:01 -04:00
|
|
|
#include "HAL/Interrupts.hpp"
|
2015-11-01 09:11:52 -08:00
|
|
|
#include "HALUtil.h"
|
2015-12-17 16:19:44 -08:00
|
|
|
#include "SafeThread.h"
|
2014-08-04 14:19:01 -04:00
|
|
|
|
|
|
|
|
TLogLevel interruptJNILogLevel = logERROR;
|
|
|
|
|
|
|
|
|
|
#define INTERRUPTJNI_LOG(level) \
|
2014-10-05 17:17:59 -04:00
|
|
|
if (level > interruptJNILogLevel) ; \
|
|
|
|
|
else Log().Get(level)
|
2014-08-04 14:19:01 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
// Thread where callbacks are actually performed.
|
|
|
|
|
//
|
|
|
|
|
// JNI's AttachCurrentThread() creates a Java Thread object on every
|
|
|
|
|
// invocation, which is both time inefficient and causes issues with Eclipse
|
|
|
|
|
// (which tries to keep a thread list up-to-date and thus gets swamped).
|
|
|
|
|
//
|
|
|
|
|
// Instead, this class attaches just once. When a hardware notification
|
|
|
|
|
// occurs, a condition variable wakes up this thread and this thread actually
|
|
|
|
|
// makes the call into Java.
|
|
|
|
|
//
|
|
|
|
|
// We don't want to use a FIFO here. If the user code takes too long to
|
|
|
|
|
// process, we will just ignore the redundant wakeup.
|
|
|
|
|
class InterruptThreadJNI : public SafeThread {
|
|
|
|
|
public:
|
|
|
|
|
void Main();
|
|
|
|
|
|
|
|
|
|
bool m_notify = false;
|
|
|
|
|
uint32_t m_mask = 0;
|
|
|
|
|
jobject m_func = nullptr;
|
|
|
|
|
jmethodID m_mid;
|
|
|
|
|
jobject m_param = nullptr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class InterruptJNI : public SafeThreadOwner<InterruptThreadJNI> {
|
|
|
|
|
public:
|
|
|
|
|
void SetFunc(JNIEnv* env, jobject func, jmethodID mid, jobject param);
|
|
|
|
|
|
|
|
|
|
void Notify(uint32_t mask) {
|
|
|
|
|
auto thr = GetThread();
|
|
|
|
|
if (!thr) return;
|
|
|
|
|
thr->m_notify = true;
|
|
|
|
|
thr->m_mask = mask;
|
|
|
|
|
thr->m_cond.notify_one();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void InterruptJNI::SetFunc(JNIEnv* env, jobject func, jmethodID mid,
|
|
|
|
|
jobject param) {
|
|
|
|
|
auto thr = GetThread();
|
|
|
|
|
if (!thr) return;
|
|
|
|
|
// free global references
|
|
|
|
|
if (thr->m_func) env->DeleteGlobalRef(thr->m_func);
|
|
|
|
|
if (thr->m_param) env->DeleteGlobalRef(thr->m_param);
|
|
|
|
|
// create global references
|
|
|
|
|
thr->m_func = env->NewGlobalRef(func);
|
|
|
|
|
thr->m_param = param ? env->NewGlobalRef(param) : nullptr;
|
|
|
|
|
thr->m_mid = mid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void InterruptThreadJNI::Main() {
|
|
|
|
|
JNIEnv *env;
|
|
|
|
|
JavaVMAttachArgs args;
|
|
|
|
|
args.version = JNI_VERSION_1_2;
|
|
|
|
|
args.name = const_cast<char*>("Interrupt");
|
|
|
|
|
args.group = nullptr;
|
|
|
|
|
jint rs = jvm->AttachCurrentThreadAsDaemon((void**)&env, &args);
|
|
|
|
|
if (rs != JNI_OK) return;
|
|
|
|
|
|
|
|
|
|
std::unique_lock<std::mutex> lock(m_mutex);
|
|
|
|
|
while (m_active) {
|
|
|
|
|
m_cond.wait(lock, [&] { return !m_active || m_notify; });
|
|
|
|
|
if (!m_active) break;
|
|
|
|
|
m_notify = false;
|
|
|
|
|
if (!m_func) continue;
|
|
|
|
|
jobject func = m_func;
|
|
|
|
|
jmethodID mid = m_mid;
|
|
|
|
|
uint32_t mask = m_mask;
|
|
|
|
|
jobject param = m_param;
|
|
|
|
|
lock.unlock(); // don't hold mutex during callback execution
|
|
|
|
|
env->CallVoidMethod(func, mid, (jint)mask, param);
|
|
|
|
|
if (env->ExceptionCheck()) {
|
|
|
|
|
env->ExceptionDescribe();
|
|
|
|
|
env->ExceptionClear();
|
|
|
|
|
}
|
|
|
|
|
lock.lock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// free global references
|
|
|
|
|
if (m_func) env->DeleteGlobalRef(m_func);
|
|
|
|
|
if (m_param) env->DeleteGlobalRef(m_param);
|
|
|
|
|
|
|
|
|
|
jvm->DetachCurrentThread();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void interruptHandler(uint32_t mask, void* param) {
|
|
|
|
|
((InterruptJNI*)param)->Notify(mask);
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-01 09:11:52 -08:00
|
|
|
extern "C" {
|
2014-01-06 09:27:51 -05:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
|
|
|
|
|
* Method: initializeInterrupts
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (IZ)J
|
2014-01-06 09:27:51 -05:00
|
|
|
*/
|
2015-11-01 09:11:52 -08:00
|
|
|
JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_initializeInterrupts
|
|
|
|
|
(JNIEnv * env, jclass, jint interruptIndex, jboolean watcher)
|
2014-01-06 09:27:51 -05:00
|
|
|
{
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI initializeInterrupts";
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "interruptIndex = " << interruptIndex;
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "watcher = " << (bool)watcher;
|
2014-01-06 09:27:51 -05:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
void* interrupt = initializeInterrupts(interruptIndex, watcher, &status);
|
2014-08-04 14:19:01 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << interrupt;
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
2014-08-04 14:19:01 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return (jlong)interrupt;
|
2014-01-06 09:27:51 -05:00
|
|
|
}
|
|
|
|
|
|
2014-08-04 14:19:01 -04:00
|
|
|
|
2014-01-06 09:27:51 -05:00
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
|
|
|
|
|
* Method: cleanInterrupts
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)V
|
2014-01-06 09:27:51 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_cleanInterrupts
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv * env, jclass, jlong interrupt_pointer)
|
2014-01-06 09:27:51 -05:00
|
|
|
{
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI cleanInterrupts";
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << (void*)interrupt_pointer;
|
2015-11-01 09:11:52 -08:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
cleanInterrupts((void*)interrupt_pointer, &status);
|
2014-01-06 09:27:51 -05:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
2014-08-04 14:19:01 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
CheckStatus(env, status);
|
2014-01-06 09:27:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
|
|
|
|
|
* Method: waitForInterrupt
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (JD)V
|
2014-01-06 09:27:51 -05:00
|
|
|
*/
|
2014-10-05 17:17:59 -04:00
|
|
|
JNIEXPORT int JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv * env, jclass, jlong interrupt_pointer, jdouble timeout, jboolean ignorePrevious)
|
2014-01-06 09:27:51 -05:00
|
|
|
{
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI waitForInterrupt";
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << (void*)interrupt_pointer;
|
2014-08-04 14:19:01 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
int result = waitForInterrupt((void*)interrupt_pointer, timeout,
|
|
|
|
|
ignorePrevious, &status);
|
2014-01-06 09:27:51 -05:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
2014-10-05 17:17:59 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return result;
|
2014-01-06 09:27:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
|
|
|
|
|
* Method: enableInterrupts
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)V
|
2014-01-06 09:27:51 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_enableInterrupts
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv * env, jclass, jlong interrupt_pointer)
|
2014-01-06 09:27:51 -05:00
|
|
|
{
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI enableInterrupts";
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << (void*)interrupt_pointer;
|
2014-01-06 09:27:51 -05:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
enableInterrupts((void*)interrupt_pointer, &status);
|
2014-08-04 14:19:01 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
2015-11-01 09:11:52 -08:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
CheckStatus(env, status);
|
2014-01-06 09:27:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
|
|
|
|
|
* Method: disableInterrupts
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)V
|
2014-01-06 09:27:51 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_disableInterrupts
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv * env, jclass, jlong interrupt_pointer)
|
2014-01-06 09:27:51 -05:00
|
|
|
{
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI disableInterrupts";
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << (void*)interrupt_pointer;
|
2015-11-01 09:11:52 -08:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
disableInterrupts((void*)interrupt_pointer, &status);
|
2014-08-04 14:19:01 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
2014-01-06 09:27:51 -05:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
CheckStatus(env, status);
|
2014-01-06 09:27:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
|
2014-10-05 17:17:59 -04:00
|
|
|
* Method: readRisingTimestamp
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)D
|
2014-10-05 17:17:59 -04:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readRisingTimestamp
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv * env, jclass, jlong interrupt_pointer)
|
2014-10-05 17:17:59 -04:00
|
|
|
{
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI readRisingTimestamp";
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << (void*)interrupt_pointer;
|
2014-10-05 17:17:59 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
jdouble timeStamp = readRisingTimestamp((void*)interrupt_pointer, &status);
|
2014-10-05 17:17:59 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return timeStamp;
|
2014-10-05 17:17:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
|
|
|
|
|
* Method: readFallingTimestamp
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (J)D
|
2014-01-06 09:27:51 -05:00
|
|
|
*/
|
2014-10-05 17:17:59 -04:00
|
|
|
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readFallingTimestamp
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv * env, jclass, jlong interrupt_pointer)
|
2014-01-06 09:27:51 -05:00
|
|
|
{
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI readFallingTimestamp";
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << (void*)interrupt_pointer;
|
2014-08-04 14:19:01 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
jdouble timeStamp = readFallingTimestamp((void*)interrupt_pointer, &status);
|
2014-01-06 09:27:51 -05:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
|
|
|
|
CheckStatus(env, status);
|
|
|
|
|
return timeStamp;
|
2014-01-06 09:27:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
|
|
|
|
|
* Method: requestInterrupts
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (JBIZ)V
|
2014-01-06 09:27:51 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_requestInterrupts
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv * env, jclass, jlong interrupt_pointer, jbyte routing_module, jint routing_pin, jboolean routing_analog_trigger)
|
2014-01-06 09:27:51 -05:00
|
|
|
{
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI requestInterrupts";
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << (void*)interrupt_pointer;
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "routing module = " << (jint)routing_module;
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "routing pin = " << routing_pin;
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "routing analog trigger = " << (jint)routing_analog_trigger;
|
|
|
|
|
|
|
|
|
|
int32_t status = 0;
|
|
|
|
|
requestInterrupts((void*)interrupt_pointer, (uint8_t)routing_module,
|
|
|
|
|
(uint32_t)routing_pin, routing_analog_trigger, &status);
|
|
|
|
|
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
|
|
|
|
CheckStatus(env, status);
|
2014-01-06 09:27:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
|
|
|
|
|
* Method: attachInterruptHandler
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (JLedu/wpi/first/wpilibj/hal/InterruptJNI/InterruptHandlerFunction;Ljava/nio/ByteBuffer;)V
|
2014-01-06 09:27:51 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_attachInterruptHandler
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv * env, jclass, jlong interrupt_pointer, jobject handler, jobject param)
|
2014-01-06 09:27:51 -05:00
|
|
|
{
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI attachInterruptHandler";
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << (void*)interrupt_pointer;
|
|
|
|
|
|
|
|
|
|
jclass cls = env->GetObjectClass(handler);
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "class = " << cls;
|
|
|
|
|
if (cls == 0) {
|
|
|
|
|
INTERRUPTJNI_LOG(logERROR) << "Error getting java class";
|
|
|
|
|
assert(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
jmethodID mid = env->GetMethodID(cls, "apply", "(ILjava/lang/Object;)V");
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "method = " << mid;
|
|
|
|
|
if (mid == 0) {
|
|
|
|
|
INTERRUPTJNI_LOG(logERROR) << "Error getting java method ID";
|
|
|
|
|
assert(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InterruptJNI* intr = new InterruptJNI;
|
|
|
|
|
intr->Start();
|
|
|
|
|
intr->SetFunc(env, handler, mid, param);
|
|
|
|
|
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "InterruptThreadJNI Ptr = " << intr;
|
|
|
|
|
|
|
|
|
|
int32_t status = 0;
|
|
|
|
|
attachInterruptHandler((void*)interrupt_pointer, interruptHandler, intr,
|
|
|
|
|
&status);
|
|
|
|
|
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
|
|
|
|
CheckStatus(env, status);
|
2014-01-06 09:27:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
|
|
|
|
|
* Method: setInterruptUpSourceEdge
|
2015-11-01 09:11:52 -08:00
|
|
|
* Signature: (JZZ)V
|
2014-01-06 09:27:51 -05:00
|
|
|
*/
|
|
|
|
|
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_setInterruptUpSourceEdge
|
2015-11-01 09:11:52 -08:00
|
|
|
(JNIEnv * env, jclass, jlong interrupt_pointer, jboolean risingEdge, jboolean fallingEdge)
|
2014-01-06 09:27:51 -05:00
|
|
|
{
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI setInterruptUpSourceEdge";
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << (void*)interrupt_pointer;
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Rising Edge = " << (bool)risingEdge;
|
|
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Falling Edge = " << (bool)fallingEdge;
|
2014-08-04 14:19:01 -04:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
int32_t status = 0;
|
|
|
|
|
setInterruptUpSourceEdge((void*)interrupt_pointer, risingEdge, fallingEdge,
|
|
|
|
|
&status);
|
2014-01-06 09:27:51 -05:00
|
|
|
|
2015-12-17 16:19:44 -08:00
|
|
|
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
|
|
|
|
CheckStatus(env, status);
|
2014-01-06 09:27:51 -05:00
|
|
|
}
|
2015-11-01 09:11:52 -08:00
|
|
|
|
|
|
|
|
} // extern "C"
|