private void Initialize() { var exportHandle = _libcWrapper.Open("/sys/class/gpio/export", LibcOpenMode.Write); foreach (var input in InputNameToGpioNumber) { var gpioNumber = input.Value; _libcWrapper.Write(exportHandle, Encoding.UTF8.GetBytes(gpioNumber.ToString())); var directionHandle = _libcWrapper.Open(GetGpioDirectionPath(gpioNumber), LibcOpenMode.Write); _libcWrapper.Write(gpioNumber, Encoding.UTF8.GetBytes("1")); _libcWrapper.Close(directionHandle); } _libcWrapper.Close(exportHandle); }
private void I2cSlaveWrite(int i2cDevice, byte[] data) { if (_libcWrapper.SendControl(_i2cBusHandle.Value, I2C_SLAVE_REQUEST, i2cDevice) >= 0) { _libcWrapper.Write(_i2cBusHandle.Value, data); } else { Logger.Warning("IOCTL < 0"); } }