Hi
Try to pass register adress in Pi4j.I2C as in I2c_tools "i2cget" but dont understand how.
I use this code:
But where/how do i pass the reg adress, in this case Device adress 0x42, register 0xFF
Regards
Johan F
Try to pass register adress in Pi4j.I2C as in I2c_tools "i2cget" but dont understand how.
I use this code:
B4X:
Sub GetBus(BusNumber As Int) As JavaObject
Dim factory As JavaObject
Return factory.InitializeStatic("com.pi4j.io.i2c.I2CFactory").RunMethodJO("getInstance", Array As Object(BusNumber))
End Sub
'Bus methods
Sub GetDevice(bus As JavaObject, Address As Int) As JavaObject
Return bus.RunMethodJO("getDevice", Array As Object(Address))
End Sub
Sub CloseBus (bus As JavaObject)
bus.RunMethod("close", Null)
End Sub
'Device methods
Sub Read(device As JavaObject) As Int
Return device.RunMethod("read", Null)
End Sub
Sub Read2 (Device As JavaObject, Buffer() As Byte, Offset As Int, Size As Int) As Int
Return Device.RunMethod("read", Array As Object(Buffer, Offset, Size))
End Sub
Sub Write(Device As JavaObject, b As Byte)
Device.RunMethod("write", Array As Object(b))
End Sub
Sub Write2(Device As JavaObject, Buffer() As Byte, Offset As Int, Size As Int)
Device.RunMethod("write", Array As Object(Buffer, Offset, Size))
End Sub
But where/how do i pass the reg adress, in this case Device adress 0x42, register 0xFF
Regards
Johan F