2016-01-02 03:02:34 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2014-01-06 09:27:51 -05:00
|
|
|
#include <assert.h>
|
2016-05-20 17:30:37 -07:00
|
|
|
#include <jni.h>
|
2016-07-14 00:17:29 -07:00
|
|
|
#include "HAL/cpp/Log.h"
|
2014-01-06 09:27:51 -05:00
|
|
|
|
|
|
|
|
#include "edu_wpi_first_wpilibj_hal_JNIWrapper.h"
|
|
|
|
|
|
2016-05-22 21:41:22 -07:00
|
|
|
#include "HAL/HAL.h"
|
2014-01-06 09:27:51 -05:00
|
|
|
|
2015-11-01 09:11:52 -08:00
|
|
|
extern "C" {
|
|
|
|
|
|
2014-01-06 09:27:51 -05:00
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_JNIWrapper
|
|
|
|
|
* Method: getPortWithModule
|
2016-06-05 15:23:58 -07:00
|
|
|
* Signature: (BB)I
|
2014-01-06 09:27:51 -05:00
|
|
|
*/
|
2016-06-05 15:23:58 -07:00
|
|
|
JNIEXPORT jint JNICALL
|
2016-05-20 17:30:37 -07:00
|
|
|
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;
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_PortHandle port = HAL_GetPortWithModule(module, pin);
|
2016-06-05 15:23:58 -07:00
|
|
|
// FILE_LOG(logDEBUG) << "Port Handle = " << port;
|
|
|
|
|
return (jint)port;
|
2014-01-06 09:27:51 -05:00
|
|
|
}
|
|
|
|
|
|
2014-07-22 13:31:36 -04:00
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_JNIWrapper
|
|
|
|
|
* Method: getPort
|
2016-06-05 15:23:58 -07:00
|
|
|
* Signature: (B)I
|
2014-07-22 13:31:36 -04:00
|
|
|
*/
|
2016-06-05 15:23:58 -07:00
|
|
|
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_JNIWrapper_getPort(
|
2016-05-20 17:30:37 -07:00
|
|
|
JNIEnv* env, jclass, jbyte pin) {
|
|
|
|
|
// FILE_LOG(logDEBUG) << "Calling JNIWrapper getPortWithModlue";
|
|
|
|
|
// FILE_LOG(logDEBUG) << "Module = " << (jint)module;
|
|
|
|
|
// FILE_LOG(logDEBUG) << "Pin = " << (jint)pin;
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_PortHandle port = HAL_GetPort(pin);
|
2016-06-05 15:23:58 -07:00
|
|
|
// FILE_LOG(logDEBUG) << "Port Handle = " << port;
|
|
|
|
|
return (jint)port;
|
2014-07-22 13:31:36 -04:00
|
|
|
}
|
2015-11-01 09:11:52 -08:00
|
|
|
} // extern "C"
|