2016-07-08 00:08:07 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-05-13 17:09:56 -07:00
|
|
|
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
|
2016-07-08 00:08:07 -07:00
|
|
|
/* 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. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
2018-05-13 17:09:56 -07:00
|
|
|
#include <cassert>
|
2016-07-08 00:08:07 -07:00
|
|
|
|
|
|
|
|
#include "HALUtil.h"
|
2018-05-13 17:09:56 -07:00
|
|
|
#include "edu_wpi_first_wpilibj_hal_ConstantsJNI.h"
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "hal/Constants.h"
|
|
|
|
|
#include "hal/cpp/Log.h"
|
2016-07-08 00:08:07 -07:00
|
|
|
|
2016-10-31 23:04:49 -07:00
|
|
|
using namespace frc;
|
|
|
|
|
|
2016-07-08 00:08:07 -07:00
|
|
|
// set the logging level
|
|
|
|
|
TLogLevel constantsJNILogLevel = logWARNING;
|
|
|
|
|
|
|
|
|
|
#define CONSTANTSJNI_LOG(level) \
|
|
|
|
|
if (level > constantsJNILogLevel) \
|
2018-05-13 17:09:56 -07:00
|
|
|
; \
|
|
|
|
|
else \
|
|
|
|
|
Log().Get(level)
|
2016-07-08 00:08:07 -07:00
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
/*
|
|
|
|
|
* Class: edu_wpi_first_wpilibj_hal_ConstantsJNI
|
|
|
|
|
* Method: getSystemClockTicksPerMicrosecond
|
|
|
|
|
* Signature: ()I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
2018-05-13 17:09:56 -07:00
|
|
|
Java_edu_wpi_first_wpilibj_hal_ConstantsJNI_getSystemClockTicksPerMicrosecond
|
|
|
|
|
(JNIEnv* env, jclass)
|
|
|
|
|
{
|
|
|
|
|
CONSTANTSJNI_LOG(logDEBUG)
|
|
|
|
|
<< "Calling ConstantsJNI getSystemClockTicksPerMicrosecond";
|
2016-07-09 00:24:26 -07:00
|
|
|
jint value = HAL_GetSystemClockTicksPerMicrosecond();
|
2016-07-08 00:08:07 -07:00
|
|
|
CONSTANTSJNI_LOG(logDEBUG) << "Value = " << value;
|
|
|
|
|
return value;
|
|
|
|
|
}
|
2018-05-13 17:09:56 -07:00
|
|
|
} // extern "C"
|