public Device(DeviceType type, string id, USB2LCD.VersionInfo version) { this.type = type; this.id = id; this.serialnum = version.serialnumber; this.module = version.module; this.version = version.version; }
// Send an entire character using cmd (DefineCustom or RememberCustom) and a character #0-7 public void SendCharacter(USB2LCD.Command cmd, byte c, byte[] bytes) { if ((cmd != USB2LCD.Command.DefineCustom && cmd != USB2LCD.Command.RememberCustom) || c >= 8 || bytes.Length != 8) throw new ArgumentException(); this.SendCmd(cmd, c); this.Stream.Write(bytes, 0, 8); this.Stream.Flush(); }
public ushort ReadShort(USB2LCD.Command cmd) { this.Port.DiscardInBuffer(); this.SendCmd(cmd); return (ushort)(CheckByte(this.Port.ReadByte()) | CheckByte(this.Port.ReadByte()) << 8); }
public byte[] ReadBytes(USB2LCD.Command cmd, byte subCmd, int n) { this.Port.DiscardInBuffer(); this.SendCmd(cmd, subCmd); return ReadBytes(n); }
public byte ReadByte(USB2LCD.Command cmd, byte subCmd) { this.Port.DiscardInBuffer(); this.SendCmd(cmd, subCmd); return CheckByte(this.Port.ReadByte()); }
public void SendCmd(USB2LCD.Command cmd, byte param1, byte param2) { this.Stream.WriteByte(254); this.Stream.WriteByte((byte)cmd); this.Stream.WriteByte(param1); this.Stream.WriteByte(param2); this.Stream.Flush(); }
public void SendCmd(USB2LCD.Command cmd, ushort subCmd) { this.SendCmd(USB2LCD.Command.SetSerialNum, (byte)(subCmd & 0xFF), (byte)((subCmd >> 8) & 0xFF)); }
public void SendCmd(USB2LCD.Command cmd, byte subCmd) { this.Stream.WriteByte(254); this.Stream.WriteByte((byte)cmd); this.Stream.WriteByte(subCmd); this.Stream.Flush(); }