Add format script which invokes clang-format on the C++ source code (#41)

On Windows machines, clang-format.exe must be in the PATH environment variable.
This commit is contained in:
Tyler Veness
2016-05-20 17:30:37 -07:00
committed by Peter Johnson
parent 68690643d2
commit e14e45da76
383 changed files with 13787 additions and 13198 deletions

View File

@@ -5,8 +5,8 @@
/* the project. */
/*----------------------------------------------------------------------------*/
#include <jni.h>
#include <assert.h>
#include <jni.h>
#include "Log.hpp"
#include "edu_wpi_first_wpilibj_hal_SPIJNI.h"
@@ -17,9 +17,11 @@
// set the logging level
TLogLevel spiJNILogLevel = logWARNING;
#define SPIJNI_LOG(level) \
if (level > spiJNILogLevel) ; \
else Log().Get(level)
#define SPIJNI_LOG(level) \
if (level > spiJNILogLevel) \
; \
else \
Log().Get(level)
extern "C" {
@@ -28,15 +30,14 @@ extern "C" {
* Method: spiInitialize
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize
(JNIEnv * env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitialize";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
spiInitialize(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize(
JNIEnv *env, jclass, jbyte port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitialize";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
spiInitialize(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
/*
@@ -44,22 +45,23 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize
* Method: spiTransaction
* Signature: (BLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction
(JNIEnv * env, jclass, jbyte port, jobject dataToSend, jobject dataReceived, jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiTransaction";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
uint8_t* dataToSendPtr = nullptr;
if (dataToSend != 0) {
dataToSendPtr = (uint8_t*)env->GetDirectBufferAddress(dataToSend);
}
uint8_t* dataReceivedPtr = (uint8_t*)env->GetDirectBufferAddress(dataReceived);
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
jint retVal = spiTransaction(port, dataToSendPtr, dataReceivedPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction(
JNIEnv *env, jclass, jbyte port, jobject dataToSend, jobject dataReceived,
jbyte size) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiTransaction";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
uint8_t *dataToSendPtr = nullptr;
if (dataToSend != 0) {
dataToSendPtr = (uint8_t *)env->GetDirectBufferAddress(dataToSend);
}
uint8_t *dataReceivedPtr =
(uint8_t *)env->GetDirectBufferAddress(dataReceived);
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
jint retVal = spiTransaction(port, dataToSendPtr, dataReceivedPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
}
/*
@@ -67,53 +69,49 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction
* Method: spiWrite
* Signature: (BLjava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite
(JNIEnv * env, jclass, jbyte port, jobject dataToSend, jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiWrite";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
uint8_t* dataToSendPtr = nullptr;
if (dataToSend != 0) {
dataToSendPtr = (uint8_t*)env->GetDirectBufferAddress(dataToSend);
}
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
jint retVal = spiWrite(port, dataToSendPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite(
JNIEnv *env, jclass, jbyte port, jobject dataToSend, jbyte size) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiWrite";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
uint8_t *dataToSendPtr = nullptr;
if (dataToSend != 0) {
dataToSendPtr = (uint8_t *)env->GetDirectBufferAddress(dataToSend);
}
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
jint retVal = spiWrite(port, dataToSendPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiRead
* Signature: (BLjava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead
(JNIEnv * env, jclass, jbyte port, jobject dataReceived, jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiRead";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
uint8_t* dataReceivedPtr = (uint8_t*)env->GetDirectBufferAddress(dataReceived);
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
jint retVal = spiRead(port, (uint8_t*)dataReceivedPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead(
JNIEnv *env, jclass, jbyte port, jobject dataReceived, jbyte size) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiRead";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
uint8_t *dataReceivedPtr =
(uint8_t *)env->GetDirectBufferAddress(dataReceived);
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
jint retVal = spiRead(port, (uint8_t *)dataReceivedPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiClose
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose
(JNIEnv *, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiClose";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
spiClose(port);
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose(JNIEnv *, jclass, jbyte port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiClose";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
spiClose(port);
}
/*
@@ -121,13 +119,12 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose
* Method: spiSetSpeed
* Signature: (BI)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed
(JNIEnv *, jclass, jbyte port, jint speed)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetSpeed";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
SPIJNI_LOG(logDEBUG) << "Speed = " << (jint) speed;
spiSetSpeed(port, speed);
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed(
JNIEnv *, jclass, jbyte port, jint speed) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetSpeed";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Speed = " << (jint)speed;
spiSetSpeed(port, speed);
}
/*
@@ -135,15 +132,15 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed
* Method: spiSetOpts
* Signature: (BIII)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts
(JNIEnv *, jclass, jbyte port, jint msb_first, jint sample_on_trailing, jint clk_idle_high)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetOpts";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
SPIJNI_LOG(logDEBUG) << "msb_first = " << msb_first;
SPIJNI_LOG(logDEBUG) << "sample_on_trailing = " << sample_on_trailing;
SPIJNI_LOG(logDEBUG) << "clk_idle_high = " << clk_idle_high;
spiSetOpts(port, msb_first, sample_on_trailing, clk_idle_high);
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts(
JNIEnv *, jclass, jbyte port, jint msb_first, jint sample_on_trailing,
jint clk_idle_high) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetOpts";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "msb_first = " << msb_first;
SPIJNI_LOG(logDEBUG) << "sample_on_trailing = " << sample_on_trailing;
SPIJNI_LOG(logDEBUG) << "clk_idle_high = " << clk_idle_high;
spiSetOpts(port, msb_first, sample_on_trailing, clk_idle_high);
}
/*
@@ -151,15 +148,15 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts
* Method: spiSetChipSelectActiveHigh
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh
(JNIEnv * env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveHigh";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
spiSetChipSelectActiveHigh(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh(
JNIEnv *env, jclass, jbyte port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveHigh";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
spiSetChipSelectActiveHigh(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
/*
@@ -167,15 +164,15 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectAct
* Method: spiSetChipSelectActiveLow
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow
(JNIEnv * env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveLow";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
spiSetChipSelectActiveLow(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow(
JNIEnv *env, jclass, jbyte port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveLow";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
spiSetChipSelectActiveLow(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
/*
@@ -183,25 +180,26 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectAct
* Method: spiInitAccumulator
* Signature: (BIIBIIBBZZ)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAccumulator
(JNIEnv *env, jclass, jbyte port, jint period, jint cmd, jbyte xferSize, jint validMask, jint validValue, jbyte dataShift, jbyte dataSize, jboolean isSigned, jboolean bigEndian)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitAccumulator";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
SPIJNI_LOG(logDEBUG) << "Period = " << period;
SPIJNI_LOG(logDEBUG) << "Cmd = " << cmd;
SPIJNI_LOG(logDEBUG) << "XferSize = " << (jint) xferSize;
SPIJNI_LOG(logDEBUG) << "ValidMask = " << validMask;
SPIJNI_LOG(logDEBUG) << "ValidValue = " << validValue;
SPIJNI_LOG(logDEBUG) << "DataShift = " << (jint) dataShift;
SPIJNI_LOG(logDEBUG) << "DataSize = " << (jint) dataSize;
SPIJNI_LOG(logDEBUG) << "IsSigned = " << (jint) isSigned;
SPIJNI_LOG(logDEBUG) << "BigEndian = " << (jint) bigEndian;
int32_t status = 0;
spiInitAccumulator(port, period, cmd, xferSize, validMask, validValue,
dataShift, dataSize, isSigned, bigEndian, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAccumulator(
JNIEnv *env, jclass, jbyte port, jint period, jint cmd, jbyte xferSize,
jint validMask, jint validValue, jbyte dataShift, jbyte dataSize,
jboolean isSigned, jboolean bigEndian) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitAccumulator";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Period = " << period;
SPIJNI_LOG(logDEBUG) << "Cmd = " << cmd;
SPIJNI_LOG(logDEBUG) << "XferSize = " << (jint)xferSize;
SPIJNI_LOG(logDEBUG) << "ValidMask = " << validMask;
SPIJNI_LOG(logDEBUG) << "ValidValue = " << validValue;
SPIJNI_LOG(logDEBUG) << "DataShift = " << (jint)dataShift;
SPIJNI_LOG(logDEBUG) << "DataSize = " << (jint)dataSize;
SPIJNI_LOG(logDEBUG) << "IsSigned = " << (jint)isSigned;
SPIJNI_LOG(logDEBUG) << "BigEndian = " << (jint)bigEndian;
int32_t status = 0;
spiInitAccumulator(port, period, cmd, xferSize, validMask, validValue,
dataShift, dataSize, isSigned, bigEndian, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
/*
@@ -209,15 +207,14 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAccumulator
* Method: spiFreeAccumulator
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAccumulator
(JNIEnv *env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiFreeAccumulator";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
spiFreeAccumulator(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAccumulator(
JNIEnv *env, jclass, jbyte port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiFreeAccumulator";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
spiFreeAccumulator(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
/*
@@ -225,15 +222,15 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAccumulator
* Method: spiResetAccumulator
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiResetAccumulator
(JNIEnv *env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiResetAccumulator";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
spiResetAccumulator(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiResetAccumulator(
JNIEnv *env, jclass, jbyte port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiResetAccumulator";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
spiResetAccumulator(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
/*
@@ -241,16 +238,16 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiResetAccumulator
* Method: spiSetAccumulatorCenter
* Signature: (BI)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAccumulatorCenter
(JNIEnv *env, jclass, jbyte port, jint center)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetAccumulatorCenter";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
SPIJNI_LOG(logDEBUG) << "Center = " << center;
int32_t status = 0;
spiSetAccumulatorCenter(port, center, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAccumulatorCenter(
JNIEnv *env, jclass, jbyte port, jint center) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetAccumulatorCenter";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Center = " << center;
int32_t status = 0;
spiSetAccumulatorCenter(port, center, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
/*
@@ -258,16 +255,16 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAccumulatorCe
* Method: spiSetAccumulatorDeadband
* Signature: (BI)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAccumulatorDeadband
(JNIEnv *env, jclass, jbyte port, jint deadband)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetAccumulatorDeadband";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
SPIJNI_LOG(logDEBUG) << "Deadband = " << deadband;
int32_t status = 0;
spiSetAccumulatorDeadband(port, deadband, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAccumulatorDeadband(
JNIEnv *env, jclass, jbyte port, jint deadband) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetAccumulatorDeadband";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Deadband = " << deadband;
int32_t status = 0;
spiSetAccumulatorDeadband(port, deadband, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
/*
@@ -275,17 +272,17 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAccumulatorDe
* Method: spiGetAccumulatorLastValue
* Signature: (B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorLastValue
(JNIEnv *env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorLastValue";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
jint retVal = spiGetAccumulatorLastValue(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
return retVal;
JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorLastValue(
JNIEnv *env, jclass, jbyte port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorLastValue";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
jint retVal = spiGetAccumulatorLastValue(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
return retVal;
}
/*
@@ -293,17 +290,17 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorLa
* Method: spiGetAccumulatorValue
* Signature: (B)J
*/
JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorValue
(JNIEnv *env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorValue";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
jlong retVal = spiGetAccumulatorValue(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
return retVal;
JNIEXPORT jlong JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorValue(
JNIEnv *env, jclass, jbyte port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorValue";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
jlong retVal = spiGetAccumulatorValue(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
return retVal;
}
/*
@@ -311,17 +308,17 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorV
* Method: spiGetAccumulatorCount
* Signature: (B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorCount
(JNIEnv *env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorCount";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
jint retVal = spiGetAccumulatorCount(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
return retVal;
JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorCount(
JNIEnv *env, jclass, jbyte port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorCount";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
jint retVal = spiGetAccumulatorCount(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
return retVal;
}
/*
@@ -329,17 +326,17 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorCo
* Method: spiGetAccumulatorAverage
* Signature: (B)D
*/
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorAverage
(JNIEnv *env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorAverage";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
jdouble retVal = spiGetAccumulatorAverage(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
return retVal;
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorAverage(
JNIEnv *env, jclass, jbyte port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorAverage";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
jdouble retVal = spiGetAccumulatorAverage(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
return retVal;
}
/*
@@ -347,22 +344,22 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulato
* Method: spiGetAccumulatorOutput
* Signature: (BLjava/nio/LongBuffer;Ljava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorOutput
(JNIEnv *env, jclass, jbyte port, jobject value, jobject count)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorOutput";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorOutput(
JNIEnv *env, jclass, jbyte port, jobject value, jobject count) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorOutput";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
jlong * valuePtr = (jlong*)env->GetDirectBufferAddress(value);
uint32_t * countPtr = (uint32_t*)env->GetDirectBufferAddress(count);
jlong *valuePtr = (jlong *)env->GetDirectBufferAddress(value);
uint32_t *countPtr = (uint32_t *)env->GetDirectBufferAddress(count);
spiGetAccumulatorOutput(port, valuePtr, countPtr, &status);
spiGetAccumulatorOutput(port, valuePtr, countPtr, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "Value = " << *valuePtr;
SPIJNI_LOG(logDEBUG) << "Count = " << *countPtr;
CheckStatus(env, status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "Value = " << *valuePtr;
SPIJNI_LOG(logDEBUG) << "Count = " << *countPtr;
CheckStatus(env, status);
}
} // extern "C"