/// <summary>Should only be used when in Serial or I2C mode</summary> public static RESULTS setIO_CHANGE(IO_TYPES pin1, IO_TYPES pin2, IO_TYPES pin3, IO_TYPES pin4) { ISSComm comm = ISSComm.getComm(); comm.Write(new byte[] { 0x5A, 0x02, (byte)ISS_MODES.IO_CHANGE, (byte)(((int)pin4 << 6) | ((int)pin3 << 4) | ((int)pin2 << 2) | (int)pin1) }); comm.Read(2); //if (comm.readData[0] == 0xFF) // is Ack return((RESULTS)comm.readData[1]); }
/// <summary>This uses the standard baud rates defined by the SERIAL_BAUD enumerated type</summary> private static RESULTS setModeSerial(ISS_MODES mode, IO_TYPES pin3, IO_TYPES pin4, SERIAL_BAUD_RATES baud) { ISSComm comm = ISSComm.getComm(); comm.Write(new byte[] { 0x5A, 0x02, (byte)((byte)mode | (byte)ISS_MODES.SERIAL), (byte)(((uint)baud) >> 8), (byte)baud, (byte)(((int)pin4 << 6) | ((int)pin3 << 4)) }); comm.Read(2); //if (comm.readData[0] == 0xFF) // is Ack return((RESULTS)comm.readData[1]); }
private static RESULTS setMode(ISS_MODES mode, IO_TYPES pin1, IO_TYPES pin2, IO_TYPES pin3, IO_TYPES pin4) { ISSComm comm = ISSComm.getComm(); comm.Write(new byte[] { 0x5A, 0x02, (byte)mode, (byte)(((int)pin4 << 6) | ((int)pin3 << 4) | ((int)pin2 << 2) | (int)pin1) }); comm.Read(2); //if (comm.readData[0] == 0xFF) // is Ack return((RESULTS)comm.readData[1]); }
/// <summary>This uses the custom specified baud rate. Eg: baud = 57600</summary> private static RESULTS setModeSerial(ISS_MODES mode, IO_TYPES pin3, IO_TYPES pin4, uint baud) { baud = (48000000 / (16 + baud)) - 1; // convert to baud rate divisor ISSComm comm = ISSComm.getComm(); comm.Write(new byte[] { 0x5A, 0x02, (byte)((byte)mode | (byte)ISS_MODES.SERIAL), (byte)(((uint)baud) >> 8), (byte)baud, (byte)(((int)pin4 << 6) | ((int)pin3 << 4)) }); comm.Read(2); //if (comm.readData[0] == 0xFF) // is Ack return((RESULTS)comm.readData[1]); }
public static RESULTS setIO_MODE_SERIAL(IO_TYPES pin3, IO_TYPES pin4, uint baud) { return(setModeSerial(ISS_MODES.IO_MODE, pin3, pin4, baud)); }
public static RESULTS setIO_MODE(IO_TYPES pin1, IO_TYPES pin2, IO_TYPES pin3, IO_TYPES pin4) { return(setMode(ISS_MODES.IO_MODE, pin1, pin2, pin3, pin4)); }
public static RESULTS setI2C_MODE(ISS_MODES_I2C mode, IO_TYPES pin1, IO_TYPES pin2) { return(setMode((ISS_MODES)mode, pin1, pin2, 0, 0)); }