Here Are the VB.net import loaders for the OSIFdll.dll
A full sample application is attached, as well as the source.
'Initialise the OSIF interface
<DllImport("OSIFdll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function OSIF_init() As Integer
End Function
'de-initialise the OSIF interface and close.
<DllImport("OSIFdll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function OSIF_deinit() As Integer
End Function
'Get the number of OSIF adapters currently connected
<DllImport("OSIFdll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function OSIF_get_adapter_count() As Integer
End Function
'Get the real name of the OSIF adapter connected
<DllImport("OSIFdll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function OSIF_get_adapter_name(ByVal Adapter As Integer, ByVal Name As StringBuilder) As Integer
End Function
'Probe an I2C address to see if it exists
<DllImport("OSIFdll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function OSIF_probe(ByVal Adapter As Integer, _
ByVal Device As Integer) As Boolean
End Function
'Scan the I2C bus. This probably needs marshalling due to the pointer to the array
' <DllImport("OSIFdll.dll", CallingConvention:=CallingConvention.Cdecl)> _
' Private Shared Function OSIF_scan(ByVal Adapter As Integer, _
' ByVal Buffer() As Byte, _
' ByVal Device_Count As Integer) As Integer
' End Function
'write some bytes to the OSIF
<DllImport("OSIFdll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function OSIF_write(ByVal Adapter As Integer, _
ByVal Device As Integer, _
ByVal Address As Integer, _
ByVal Data() As Byte, _
ByVal Length As Integer) As Integer
End Function
'Read some bytes from the OSIF
<DllImport("OSIFdll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function OSIF_read(ByVal Adapter As Integer, _
ByVal Device As Integer, _
ByVal Address As Integer, _
ByVal Data() As Byte, _
ByVal Length As Integer) As Integer
End Function
'Flash new firmware to the I2C OpenServo
<DllImport("OSIFdll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function OSIF_reflash(ByVal Adapter As Integer, _
ByVal Device As Integer, _
ByVal Address As Integer, _
ByVal BootloaderAddress As Integer, _
ByVal Filename As StringBuilder) As Integer
End Function
'Send a single write to the address specified
<DllImport("OSIFdll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function OSIF_command(ByVal Adapter As Integer, _
ByVal Device As Integer, _
ByVal Command As Byte) As Integer
End Function
| Attachment | Size |
|---|---|
| OSIF test VB.zip | 228.51 KB |
| OSIF test VB source.zip | 303.69 KB |
![View your cart items []](/sites/all/modules/ecommerce/cart/images/cart_empty.png)