mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpiutil] jni_util: Add JSpan and CriticalJSpan (#5554)
These replace JArrayRef et al and support statically sized arrays similar to std::span.
This commit is contained in:
@@ -79,7 +79,7 @@ Java_edu_wpi_first_hal_I2CJNI_i2CTransactionB
|
||||
jint returnValue =
|
||||
HAL_TransactionI2C(static_cast<HAL_I2CPort>(port), address,
|
||||
reinterpret_cast<const uint8_t*>(
|
||||
JByteArrayRef(env, dataToSend).array().data()),
|
||||
JSpan<const jbyte>(env, dataToSend).data()),
|
||||
sendSize, recvBuf.data(), receiveSize);
|
||||
env->SetByteArrayRegion(dataReceived, 0, receiveSize,
|
||||
reinterpret_cast<const jbyte*>(recvBuf.data()));
|
||||
@@ -120,7 +120,7 @@ Java_edu_wpi_first_hal_I2CJNI_i2CWriteB
|
||||
jint returnValue =
|
||||
HAL_WriteI2C(static_cast<HAL_I2CPort>(port), address,
|
||||
reinterpret_cast<const uint8_t*>(
|
||||
JByteArrayRef(env, dataToSend).array().data()),
|
||||
JSpan<const jbyte>(env, dataToSend).data()),
|
||||
sendSize);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user