// Path: src/main/java/be/error/rpi/config/RunConfig.java
// public static RunConfig getInstance() {
// 	if (runConfig == null) {
// 		throw new IllegalStateException("Initialize first");
// 	}
// 	return runConfig;
// }


import com.pi4j.io.i2c.I2CDevice;
import static be.error.rpi.config.RunConfig.getInstance;
import static org.apache.commons.lang3.ArrayUtils.add;
import static org.apache.commons.lang3.ArrayUtils.reverse;
import java.io.IOException;
import java.math.BigInteger;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
		}
	}

	public synchronized void write(int boardAddress, int channel, byte[] b) throws IOException {
		WriteCommand writeCommand = new WriteCommand();
		writeCommand.boardAddress = boardAddress;
		writeCommand.i2cDevice = getInstance().getBus().getDevice(boardAddress);
		writeCommand.channel = channel;
		reverse(b);
		writeCommand.value = add(b, 0, (byte) channel);
		try {
			commandQueue.put(writeCommand);
		} catch (InterruptedException interruptedException) {
			logger.error("Communicator thread had interrupted exception. Device: " + boardAddress, interruptedException);
		}
	}

	class WriteCommand {
		int boardAddress;
		I2CDevice i2cDevice;
		int channel;
		byte[] value;

		@Override
		public String toString() {
			try {
				return "WriteCommand{" + "i2cDevice=" + boardAddress + " to " + "channel " + channel + " value=" + new BigInteger(new byte[] { value[2], value[1] })
						+ '}';
			} catch (Exception e) {
				logger.error("Could not to string", e);
// Path: src/main/java/be/error/rpi/config/RunConfig.java
// public static RunConfig getInstance() {
// 	if (runConfig == null) {
// 		throw new IllegalStateException("Initialize first");
// 	}
// 	return runConfig;
// }


// Path: src/main/java/be/error/rpi/dac/i2c/I2CCommunicator.java
import com.pi4j.io.i2c.I2CDevice;
import static be.error.rpi.config.RunConfig.getInstance;
import static org.apache.commons.lang3.ArrayUtils.add;
import static org.apache.commons.lang3.ArrayUtils.reverse;
import java.io.IOException;
import java.math.BigInteger;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

		}
	}

	public synchronized void write(int boardAddress, int channel, byte[] b) throws IOException {
		WriteCommand writeCommand = new WriteCommand();
		writeCommand.boardAddress = boardAddress;
		writeCommand.i2cDevice = getInstance().getBus().getDevice(boardAddress);
		writeCommand.channel = channel;
		reverse(b);
		writeCommand.value = add(b, 0, (byte) channel);
		try {
			commandQueue.put(writeCommand);
		} catch (InterruptedException interruptedException) {
			logger.error("Communicator thread had interrupted exception. Device: " + boardAddress, interruptedException);
		}
	}

	class WriteCommand {
		int boardAddress;
		I2CDevice i2cDevice;
		int channel;
		byte[] value;

		@Override
		public String toString() {
			try {
				return "WriteCommand{" + "i2cDevice=" + boardAddress + " to " + "channel " + channel + " value=" + new BigInteger(new byte[] { value[2], value[1] })
						+ '}';
			} catch (Exception e) {
				logger.error("Could not to string", e);
				throw new RuntimeException(e);