mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
JNI implementation for Java
Normal vs
This commit is contained in:
25
wpilibj/wpilibJavaJNI/src/main/native/JNIWrapper.cpp
Normal file
25
wpilibj/wpilibJavaJNI/src/main/native/JNIWrapper.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <jni.h>
|
||||
#include <assert.h>
|
||||
#include "log.h"
|
||||
|
||||
#include "edu_wpi_first_wpilibj_hal_JNIWrapper.h"
|
||||
|
||||
#include "HAL/HAL.h"
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_JNIWrapper
|
||||
* Method: getPortWithModule
|
||||
* Signature: (BB)Ljava/nio/ByteBuffer;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_JNIWrapper_getPortWithModule
|
||||
(JNIEnv * env, jclass, jbyte module, jbyte pin)
|
||||
{
|
||||
//FILE_LOG(logDEBUG) << "Calling JNIWrapper getPortWithModlue";
|
||||
//FILE_LOG(logDEBUG) << "Module = " << (jint)module;
|
||||
//FILE_LOG(logDEBUG) << "Pin = " << (jint)pin;
|
||||
void** portPtr = (void**)new unsigned char[4];
|
||||
*portPtr = getPortWithModule(module,pin);
|
||||
//FILE_LOG(logDEBUG) << "Port Ptr = " << *portPtr;
|
||||
return env->NewDirectByteBuffer( portPtr, 4);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user