/// <summary>This uses the standard baud rates defined by the SERIAL_BAUD enumerated type</summary> public static RESULTS setI2C_MODE(ISS_MODES_I2C mode, 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 }); comm.Read(2); //if (comm.readData[0] == 0xFF) // is Ack return((RESULTS)comm.readData[1]); }
public static RESULTS setSPI_MODE(ISS_MODES_SPI mode, byte clkDiv) { ISSComm comm = ISSComm.getComm(); comm.Write(new byte[] { 0x5A, 0x02, (byte)mode, clkDiv }); comm.Read(2); //if (comm.readData[0] == 0xFF) // is Ack return((RESULTS)comm.readData[1]); }
/// <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> public static RESULTS setI2C_MODE(ISS_MODES_I2C mode, 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 }); 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]); }