namespace Unosquare.WiringPi.Native
{
using System.Runtime.InteropServices;
public partial class WiringPi
{
///
/// Simple device read. Some devices present data when you read them without having to do any register transactions.
///
/// The fd.
/// The result.
[DllImport(WiringPiLibrary, EntryPoint = "wiringPiI2CRead", SetLastError = true)]
public static extern int WiringPiI2CRead(int fd);
///
/// These read an 8-bit value from the device register indicated.
///
/// The fd.
/// The reg.
/// The result.
[DllImport(WiringPiLibrary, EntryPoint = "wiringPiI2CReadReg8", SetLastError = true)]
public static extern int WiringPiI2CReadReg8(int fd, int reg);
///
/// These read a 16-bit value from the device register indicated.
///
/// The fd.
/// The reg.
/// The result.
[DllImport(WiringPiLibrary, EntryPoint = "wiringPiI2CReadReg16", SetLastError = true)]
public static extern int WiringPiI2CReadReg16(int fd, int reg);
///
/// Simple device write. Some devices accept data this way without needing to access any internal registers.
///
/// The fd.
/// The data.
/// The result.
[DllImport(WiringPiLibrary, EntryPoint = "wiringPiI2CWrite", SetLastError = true)]
public static extern int WiringPiI2CWrite(int fd, int data);
///
/// These write an 8-bit data value into the device register indicated.
///
/// The fd.
/// The reg.
/// The data.
/// The result.
[DllImport(WiringPiLibrary, EntryPoint = "wiringPiI2CWriteReg8", SetLastError = true)]
public static extern int WiringPiI2CWriteReg8(int fd, int reg, int data);
///
/// These write a 16-bit data value into the device register indicated.
///
/// The fd.
/// The reg.
/// The data.
/// The result.
[DllImport(WiringPiLibrary, EntryPoint = "wiringPiI2CWriteReg16", SetLastError = true)]
public static extern int WiringPiI2CWriteReg16(int fd, int reg, int data);
///
/// This initializes the I2C system with your given device identifier.
/// The ID is the I2C number of the device and you can use the i2cdetect program to find this out. wiringPiI2CSetup()
/// will work out which revision Raspberry Pi you have and open the appropriate device in /dev.
/// The return value is the standard Linux filehandle, or -1 if any error – in which case, you can consult errno as usual.
/// E.g. the popular MCP23017 GPIO expander is usually device Id 0x20, so this is the number you would pass into wiringPiI2CSetup().
///
/// The dev identifier.
/// The result.
[DllImport(WiringPiLibrary, EntryPoint = "wiringPiI2CSetup", SetLastError = true)]
public static extern int WiringPiI2CSetup(int devId);
}
}