Switches SPI and I2C to use enums in the HAL for ports (#531)

Closes #397
This commit is contained in:
Thad House
2017-05-09 12:12:46 -07:00
committed by Peter Johnson
parent 67d62ba164
commit b2f3479692
14 changed files with 198 additions and 183 deletions

View File

@@ -30,14 +30,14 @@ extern "C" {
/*
* Class: edu_wpi_first_wpilibj_hal_I2CJNI
* Method: i2cInitialize
* Signature: (B)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CInitialize(
JNIEnv* env, jclass, jbyte value) {
JNIEnv* env, jclass, jint port) {
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CInititalize";
I2CJNI_LOG(logDEBUG) << "Port: " << (jint)value;
I2CJNI_LOG(logDEBUG) << "Port: " << port;
int32_t status = 0;
HAL_InitializeI2C(value, &status);
HAL_InitializeI2C(static_cast<HAL_I2CPort>(port), &status);
I2CJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatusForceThrow(env, status);
}
@@ -45,13 +45,13 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CInitialize(
/*
* Class: edu_wpi_first_wpilibj_hal_I2CJNI
* Method: i2CTransaction
* Signature: (BBLjava/nio/ByteBuffer;BLjava/nio/ByteBuffer;B)I
* Signature: (IBLjava/nio/ByteBuffer;BLjava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransaction(
JNIEnv* env, jclass, jbyte port, jbyte address, jobject dataToSend,
JNIEnv* env, jclass, jint port, jbyte address, jobject dataToSend,
jbyte sendSize, jobject dataReceived, jbyte receiveSize) {
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CTransaction";
I2CJNI_LOG(logDEBUG) << "Port = " << (jint)port;
I2CJNI_LOG(logDEBUG) << "Port = " << port;
I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address;
uint8_t* dataToSendPtr = nullptr;
if (dataToSend != 0) {
@@ -63,7 +63,7 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransaction(
(uint8_t*)env->GetDirectBufferAddress(dataReceived);
I2CJNI_LOG(logDEBUG) << "DataReceivedPtr = " << (jint*)dataReceivedPtr;
I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << (jint)receiveSize;
jint returnValue = HAL_TransactionI2C(port, address, dataToSendPtr, sendSize,
jint returnValue = HAL_TransactionI2C(static_cast<HAL_I2CPort>(port), address, dataToSendPtr, sendSize,
dataReceivedPtr, receiveSize);
I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue;
return returnValue;
@@ -72,13 +72,13 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransaction(
/*
* Class: edu_wpi_first_wpilibj_hal_I2CJNI
* Method: i2CWrite
* Signature: (BBLjava/nio/ByteBuffer;B)I
* Signature: (IBLjava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWrite(
JNIEnv* env, jclass, jbyte port, jbyte address, jobject dataToSend,
JNIEnv* env, jclass, jint port, jbyte address, jobject dataToSend,
jbyte sendSize) {
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CWrite";
I2CJNI_LOG(logDEBUG) << "Port = " << (jint)port;
I2CJNI_LOG(logDEBUG) << "Port = " << port;
I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address;
uint8_t* dataToSendPtr = nullptr;
@@ -87,7 +87,7 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWrite(
}
I2CJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
I2CJNI_LOG(logDEBUG) << "SendSize = " << (jint)dataToSend;
jint returnValue = HAL_WriteI2C(port, address, dataToSendPtr, sendSize);
jint returnValue = HAL_WriteI2C(static_cast<HAL_I2CPort>(port), address, dataToSendPtr, sendSize);
I2CJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)returnValue;
return returnValue;
}
@@ -95,10 +95,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWrite(
/*
* Class: edu_wpi_first_wpilibj_hal_I2CJNI
* Method: i2CRead
* Signature: (BBLjava/nio/ByteBuffer;B)I
* Signature: (IBLjava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CRead(
JNIEnv* env, jclass, jbyte port, jbyte address, jobject dataReceived,
JNIEnv* env, jclass, jint port, jbyte address, jobject dataReceived,
jbyte receiveSize) {
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CRead";
I2CJNI_LOG(logDEBUG) << "Port = " << port;
@@ -107,7 +107,7 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CRead(
(uint8_t*)env->GetDirectBufferAddress(dataReceived);
I2CJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << receiveSize;
jint returnValue = HAL_ReadI2C(port, address, dataReceivedPtr, receiveSize);
jint returnValue = HAL_ReadI2C(static_cast<HAL_I2CPort>(port), address, dataReceivedPtr, receiveSize);
I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue;
return returnValue;
}
@@ -115,12 +115,12 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CRead(
/*
* Class: edu_wpi_first_wpilibj_hal_I2CJNI
* Method: i2CClose
* Signature: (B)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CClose(JNIEnv*, jclass, jbyte value) {
Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CClose(JNIEnv*, jclass, jint port) {
I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CClose";
HAL_CloseI2C(value);
HAL_CloseI2C(static_cast<HAL_I2CPort>(port));
}
} // extern "C"

View File

@@ -30,14 +30,14 @@ extern "C" {
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiInitialize
* Signature: (B)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize(
JNIEnv *env, jclass, jbyte port) {
JNIEnv *env, jclass, jint port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitialize";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
HAL_InitializeSPI(port, &status);
HAL_InitializeSPI(static_cast<HAL_SPIPort>(port), &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatusForceThrow(env, status);
}
@@ -45,10 +45,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiTransaction
* Signature: (BLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;B)I
* Signature: (ILjava/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,
JNIEnv *env, jclass, jint port, jobject dataToSend, jobject dataReceived,
jbyte size) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiTransaction";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
@@ -61,7 +61,7 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction(
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
jint retVal = HAL_TransactionSPI(port, dataToSendPtr, dataReceivedPtr, size);
jint retVal = HAL_TransactionSPI(static_cast<HAL_SPIPort>(port), dataToSendPtr, dataReceivedPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
}
@@ -69,10 +69,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiWrite
* Signature: (BLjava/nio/ByteBuffer;B)I
* Signature: (ILjava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite(
JNIEnv *env, jclass, jbyte port, jobject dataToSend, jbyte size) {
JNIEnv *env, jclass, jint port, jobject dataToSend, jbyte size) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiWrite";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
uint8_t *dataToSendPtr = nullptr;
@@ -81,7 +81,7 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite(
}
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
jint retVal = HAL_WriteSPI(port, dataToSendPtr, size);
jint retVal = HAL_WriteSPI(static_cast<HAL_SPIPort>(port), dataToSendPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
}
@@ -89,17 +89,17 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiRead
* Signature: (BLjava/nio/ByteBuffer;B)I
* Signature: (ILjava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead(
JNIEnv *env, jclass, jbyte port, jobject dataReceived, jbyte size) {
JNIEnv *env, jclass, jint 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 = HAL_ReadSPI(port, (uint8_t *)dataReceivedPtr, size);
jint retVal = HAL_ReadSPI(static_cast<HAL_SPIPort>(port), (uint8_t *)dataReceivedPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
}
@@ -107,56 +107,56 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiClose
* Signature: (B)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose(JNIEnv *, jclass, jbyte port) {
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose(JNIEnv *, jclass, jint port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiClose";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
HAL_CloseSPI(port);
HAL_CloseSPI(static_cast<HAL_SPIPort>(port));
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiSetSpeed
* Signature: (BI)V
* Signature: (II)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed(
JNIEnv *, jclass, jbyte port, jint speed) {
JNIEnv *, jclass, jint port, jint speed) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetSpeed";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Speed = " << (jint)speed;
HAL_SetSPISpeed(port, speed);
HAL_SetSPISpeed(static_cast<HAL_SPIPort>(port), speed);
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiSetOpts
* Signature: (BIII)V
* Signature: (IIII)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts(
JNIEnv *, jclass, jbyte port, jint msb_first, jint sample_on_trailing,
JNIEnv *, jclass, jint 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;
HAL_SetSPIOpts(port, msb_first, sample_on_trailing, clk_idle_high);
HAL_SetSPIOpts(static_cast<HAL_SPIPort>(port), msb_first, sample_on_trailing, clk_idle_high);
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiSetChipSelectActiveHigh
* Signature: (B)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh(
JNIEnv *env, jclass, jbyte port) {
JNIEnv *env, jclass, jint port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveHigh";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
HAL_SetSPIChipSelectActiveHigh(port, &status);
HAL_SetSPIChipSelectActiveHigh(static_cast<HAL_SPIPort>(port), &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
@@ -164,15 +164,15 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiSetChipSelectActiveLow
* Signature: (B)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow(
JNIEnv *env, jclass, jbyte port) {
JNIEnv *env, jclass, jint port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveLow";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
HAL_SetSPIChipSelectActiveLow(port, &status);
HAL_SetSPIChipSelectActiveLow(static_cast<HAL_SPIPort>(port), &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
@@ -180,10 +180,10 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiInitAccumulator
* Signature: (BIIBIIBBZZ)V
* Signature: (IIIBIIBBZZ)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAccumulator(
JNIEnv *env, jclass, jbyte port, jint period, jint cmd, jbyte xferSize,
JNIEnv *env, jclass, jint 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";
@@ -198,7 +198,7 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAccumulator(
SPIJNI_LOG(logDEBUG) << "IsSigned = " << (jint)isSigned;
SPIJNI_LOG(logDEBUG) << "BigEndian = " << (jint)bigEndian;
int32_t status = 0;
HAL_InitSPIAccumulator(port, period, cmd, xferSize, validMask, validValue,
HAL_InitSPIAccumulator(static_cast<HAL_SPIPort>(port), period, cmd, xferSize, validMask, validValue,
dataShift, dataSize, isSigned, bigEndian, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
@@ -207,14 +207,14 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAccumulator(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiFreeAccumulator
* Signature: (B)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAccumulator(
JNIEnv *env, jclass, jbyte port) {
JNIEnv *env, jclass, jint port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiFreeAccumulator";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
HAL_FreeSPIAccumulator(port, &status);
HAL_FreeSPIAccumulator(static_cast<HAL_SPIPort>(port), &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
@@ -222,15 +222,15 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAccumulator(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiResetAccumulator
* Signature: (B)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiResetAccumulator(
JNIEnv *env, jclass, jbyte port) {
JNIEnv *env, jclass, jint port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiResetAccumulator";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
HAL_ResetSPIAccumulator(port, &status);
HAL_ResetSPIAccumulator(static_cast<HAL_SPIPort>(port), &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
@@ -238,16 +238,16 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiResetAccumulator(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiSetAccumulatorCenter
* Signature: (BI)V
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAccumulatorCenter(
JNIEnv *env, jclass, jbyte port, jint center) {
JNIEnv *env, jclass, jint port, jint center) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetAccumulatorCenter";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Center = " << center;
int32_t status = 0;
HAL_SetSPIAccumulatorCenter(port, center, &status);
HAL_SetSPIAccumulatorCenter(static_cast<HAL_SPIPort>(port), center, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
@@ -255,16 +255,16 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAccumulatorCenter(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiSetAccumulatorDeadband
* Signature: (BI)V
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAccumulatorDeadband(
JNIEnv *env, jclass, jbyte port, jint deadband) {
JNIEnv *env, jclass, jint port, jint deadband) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetAccumulatorDeadband";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
SPIJNI_LOG(logDEBUG) << "Deadband = " << deadband;
int32_t status = 0;
HAL_SetSPIAccumulatorDeadband(port, deadband, &status);
HAL_SetSPIAccumulatorDeadband(static_cast<HAL_SPIPort>(port), deadband, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
@@ -272,15 +272,15 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAccumulatorDeadband(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiGetAccumulatorLastValue
* Signature: (B)I
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorLastValue(
JNIEnv *env, jclass, jbyte port) {
JNIEnv *env, jclass, jint port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorLastValue";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
jint retVal = HAL_GetSPIAccumulatorLastValue(port, &status);
jint retVal = HAL_GetSPIAccumulatorLastValue(static_cast<HAL_SPIPort>(port), &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
@@ -290,15 +290,15 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorLastValue(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiGetAccumulatorValue
* Signature: (B)J
* Signature: (I)J
*/
JNIEXPORT jlong JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorValue(
JNIEnv *env, jclass, jbyte port) {
JNIEnv *env, jclass, jint port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorValue";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
jlong retVal = HAL_GetSPIAccumulatorValue(port, &status);
jlong retVal = HAL_GetSPIAccumulatorValue(static_cast<HAL_SPIPort>(port), &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
@@ -308,15 +308,15 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorValue(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiGetAccumulatorCount
* Signature: (B)I
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorCount(
JNIEnv *env, jclass, jbyte port) {
JNIEnv *env, jclass, jint port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorCount";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
jint retVal = HAL_GetSPIAccumulatorCount(port, &status);
jint retVal = HAL_GetSPIAccumulatorCount(static_cast<HAL_SPIPort>(port), &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
@@ -326,15 +326,15 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorCount(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiGetAccumulatorAverage
* Signature: (B)D
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorAverage(
JNIEnv *env, jclass, jbyte port) {
JNIEnv *env, jclass, jint port) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorAverage";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
jdouble retVal = HAL_GetSPIAccumulatorAverage(port, &status);
jdouble retVal = HAL_GetSPIAccumulatorAverage(static_cast<HAL_SPIPort>(port), &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << retVal;
CheckStatus(env, status);
@@ -344,11 +344,11 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorAverage(
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiGetAccumulatorOutput
* Signature: (BLjava/nio/LongBuffer;Ljava/nio/LongBuffer;)V
* Signature: (ILjava/nio/LongBuffer;Ljava/nio/LongBuffer;)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorOutput(
JNIEnv *env, jclass, jbyte port, jobject value, jobject count) {
JNIEnv *env, jclass, jint port, jobject value, jobject count) {
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAccumulatorOutput";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port;
int32_t status = 0;
@@ -356,7 +356,7 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAccumulatorOutput(
jlong *valuePtr = (jlong *)env->GetDirectBufferAddress(value);
jlong *countPtr = (jlong *)env->GetDirectBufferAddress(count);
HAL_GetSPIAccumulatorOutput(port, valuePtr, countPtr, &status);
HAL_GetSPIAccumulatorOutput(static_cast<HAL_SPIPort>(port), valuePtr, countPtr, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
SPIJNI_LOG(logDEBUG) << "Value = " << *valuePtr;