Ejemplo n.º 1
0
        /// <summary>
        /// Send text over serial specified serial port at baud rate
        /// </summary>
        public void SendSerial(Digital.DigitalPortEnum digitalPort, BAUD_RATE_ENUM baudRate, byte[] byteArray)
        {
            if (!_ezb.IsConnected)
            {
                throw new Exception("Not connected");
            }

            foreach (byte [] bArray in Functions.Chunk(byteArray, 255))
            {
                List <byte> send = new List <byte>();

                send.Add((byte)baudRate);
                send.Add((byte)bArray.Length);
                send.AddRange(bArray);

                _ezb.sendCommand(EZB.CommandEnum.CmdSendSerial + (byte)digitalPort, send.ToArray());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Specify the clock delay between bytes in cycles of the EZ-B's 120mhz 32 Bit ARM processor. This would only need to be used to fine tune the baudrate timing if the connected device is not very accurate or requires a diffference in timing.
        /// For example, some open-source hardware platforms use Software Serial drivers, which sometimes need a little bit of tweaking. Generally, you should never need to change these values.
        /// However, there is a Custom labelled baudrate which you can change for specific speeds.
        /// Anyone adjusting these speeds will need a logic analyzer, such as the Saleae Logic16 or Logic32
        /// </summary>
        public void SetBaudClock(BAUD_RATE_ENUM baudRate, int clockSpeed)
        {
            if (!_ezb.IsConnected)
            {
                throw new Exception("Not connected");
            }

            if (_ezb.EZBType != EZB.EZ_B_Type_Enum.ezb4)
            {
                throw new Exception("This feature is only available for EZ-B v4");
            }

            List <byte> send = new List <byte>();

            send.Add((byte)EZB.CmdEZBv4Enum.CmdV4UARTClockSpeed);
            send.Add((byte)baudRate);
            send.AddRange(BitConverter.GetBytes((UInt16)clockSpeed));

            _ezb.sendCommand(EZB.CommandEnum.CmdEZBv4, send.ToArray());
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Send text over serial specified serial port at baud rate
 /// </summary>
 public void SendSerial(Digital.DigitalPortEnum digitalPort, BAUD_RATE_ENUM baudRate, char[] charArray)
 {
     SendSerial(digitalPort, baudRate, Encoding.UTF8.GetBytes(charArray));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Send text over serial specified serial port at baud rate
 /// </summary>
 public void SendSerial(Digital.DigitalPortEnum digitalPort, BAUD_RATE_ENUM baudRate, string text)
 {
     SendSerial(digitalPort, baudRate, text.Select(Convert.ToByte).ToArray());
 }