Inheritance: BootloaderCommand
Example #1
0
        public byte[] I2CTransfer(byte slaveAddress, byte[] sendData, byte sendLen, byte rxLen)
        {
            I2CTransferCommand  command  = new I2CTransferCommand(_checksumType, slaveAddress, sendData, sendLen, rxLen);
            I2CTransferResponse response = new I2CTransferResponse();

            try
            {
                this.SendCommand(command, response);
            }
            catch (BootloaderError ex)
            {
                if (((int)ex.Status & 0x80) != 0)
                {
                    throw new I2CTransferError(ex);
                }
                else
                {
                    throw;
                }
            }
            if (sendLen > 0)
            {
                System.Threading.Thread.Sleep(5);
            }
            return(response.Data);
        }
Example #2
0
 public byte[] I2CTransfer(byte slaveAddress, byte[] sendData, byte sendLen, byte rxLen)
 {
     I2CTransferCommand command = new I2CTransferCommand(_checksumType, slaveAddress, sendData, sendLen, rxLen);
     I2CTransferResponse response = new I2CTransferResponse();
     try
     {
         this.SendCommand(command, response);
     }
     catch (BootloaderError ex)
     {
         if (((int)ex.Status & 0x80) != 0)
         {
             throw new I2CTransferError(ex);
         }
         else
         {
             throw;
         }
     }
     if(sendLen > 0)
         System.Threading.Thread.Sleep(5);
     return response.Data;
 }