public DecoderOutput[] Process(Dictionary <string, Array> inputWaveforms, Dictionary <string, object> parameters, double samplePeriod)
        {
            DecoderOutput[] i2cStream = (DecoderOutput[])inputWaveforms["I2C"];

            List <DecoderOutput> decoderOutputList = new List <DecoderOutput>();

            int  startIndex         = 0;
            bool i2cSequenceStarted = false;
            bool fpgaAddressed      = false;
            int  targetRegister     = -1;

            for (int i = 0; i < i2cStream.Length; i++)
            {
                DecoderOutput currentData = i2cStream[i];

                if ((!i2cSequenceStarted) && (currentData.Text == "S"))
                {
                    i2cSequenceStarted = true;
                    fpgaAddressed      = false;
                    startIndex         = currentData.StartIndex;
                    targetRegister     = -1;
                    continue;
                }

                if (i2cSequenceStarted)
                {
                    if (currentData is DecoderOutputValue <byte> ) //check for values only, not events
                    {
                        byte rawValue = (currentData as DecoderOutputValue <byte>).Value;
                        if (!fpgaAddressed)
                        {
                            fpgaAddressed = true;
                        }
                        else if (targetRegister < 0)
                        {
                            targetRegister = (int)rawValue;
                        }
                        else //3rd byte: regsiter value
                        {
                            REG    fpgaRegister = (REG)targetRegister;
                            string toPrint      = "FPGA: Set register " + fpgaRegister.ToString() + " to " + rawValue.ToString() + " (0x" + rawValue.ToString("X").PadLeft(2, '0') + ")";
                            decoderOutputList.Add(new DecoderOutputEvent(startIndex, currentData.EndIndex, DecoderOutputColor.Blue, toPrint));

                            //terminate this transmission
                            i2cSequenceStarted = false;
                        }
                    }
                    else
                    {
                        //if any event other than ACK is encountered during I2C transmission
                        if (currentData.Text != "ACK")
                        {
                            i2cSequenceStarted = false;
                        }
                    }
                }
            }

            return(decoderOutputList.ToArray());
        }
        internal byte GetRegister(REG r)
        {
            int offset = 0;

            if (!SmartScope.AcquisitionRegisters.Contains(r))
            {
                if (!SmartScope.DumpRegisters.Contains(r))
                {
                    throw new Exception("Register " + r.ToString("G") + " not part of header");
                }
                else
                {
                    offset = SmartScope.AcquisitionRegisters.Length + Array.IndexOf(SmartScope.DumpRegisters, r);
                };
            }
            else
            {
                offset = Array.IndexOf(SmartScope.AcquisitionRegisters, r);
            }

            return(raw[offset]);
        }
        internal byte GetRegister(REG r)
        {
            int offset = 0;
            if (!SmartScope.AcquisitionRegisters.Contains(r))
            {
                if (!SmartScope.DumpRegisters.Contains(r))
                    throw new Exception("Register " + r.ToString("G") + " not part of header");
                else
                    offset = SmartScope.AcquisitionRegisters.Length + Array.IndexOf(SmartScope.DumpRegisters, r); ;
            }
            else
            {
                offset = Array.IndexOf(SmartScope.AcquisitionRegisters, r);
            }

            return raw[offset];
        }