I2C: Provide byte[] JNI interfaces.

This avoids a direct byte buffer allocation on every read/write/transaction
on the byte[] variants.

Changes HAL I2C interfaces to use const for dataToSend.
This commit is contained in:
Peter Johnson
2017-11-15 21:41:58 -08:00
parent 6307d41002
commit 9021b37fd2
8 changed files with 161 additions and 58 deletions

View File

@@ -17,10 +17,10 @@ extern "C" {
void HAL_InitializeI2C(HAL_I2CPort port, int32_t* status);
int32_t HAL_TransactionI2C(HAL_I2CPort port, int32_t deviceAddress,
uint8_t* dataToSend, int32_t sendSize,
const uint8_t* dataToSend, int32_t sendSize,
uint8_t* dataReceived, int32_t receiveSize);
int32_t HAL_WriteI2C(HAL_I2CPort port, int32_t deviceAddress,
uint8_t* dataToSend, int32_t sendSize);
const uint8_t* dataToSend, int32_t sendSize);
int32_t HAL_ReadI2C(HAL_I2CPort port, int32_t deviceAddress, uint8_t* buffer,
int32_t count);
void HAL_CloseI2C(HAL_I2CPort port);