using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Text;





namespace Nastavení_PAO
{

    public delegate void PropertiesWillBeReloadedHandler();

    public class PAOPropertiesChangedEventArgs : EventArgs
    {
        Dictionary<Byte,Byte> dictrprop = new Dictionary<byte,byte>();


        public PAOPropertiesChangedEventArgs(Dictionary<Byte,Byte> dictrpropX)
        {
            this.dictrprop = dictrpropX;
        }

        public Dictionary<Byte, Byte> Dictrprop
        {
            get
            {
                return dictrprop;
            }
        }
    }

    public struct MuxSettingsByteToSwitch {


    public bool swa_, swb_, swc_, swd_, swg_;

    public MuxSettingsByteToSwitch(bool swa, bool swb, bool swc, bool swd, bool swg) {

        swa_ = swa;
        swb_ = swb;
        swc_ = swc;
        swd_ = swd;
        swg_ = swg;

    
    }
    
   
    }


    public class PAOProperties
    {

        //Událost, že se nějaká vlastnost změnila a že je třeba vygenerovat nový slovník dat pro kontrolní registrů 

        public delegate void PAOPropertiesChandedHandler(object sender, PAOPropertiesChangedEventArgs e);


        public List<int> enabledData = new List<int>();
        private bool alotpropertiestothumbinals_ = true;


        public bool Alotpropertiestothumbinals {

            set {

                this.alotpropertiestothumbinals_ = value;
            
            }
        
        }

        private Dictionary<Byte, Byte> controlregisters = new Dictionary<byte, byte>();

        public Dictionary<byte, byte> muxcombtobyte = new Dictionary<byte, byte>();

        public event PAOPropertiesChandedHandler PAOPropertiesChandedStatus;
        public event PropertiesWillBeReloadedHandler PropertiesWillBeReloadedStatus;

        protected void PAOPropertiesChandedStatusMake(PAOPropertiesChangedEventArgs e)
        {

            if (PAOPropertiesChandedStatus != null)
            {

                PAOPropertiesChandedStatus(this, e);
            }

        }

        protected void PropertiesWillBeReloadedStatusMake() {

            if (PropertiesWillBeReloadedStatus != null) {

                PropertiesWillBeReloadedStatus();
            
            }
        
        
        }

        //Maximum dat :-D


        private bool Imax350mA_ENA_,TxCLP_, CLP_OFF_, SERVO_ENAS1_, SDBUFp5dB_, SERVO_ENAS2_, VREF1V2_, OFF_DIS_, OFF_SIGN_, MXx_OUT_ENA_, POR_Test_Ena_, POR_TST_IN_TMA_, TstBuff_Pass_, Tx_TST_SEL1_, Tx_TST_SEL2_, Tx_TST_SEL3_, Tx_TST_SEL4_, PDS1_, PDS2_, PDVGA1_, PDVGA2_, PD_BUF_, PD_SDM_, TxPD_, PD_POR_, PD_VBG_, PD_LDR_, PD_BIA3_, PD_BIAS_, PD_VREF_, PD_TstBuf_, PD_LIN_, SEL_LIN_ver_, SWVGAA2_A_, SWVGAA2_S_, SWLNA_VGA_A_, SWLNA_VGA_S_, SWgmTIA1_A_, SWgmTIA1_S_, Test_VBG_ENA_, PD_AGND_;
        private Byte TxTRIM_OFFSET_, TxTRIM_GAIN_, TxIset_, BG_Trim_, VGA_2GAINCode_, MX1_SEL_, MX2_SEL_, TstswA2_, TstswLNA1_, TstswVGA2_, TstswVGA1_, TstSDM_, ANASel_, VGA_1GAINCode_;

        private bool _CheckToReloadProp;

        public bool Imax350mA_ENA
        {
            get
            {
                return this.Imax350mA_ENA_;
            }
            set
            {
                this.Imax350mA_ENA_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }

        public bool TickToReloadProperties
        {
            get {

                return this._CheckToReloadProp;
            
            }
            set
            {
                this._CheckToReloadProp = value;

                PropertiesWillBeReloadedStatusMake();
            }
        }


        public bool TxCLP
        {
            get
            {
                return this.TxCLP_;
            }
            set
            {
                this.TxCLP_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool CLP_OFF
        {
            get
            {
                return this.CLP_OFF_;
            }
            set
            {
                this.CLP_OFF_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool SERVO_ENAS1
        {
            get
            {
                return this.SERVO_ENAS1_;
            }
            set
            {
                this.SERVO_ENAS1_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }








        public bool SDBUFp5dB
        {
            get
            {
                return this.SDBUFp5dB_;
            }
            set
            {
                this.SDBUFp5dB_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool SERVO_ENAS2
        {
            get
            {
                return this.SERVO_ENAS2_;
            }
            set
            {
                this.SERVO_ENAS2_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool VREF1V2
        {
            get
            {
                return this.VREF1V2_;
            }
            set
            {
                this.VREF1V2_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool OFF_DIS
        {
            get
            {
                return this.OFF_DIS_;
            }
            set
            {
                this.OFF_DIS_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }





        public bool OFF_SIGN
        {
            get
            {
                return this.OFF_SIGN_;
            }
            set
            {
                this.OFF_SIGN_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool MXx_OUT_ENA
        {
            get
            {
                return this.MXx_OUT_ENA_;
            }
            set
            {
                this.MXx_OUT_ENA_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool POR_Test_Ena
        {
            get
            {
                return this.POR_Test_Ena_;
            }
            set
            {
                this.POR_Test_Ena_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool POR_TST_IN_TMA
        {
            get
            {
                return this.POR_TST_IN_TMA_;
            }
            set
            {
                this.POR_TST_IN_TMA_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }





        public bool TstBuff_Pass
        {
            get
            {
                return this.TstBuff_Pass_;
            }
            set
            {
                this.TstBuff_Pass_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool Tx_TST_SEL1
        {
            get
            {
                return this.Tx_TST_SEL1_;
            }
            set
            {
                this.Tx_TST_SEL1_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool Tx_TST_SEL2
        {
            get
            {
                return this.Tx_TST_SEL2_;
            }
            set
            {
                this.Tx_TST_SEL2_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool Tx_TST_SEL3
        {
            get
            {
                return this.Tx_TST_SEL3_;
            }
            set
            {
                this.Tx_TST_SEL3_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool Tx_TST_SEL4
        {
            get
            {
                return this.Tx_TST_SEL4_;
            }
            set
            {
                this.Tx_TST_SEL4_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool PDS1
        {
            get
            {
                return this.PDS1_;
            }
            set
            {
                this.PDS1_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool PDS2
        {
            get
            {
                return this.PDS2_;
            }
            set
            {
                this.PDS2_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool PDVGA1
        {
            get
            {
                return this.PDVGA1_;
            }
            set
            {
                this.PDVGA1_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool PDVGA2
        {
            get
            {
                return this.PDVGA2_;
            }
            set
            {
                this.PDVGA2_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool PD_BUF
        {
            get
            {
                return this.PD_BUF_;
            }
            set
            {
                this.PD_BUF_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool PD_SDM
        {
            get
            {
                return this.PD_SDM_;
            }
            set
            {
                this.PD_SDM_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }

        public bool TxPD
        {
            get
            {
                return this.TxPD_;
            }
            set
            {
                this.TxPD_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool PD_POR
        {
            get
            {
                return this.PD_POR_;
            }
            set
            {
                this.PD_POR_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool PD_VBG
        {
            get
            {
                return this.PD_VBG_;
            }
            set
            {
                this.PD_VBG_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool PD_LDR
        {
            get
            {
                return this.PD_LDR_;
            }
            set
            {
                this.PD_LDR_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool PD_BIA3
        {
            get
            {
                return this.PD_BIA3_;
            }
            set
            {
                this.PD_BIA3_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool PD_BIAS
        {
            get
            {
                return this.PD_BIAS_;
            }
            set
            {
                this.PD_BIAS_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool PD_VREF
        {
            get
            {
                return this.PD_VREF_;
            }
            set
            {
                this.PD_VREF_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool PD_TstBuf
        {
            get
            {
                return this.PD_TstBuf_;
            }
            set
            {
                this.PD_TstBuf_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool PD_LIN
        {
            get
            {
                return this.PD_LIN_;
            }
            set
            {
                this.PD_LIN_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool SEL_LIN_ver
        {
            get
            {
                return this.SEL_LIN_ver_;
            }
            set
            {
                this.SEL_LIN_ver_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool SWVGAA2_A
        {
            get
            {
                return this.SWVGAA2_A_;
            }
            set
            {
                this.SWVGAA2_A_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool SWVGAA2_S
        {
            get
            {
                return this.SWVGAA2_S_;
            }
            set
            {
                this.SWVGAA2_S_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool SWLNA_VGA_A
        {
            get
            {
                return this.SWLNA_VGA_A_;
            }
            set
            {
                this.SWLNA_VGA_A_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }




        public bool SWLNA_VGA_S
        {
            get
            {
                return this.SWLNA_VGA_S_;
            }
            set
            {
                this.SWLNA_VGA_S_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool SWgmTIA1_A
        {
            get
            {
                return this.SWgmTIA1_A_;
            }
            set
            {
                this.SWgmTIA1_A_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public bool SWgmTIA1_S
        {
            get
            {
                return this.SWgmTIA1_S_;
            }
            set
            {
                this.SWgmTIA1_S_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }

        public bool Test_VBG_ENA
        {
            get
            {
                return this.Test_VBG_ENA_;
            }
            set
            {
                this.Test_VBG_ENA_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }

        public bool PD_AGND
        {
            get
            {
                return this.PD_AGND_;
            }
            set
            {
                this.PD_AGND_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        //Bytové hodnoty controlních registrů

        public Byte TxTRIM_OFFSET
        {
            get
            {
                return this.TxTRIM_OFFSET_;
            }
            set
            {
                this.TxTRIM_OFFSET_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public Byte TxTRIM_GAIN
        {
            get
            {
                return this.TxTRIM_GAIN_;
            }
            set
            {
                this.TxTRIM_GAIN_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public Byte TxIset
        {
            get
            {
                return this.TxIset_;
            }
            set
            {
                this.TxIset_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }



        public Byte BG_Trim
        {
            get
            {
                return this.BG_Trim_;
            }
            set
            {
                this.BG_Trim_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public Byte VGA_2GAINCode
        {
            get
            {
                return this.VGA_2GAINCode_;
            }
            set
            {
                this.VGA_2GAINCode_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }



        public Byte MX2_SEL
        {
            get
            {
                return this.MX2_SEL_;
            }
            set
            {
                this.MX2_SEL_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public Byte MX1_SEL
        {
            get
            {
                return this.MX1_SEL_;
            }
            set
            {
                this.MX1_SEL_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }

        }




        public Byte TstswA2
        {
            get
            {
                return this.TstswA2_;
            }
            set
            {
                this.TstswA2_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public Byte TstswLNA1
        {
            get
            {
                return this.TstswLNA1_;
            }
            set
            {
                this.TstswLNA1_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }

        public Byte TstswVGA2
        {
            get
            {
                return this.TstswVGA2_;
            }
            set
            {
                this.TstswVGA2_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }



        public Byte TstswVGA1
        {
            get
            {
                return this.TstswVGA1_;
            }
            set
            {
                this.TstswVGA1_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public Byte TstSDM
        {
            get
            {
                return this.TstSDM_;
            }
            set
            {
                this.TstSDM_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }



        public Byte ANASel
        {
            get
            {
                return this.ANASel_;
            }
            set
            {
                this.ANASel_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }


        public Byte VGA_1GAINCode
        {
            get
            {
                return this.VGA_1GAINCode_;
            }
            set
            {
                this.VGA_1GAINCode_ = value;

                PAOPropertiesChandedStatusMake(new PAOPropertiesChangedEventArgs(BuildDictionary()));
            }
        }

        

        public byte DATA_01, DATA_02, DATA_03, DATA_04, DATA_05, DATA_06, DATA_07, DATA_08, DATA_09, DATA_10, DATA_11, DATA_12, DATA_13, DATA_14;

        public List<double> VGAGainS = new List<double>();

        public PAOProperties() { 
           
         //Povolená data --- neposíláme všech 14B ale jen těch 6

            
            enabledData.Add(5);
            enabledData.Add(6);
            enabledData.Add(8);
            enabledData.Add(9);
            enabledData.Add(10);
            enabledData.Add(14);

            /*
            enabledData.Add(1);
            enabledData.Add(2);
            enabledData.Add(3);
            enabledData.Add(4);
            enabledData.Add(5);
            enabledData.Add(6);
            enabledData.Add(7);
            enabledData.Add(8);
            enabledData.Add(9);
            enabledData.Add(10);
            enabledData.Add(11);
            enabledData.Add(12);
            enabledData.Add(13);
            enabledData.Add(14);
            */

            //Inicializace proměnných 

                this.Imax350mA_ENA_ = false;
                this.TxCLP_ = false;
                this.Test_VBG_ENA_ = false;
                this.CLP_OFF_ = false;
                this.SERVO_ENAS1_ = true;
                this.SDBUFp5dB_ = false;
                this.SERVO_ENAS2_ = true;
                this.VREF1V2_ = true;
                this.OFF_DIS_ = true;
                this.OFF_SIGN_ = false;
                this.MXx_OUT_ENA_ = false;
                this.POR_Test_Ena_ = false;
                this.POR_TST_IN_TMA_ = false;
                this.TstBuff_Pass_ = false;
                this.Tx_TST_SEL1_ = false;
                this.Tx_TST_SEL2_ = false;
                this.Tx_TST_SEL3_ = false;
                this.Tx_TST_SEL4_ = false;
                this.PDS1_ = false;
                this.PDS2_ = false;
                this.PDVGA1_ = false;
                this.PDVGA2_ = false;
                this.PD_BUF_ = false;
                this.PD_SDM_ = false;
                this.PD_AGND_ = false;
                this.TxPD_ = false;
                this.PD_POR_ = false;
                this.PD_VBG_ = false;
                this.PD_LDR_ = false;
                this.PD_BIA3_ = false;
                this.PD_BIAS_ = false;
                this.PD_VREF_ = false;
                this.PD_TstBuf_ = false;
                this.PD_LIN_ = false;
                this.SEL_LIN_ver_ = true;
                this.SWVGAA2_A_ = false;
                this.SWVGAA2_S_ = false;
                this.SWLNA_VGA_A_ = false;
                this.SWLNA_VGA_S_ = true;
                this.SWgmTIA1_A_ = true;
                this.SWgmTIA1_S_ = false;

            
                this.TxTRIM_OFFSET_ = 0x00;
                this.TxTRIM_GAIN_ = 0x00;
                this.TxIset_ = 0x00;
                this.BG_Trim_ = 0x00;
                this.VGA_2GAINCode_ = 0x00;
                this.VGA_1GAINCode_ = 0x00;
                this.MX2_SEL_ = 0x00;
                this.MX1_SEL_ = 0x00;
                this.TstswA2_ = 0x00;
                this.TstswLNA1_ = 0x00;
                this.TstswVGA2_ = 0x00;
                this.TstswVGA1_ = 0x00;
                this.TstSDM_ = 0x00;
                this.ANASel_ = 0x00;
            
            
                this.DATA_01 = 0x00;
                this.DATA_02 = 0x00;
                this.DATA_03 = 0x00;
                this.DATA_04 = 0x00;
                this.DATA_05 = 0x00;
                this.DATA_06 = 0x00;
                this.DATA_07 = 0x00;
                this.DATA_08 = 0x00;
                this.DATA_09 = 0x00;
                this.DATA_10 = 0x00;
                this.DATA_11 = 0x00;
                this.DATA_12 = 0x00;
                this.DATA_13 = 0x00;
                this.DATA_14 = 0x00;

                VGAGainS.Capacity = 63;

                VGAGainS.Add(-10);
                VGAGainS.Add(-9.524);
                VGAGainS.Add(-9.048);
                VGAGainS.Add(-8.572);
                VGAGainS.Add(-8.096);
                VGAGainS.Add(-7.620);
                VGAGainS.Add(-7.144);
                VGAGainS.Add(-6.668);
                VGAGainS.Add(-6.192);
                VGAGainS.Add(-5.716);
                VGAGainS.Add(-5.240);
                VGAGainS.Add(-4.764);
                VGAGainS.Add(-4.228);
                VGAGainS.Add(-3.812);
                VGAGainS.Add(-3.336);
                VGAGainS.Add(-2.860);
                VGAGainS.Add(-2.384);
                VGAGainS.Add(-1.190);
                VGAGainS.Add(-1.432);
                VGAGainS.Add(-0.956);
                VGAGainS.Add(-0.480);
                VGAGainS.Add(-0.004);
                VGAGainS.Add(0.472);
                VGAGainS.Add(0.948);
                VGAGainS.Add(1.424);
                VGAGainS.Add(1.900);
                VGAGainS.Add(2.376);
                VGAGainS.Add(2.852);
                VGAGainS.Add(3.328);
                VGAGainS.Add(3.804);
                VGAGainS.Add(4.280);
                VGAGainS.Add(4.756);
                VGAGainS.Add(5.232);
                VGAGainS.Add(5.708);
                VGAGainS.Add(6.184);
                VGAGainS.Add(6.660);
                VGAGainS.Add(7.136);
                VGAGainS.Add(7.612);
                VGAGainS.Add(8.088);
                VGAGainS.Add(8.564);
                VGAGainS.Add(9.040);
                VGAGainS.Add(9.516);
                VGAGainS.Add(9.992);
                VGAGainS.Add(10.486);
                VGAGainS.Add(10.944);
                VGAGainS.Add(11.420);
                VGAGainS.Add(11.896);
                VGAGainS.Add(12.372);
                VGAGainS.Add(12.848);
                VGAGainS.Add(13.324);
                VGAGainS.Add(13.800);
                VGAGainS.Add(14.276);
                VGAGainS.Add(14.752);
                VGAGainS.Add(15.228);
                VGAGainS.Add(15.704);
                VGAGainS.Add(16.180);
                VGAGainS.Add(16.656);
                VGAGainS.Add(17.132);
                VGAGainS.Add(17.608);
                VGAGainS.Add(18.084);
                VGAGainS.Add(18.560);
                VGAGainS.Add(19.036);
                VGAGainS.Add(19.512);
                VGAGainS.Add(19.998);

                //spínače v pořadí { ...} = [g,d,c,b,a]
                muxcombtobyte.Add(0x00, ConvertBitsToByte(new List<bool>(new bool[] { true, true, false, false, false })));
                muxcombtobyte.Add(0x01, ConvertBitsToByte(new List<bool>(new bool[] { false, true, false, false, true })));
                muxcombtobyte.Add(0x02, ConvertBitsToByte(new List<bool>(new bool[] { false, true, false, true, false })));
                muxcombtobyte.Add(0x03, ConvertBitsToByte(new List<bool>(new bool[] { false, true, false, true, true })));
                muxcombtobyte.Add(0x04, ConvertBitsToByte(new List<bool>(new bool[] { false, true, true, false, false })));
                muxcombtobyte.Add(0x05, ConvertBitsToByte(new List<bool>(new bool[] { false, true, true, false, true })));
                muxcombtobyte.Add(0x06, ConvertBitsToByte(new List<bool>(new bool[] { false, true, true, true, false })));
                muxcombtobyte.Add(0x07, ConvertBitsToByte(new List<bool>(new bool[] { false, true, true, true, true })));
                muxcombtobyte.Add(0x08, ConvertBitsToByte(new List<bool>(new bool[] { true, false, false, false, false })));
                muxcombtobyte.Add(0x09, ConvertBitsToByte(new List<bool>(new bool[] { false, false, false, false, true })));
                muxcombtobyte.Add(0x0A, ConvertBitsToByte(new List<bool>(new bool[] { false, false, false, true, false })));
                muxcombtobyte.Add(0x0B, ConvertBitsToByte(new List<bool>(new bool[] { false, false, false, true, true })));
                muxcombtobyte.Add(0x0C, ConvertBitsToByte(new List<bool>(new bool[] { false, false, true, false, false })));
                muxcombtobyte.Add(0x0D, ConvertBitsToByte(new List<bool>(new bool[] { false, false, true, false, true })));
                muxcombtobyte.Add(0x0E, ConvertBitsToByte(new List<bool>(new bool[] { false, false, true, true, false })));
                muxcombtobyte.Add(0x0F, ConvertBitsToByte(new List<bool>(new bool[] { false, false, true, true, true })));



            }

            public void Dictionary2Properties(Dictionary<Byte,Byte> slovnik){

                this.DATA_01 = slovnik[(byte)1];
                this.DATA_02 = slovnik[(byte)2];
                this.DATA_03 = slovnik[(byte)3];        
                this.DATA_04 = slovnik[(byte)4];
                this.DATA_05 = slovnik[(byte)5];
                this.DATA_06 = slovnik[(byte)6];
                this.DATA_07 = slovnik[(byte)7];
                this.DATA_08 = slovnik[(byte)8];
                this.DATA_09 = slovnik[(byte)9];
                this.DATA_10 = slovnik[(byte)10];
                this.DATA_11 = slovnik[(byte)11];
                this.DATA_12 = slovnik[(byte)12];
                this.DATA_13 = slovnik[(byte)13];
                this.DATA_14 = slovnik[(byte)14];


                this.Imax350mA_ENA_ = GetSingleBitFromByte(DATA_01, 6);
                this.TxCLP_ = GetSingleBitFromByte(DATA_01, 5);
                this.Test_VBG_ENA_ = GetSingleBitFromByte(DATA_04, 5);
                this.CLP_OFF_ = GetSingleBitFromByte(DATA_05, 7);
                this.SERVO_ENAS1_ = GetSingleBitFromByte(DATA_05, 6);
                this.SDBUFp5dB_ =  GetSingleBitFromByte(DATA_06, 7);
                this.SERVO_ENAS2_ = GetSingleBitFromByte(DATA_06, 6);
                this.VREF1V2_ = GetSingleBitFromByte(DATA_07, 7);
                this.OFF_DIS_ = GetSingleBitFromByte(DATA_07, 6);
                this.OFF_SIGN_ = GetSingleBitFromByte(DATA_07, 5);
                this.MXx_OUT_ENA_ = GetSingleBitFromByte(DATA_07, 4);
                this.POR_Test_Ena_ = GetSingleBitFromByte(DATA_10, 6);
                this.POR_TST_IN_TMA_ = GetSingleBitFromByte(DATA_10, 5);
                this.TstBuff_Pass_ = GetSingleBitFromByte(DATA_10, 4);
                this.Tx_TST_SEL1_ = GetSingleBitFromByte(DATA_11, 6);
                this.Tx_TST_SEL2_ = GetSingleBitFromByte(DATA_11, 5);
                this.Tx_TST_SEL3_ = GetSingleBitFromByte(DATA_11, 4);
                this.Tx_TST_SEL4_ = GetSingleBitFromByte(DATA_11, 3);
                this.PDS1_ = GetSingleBitFromByte(DATA_12, 6);
                this.PDS2_ = GetSingleBitFromByte(DATA_12, 5);
                this.PDVGA1_ = GetSingleBitFromByte(DATA_12, 4);
                this.PDVGA2_ = GetSingleBitFromByte(DATA_12, 3);
                this.PD_BUF_ = GetSingleBitFromByte(DATA_12, 2);
                this.PD_SDM_ = GetSingleBitFromByte(DATA_12, 1);
                this.PD_AGND_ = GetSingleBitFromByte(DATA_12, 0);
                this.TxPD_ = GetSingleBitFromByte(DATA_13, 7);
                this.PD_POR_ = GetSingleBitFromByte(DATA_13, 6);
                this.PD_VBG_ = GetSingleBitFromByte(DATA_13, 5);
                this.PD_LDR_ = GetSingleBitFromByte(DATA_13, 4);
                this.PD_BIA3_ = GetSingleBitFromByte(DATA_13, 3);
                this.PD_BIAS_ = GetSingleBitFromByte(DATA_13, 2);
                this.PD_VREF_ = GetSingleBitFromByte(DATA_13, 1);
                this.PD_TstBuf_ = GetSingleBitFromByte(DATA_13, 0);
                this.PD_LIN_ = GetSingleBitFromByte(DATA_14, 7);
                this.SEL_LIN_ver_ = GetSingleBitFromByte(DATA_14, 6);
                this.SWVGAA2_A_ = GetSingleBitFromByte(DATA_14, 5);
                this.SWVGAA2_S_ = GetSingleBitFromByte(DATA_14, 4);
                this.SWLNA_VGA_A_ = GetSingleBitFromByte(DATA_14, 3);
                this.SWLNA_VGA_S_ = GetSingleBitFromByte(DATA_14, 2);
                this.SWgmTIA1_A_ = GetSingleBitFromByte(DATA_14, 1);
                this.SWgmTIA1_S_ = GetSingleBitFromByte(DATA_14, 0);


                this.TxTRIM_OFFSET_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_01, 0), GetSingleBitFromByte(DATA_01, 1), GetSingleBitFromByte(DATA_01, 2), GetSingleBitFromByte(DATA_01, 3), GetSingleBitFromByte(DATA_01, 4), false, false, false }));
                this.TxTRIM_GAIN_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_02, 0), GetSingleBitFromByte(DATA_02, 1), GetSingleBitFromByte(DATA_02, 2), GetSingleBitFromByte(DATA_02, 3), GetSingleBitFromByte(DATA_02, 4), false, false, false }));
                this.TxIset_ = DATA_03;
                this.BG_Trim_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_04, 0), GetSingleBitFromByte(DATA_04, 1), GetSingleBitFromByte(DATA_04, 2), GetSingleBitFromByte(DATA_04, 3), GetSingleBitFromByte(DATA_04, 4), false, false, false }));
                this.VGA_1GAINCode_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_05, 0), GetSingleBitFromByte(DATA_05, 1), GetSingleBitFromByte(DATA_05, 2), GetSingleBitFromByte(DATA_05, 3), GetSingleBitFromByte(DATA_05, 4), GetSingleBitFromByte(DATA_05, 5), false, false }));
                this.VGA_2GAINCode_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_06, 0), GetSingleBitFromByte(DATA_06, 1), GetSingleBitFromByte(DATA_06, 2), GetSingleBitFromByte(DATA_06, 3), GetSingleBitFromByte(DATA_06, 4), GetSingleBitFromByte(DATA_06, 5), false, false }));
                this.MX2_SEL_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_07, 2), GetSingleBitFromByte(DATA_07, 3), false, false, false, false, false, false }));
                this.MX1_SEL_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_07, 0), GetSingleBitFromByte(DATA_07, 1), false, false, false, false, false, false }));
                this.TstswA2_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_08, 4), GetSingleBitFromByte(DATA_08, 5), GetSingleBitFromByte(DATA_08, 6), GetSingleBitFromByte(DATA_08, 7), false, false, false, false }));
                this.TstswLNA1_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_08, 0), GetSingleBitFromByte(DATA_08, 1), GetSingleBitFromByte(DATA_08, 2), GetSingleBitFromByte(DATA_08, 3), false, false, false, false }));
                this.TstswVGA2_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_09, 4), GetSingleBitFromByte(DATA_09, 5), GetSingleBitFromByte(DATA_09, 6), GetSingleBitFromByte(DATA_09, 7), false, false, false, false }));
                this.TstswVGA1_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_09, 0), GetSingleBitFromByte(DATA_09, 1), GetSingleBitFromByte(DATA_09, 2), GetSingleBitFromByte(DATA_09, 3), false, false, false, false }));
                this.TstSDM_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_10, 0), GetSingleBitFromByte(DATA_10, 1), GetSingleBitFromByte(DATA_10, 2), GetSingleBitFromByte(DATA_10, 3), false, false, false, false }));
                this.ANASel_ = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(DATA_11, 0), GetSingleBitFromByte(DATA_11, 1), GetSingleBitFromByte(DATA_11, 2), false, false, false, false, false }));
        
            }

            private Byte CropByteToRequestedScale(Byte value, int scale) {

                List<Byte> CropScaleMask = new List<byte>();

                CropScaleMask.Add(0x00);
                CropScaleMask.Add(0x01);
                CropScaleMask.Add(0x03);
                CropScaleMask.Add(0x07);
                CropScaleMask.Add(0x0F);
                CropScaleMask.Add(0x1F);
                CropScaleMask.Add(0x3F);
                CropScaleMask.Add(0x7F);
                CropScaleMask.Add(0xFF);

               Byte returnB = ((Byte)((int)value & CropScaleMask[scale]));

               return returnB;
            }

            //new byte{b0,b1,b2,b3,b4,b5,b6,b7}
            public byte ConvertBitsToByte(List<bool> bitList)
            {
                byte resultByte = 0;

                for (byte i = 0; i < bitList.Count; i++)
                {
                    if (bitList[i] == true) { 
                        resultByte |= (byte)(1 << i);
                    }
                }

                return resultByte;
            }


            //Výstup je číslován 0-7 (pro 8 bitů)
            public bool GetSingleBitFromByte(byte SingleByte, int SearchedbitNumber)
            {
                return (SingleByte & (1 << SearchedbitNumber)) != 0;
            }

            public String ConvertByteToStrAndCrop(int numberval, int cropint){
        
            String res = "";

            String[] zbytky = new String[8]; 

            for(int k=0; k<8; k++){

                int c = numberval % 2;
                if (c == 1)
                {

                    zbytky[k] = "1";

                }
                else {

                    zbytky[k] = "0";
            
                }

                numberval /= 2;  

            }

            for (int j = 7; j >-1; j--) {

                if (j < cropint) { 
            
                    res+=zbytky[j];
            
                }
        
            }
        
        
            return res;
            }
            

            public bool MuxSwCombinationToSettingByte(String WhatMUX, bool swa, bool swb, bool swc, bool swd,bool swg) {

           
                bool enabledcomb = false;

                byte swcomb = ConvertBitsToByte(new List<bool>(new bool[] { swg,swd,swc,swb,swa}));

                if (WhatMUX == "1") {

                    if (muxcombtobyte.ContainsValue(swcomb)) {
                        for (byte i = 0x00; i <= 0x0F; i++) {
                            if (muxcombtobyte[i] == swcomb) {
                                TstswLNA1 = i;
                                enabledcomb = true;
                                break;
                            }
                        }
                    }

            
                }

                if (WhatMUX == "2")
                {

                    if (muxcombtobyte.ContainsValue(swcomb))
                    {
                        for (byte i = 0x00; i <= 0x0F; i++)
                        {
                            if (muxcombtobyte[i] == swcomb)
                            {
                                TstswVGA1 = i;
                                enabledcomb = true;
                                break;
                            }
                        }
                    }


                }

                if (WhatMUX == "3")
                {

                    if (muxcombtobyte.ContainsValue(swcomb))
                    {
                        for (byte i = 0x00; i <= 0x0F; i++)
                        {
                            if (muxcombtobyte[i] == swcomb)
                            {
                                TstswVGA2 = i;
                                enabledcomb = true;
                                break;
                            }
                        }
                    }


                }

                if (WhatMUX == "4")
                {

                    if (muxcombtobyte.ContainsValue(swcomb))
                    {
                        for (byte i = 0x00; i <= 0x0F; i++)
                        {
                            if (muxcombtobyte[i] == swcomb)
                            {
                                TstswA2 = i;
                                enabledcomb = true;
                                break;
                            }
                        }
                    }


                }

                if (WhatMUX == "5")
                {

                    if (muxcombtobyte.ContainsValue(swcomb))
                    {
                        for (byte i = 0x00; i <= 0x0F; i++)
                        {
                            if (muxcombtobyte[i] == swcomb)
                            {
                                TstSDM = i;
                                enabledcomb = true;
                                break;
                            }
                        }
                    }


                }

                return enabledcomb;

            }

            public MuxSettingsByteToSwitch MuxCombToSw(byte comb) {

                MuxSettingsByteToSwitch c = new MuxSettingsByteToSwitch(GetSingleBitFromByte(muxcombtobyte[comb], 4), GetSingleBitFromByte(muxcombtobyte[comb], 3), GetSingleBitFromByte(muxcombtobyte[comb], 2), GetSingleBitFromByte(muxcombtobyte[comb], 1), GetSingleBitFromByte(muxcombtobyte[comb], 0));
           
    
            return c;
            }



            public bool[] BitValuesByNames;
            public string[] ByteValuesByNames;
            public String[] BitValNames;
            public String[] ByteValNames;

            private Dictionary<Byte, Byte> BuildDictionary() {

                Dictionary<Byte, Byte> build = new Dictionary<Byte, Byte>();


                //Používáme jen některé .... z 14 pouze 6 B
                if (alotpropertiestothumbinals_ == true)
                {

                    //Ne všechny budou potřeba ;-) .... pouze těch z nastavovaných 6B

                    BitValNames = new String[] {"Imax350mA_ENA","TxCLP","Test_VBG_ENA","CLP_OFF","SERVO_ENAS1",
           "SDBUFp5dB",
            "SERVO_ENAS2",
            "VREF1V2",
            "OFF_DIS",
            "OFF_SIGN",
            "MXx_OUT_ENA",
            "POR_Test_Ena",
            "POR_TST_IN_TMA",
            "TstBuff_Pass",
            "Tx_TST_SEL1",
            "Tx_TST_SEL2",
            "Tx_TST_SEL3",
            "Tx_TST_SEL4",
            "PDS1",
            "PDS2",
            "PDVGA1",
            "PDVGA2",
            "PD_BUF",
            "PD_SDM",
            "PD_AGND",
            "TxPD",
            "PD_POR",
            "PD_VBG",
            "PD_LDR",
            "PD_BIA3",
            "PD_BIAS",
            "PD_VREF",
            "PD_TstBuf",
            "PD_LIN",
            "SEL_LIN_ver",
            "SWVGAA2_A",
            "SWVGAA2_S",
            "SWLNA_VGA_A",
           "SWLNA_VGA_S",
           "SWgmTIA1_A",
           "SWgmTIA1_S" };


                    ByteValNames = new String[]{      "TxTRIM_OFFSET",
            "TxTRIM_GAIN",
            "TxIset",
            "BG_Trim",
            "VGA_2GAINCode",
            "VGA_1GAINCode",
           "MX2_SEL",
            "MX1_SEL",
            "TstswA2",
            "TstswLNA1",
           "TstswVGA2",
           "TstswVGA1",
           "TstSDM",
           "ANASel"};

       


                    BitValuesByNames = new bool[] {this.Imax350mA_ENA_,TxCLP_,this.Test_VBG_ENA_,this.CLP_OFF_,this.SERVO_ENAS1_,
               this.SDBUFp5dB_,
                this.SERVO_ENAS2_,
                this.VREF1V2_,
                this.OFF_DIS_,
                this.OFF_SIGN_,
                this.MXx_OUT_ENA_,
               this.POR_Test_Ena_,
                this.POR_TST_IN_TMA_,
                this.TstBuff_Pass_,
                this.Tx_TST_SEL1_,
                this.Tx_TST_SEL2_,
               this.Tx_TST_SEL3_,
                this.Tx_TST_SEL4_,
                this.PDS1_,
                this.PDS2_,
                this.PDVGA1_,
                this.PDVGA2_,
                this.PD_BUF_,
                this.PD_SDM_,
                this.PD_AGND_,
                this.TxPD_,
                this.PD_POR_,
                this.PD_VBG_,
                this.PD_LDR_,
                this.PD_BIA3_,
                this.PD_BIAS_,
                this.PD_VREF_,
                this.PD_TstBuf_,
                this.PD_LIN_,
                this.SEL_LIN_ver_,
                this.SWVGAA2_A_,
                this.SWVGAA2_S_,
                this.SWLNA_VGA_A_,
               this.SWLNA_VGA_S_,
               this.SWgmTIA1_A_,
               this.SWgmTIA1_S };

                    ByteValuesByNames = new String[]{      ConvertByteToStrAndCrop((int)this.TxTRIM_OFFSET_,5),
                 ConvertByteToStrAndCrop((int)this.TxTRIM_GAIN_,5),
                 ConvertByteToStrAndCrop((int)this.TxIset_,8),
                 ConvertByteToStrAndCrop((int)this.BG_Trim_,5),
                 ConvertByteToStrAndCrop((int)this.VGA_2GAINCode_,6),
                 ConvertByteToStrAndCrop((int)this.VGA_1GAINCode_,6),
                ConvertByteToStrAndCrop((int)this.MX2_SEL_,2),
                 ConvertByteToStrAndCrop((int)this.MX1_SEL_,2),
                 ConvertByteToStrAndCrop((int)this.TstswA2_,4),
             
                 ConvertByteToStrAndCrop((int)this.TstswLNA1_,4),
            
                 ConvertByteToStrAndCrop((int)this.TstswVGA2_,4),
                ConvertByteToStrAndCrop((int)this.TstswVGA1_,4),
                ConvertByteToStrAndCrop((int)this.TstSDM_,4),
                ConvertByteToStrAndCrop((int)this.ANASel,3)};

                }
                else
                {

                    //Použijeme tyto ::::

            BitValNames = new String[] {"SERVO_ENAS1",
           "SDBUFp5dB",
            "SERVO_ENAS2",
            "VREF1V2",
            "SEL_LIN_ver",
            "SWVGAA2_A",
            "SWVGAA2_S",
            "SWLNA_VGA_A",
           "SWLNA_VGA_S",
           "SWgmTIA1_A",
           "SWgmTIA1_S" };


            ByteValNames = new String[]{
            "VGA_2GAINCode",
            "VGA_1GAINCode",
            "TstswA2",
            "TstswLNA1",
           "TstswVGA2",
           "TstswVGA1",
           "TstSDM"};


                    BitValuesByNames = new bool[] {this.SERVO_ENAS1_,
           this.SDBUFp5dB_,
            this.SERVO_ENAS2_,
            this.VREF1V2_,
            this.SEL_LIN_ver_,
            this.SWVGAA2_A_,
            this.SWVGAA2_S_,
            this.SWLNA_VGA_A_,
           this.SWLNA_VGA_S_,
           this.SWgmTIA1_A_,
           this.SWgmTIA1_S };

             ByteValuesByNames = new String[]{
             ConvertByteToStrAndCrop((int)this.VGA_2GAINCode_,6),
             ConvertByteToStrAndCrop((int)this.VGA_1GAINCode_,6),
             ConvertByteToStrAndCrop((int)this.TstswA2_,4),
             ConvertByteToStrAndCrop((int)this.TstswLNA1_,4),
            
             ConvertByteToStrAndCrop((int)this.TstswVGA2_,4),
            ConvertByteToStrAndCrop((int)this.TstswVGA1_,4),
            ConvertByteToStrAndCrop((int)this.TstSDM_,4)};

                }

            this.TxTRIM_OFFSET_ = CropByteToRequestedScale(this.TxTRIM_OFFSET_, 5);
            this.TxTRIM_GAIN_ = CropByteToRequestedScale(this.TxTRIM_GAIN_, 5);
            this.TxIset_ = CropByteToRequestedScale(this.TxIset_, 8);
            this.BG_Trim_ = CropByteToRequestedScale(this.BG_Trim_, 5);
            this.VGA_1GAINCode_ = CropByteToRequestedScale(this.VGA_1GAINCode_, 6);
            this.VGA_2GAINCode_ = CropByteToRequestedScale(this.VGA_2GAINCode_, 6);
            this.MX2_SEL_ = CropByteToRequestedScale(this.MX2_SEL_, 2);
            this.MX1_SEL_ = CropByteToRequestedScale(this.MX1_SEL_, 2);
            this.TstswA2_ = CropByteToRequestedScale(this.TstswA2_, 4);
            this.TstswLNA1_ = CropByteToRequestedScale(this.TstswLNA1_, 4);
            this.TstswVGA2_ = CropByteToRequestedScale(this.TstswVGA2_, 4);
            this.TstswVGA1_ = CropByteToRequestedScale(this.TstswVGA1_, 4);
            this.TstSDM_ = CropByteToRequestedScale(this.TstSDM_, 4);
            this.ANASel_ = CropByteToRequestedScale(this.ANASel_, 3);

            this.DATA_01 = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(TxTRIM_OFFSET_, 0), GetSingleBitFromByte(TxTRIM_OFFSET_, 1), GetSingleBitFromByte(TxTRIM_OFFSET_, 2), GetSingleBitFromByte(TxTRIM_OFFSET_, 3), GetSingleBitFromByte(TxTRIM_OFFSET_, 4), TxCLP, Imax350mA_ENA_, false }));
            this.DATA_02 = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(TxTRIM_GAIN_, 0), GetSingleBitFromByte(TxTRIM_GAIN_, 1), GetSingleBitFromByte(TxTRIM_GAIN_, 2), GetSingleBitFromByte(TxTRIM_GAIN_, 3), GetSingleBitFromByte(TxTRIM_GAIN_, 4), false, false }));
            this.DATA_03 = TxIset;
            this.DATA_04 = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(BG_Trim_, 0), GetSingleBitFromByte(BG_Trim_, 1), GetSingleBitFromByte(BG_Trim_, 2), GetSingleBitFromByte(BG_Trim_, 3), GetSingleBitFromByte(BG_Trim_, 4), Test_VBG_ENA_, false, false }));
            this.DATA_05 = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(VGA_1GAINCode_, 0), GetSingleBitFromByte(VGA_1GAINCode_, 1), GetSingleBitFromByte(VGA_1GAINCode_, 2), GetSingleBitFromByte(VGA_1GAINCode_, 3), GetSingleBitFromByte(VGA_1GAINCode_, 4), GetSingleBitFromByte(VGA_1GAINCode_, 5), SERVO_ENAS1_, CLP_OFF_ }));
            this.DATA_06 = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(VGA_2GAINCode_, 0), GetSingleBitFromByte(VGA_2GAINCode_, 1), GetSingleBitFromByte(VGA_2GAINCode_, 2), GetSingleBitFromByte(VGA_2GAINCode_, 3), GetSingleBitFromByte(VGA_2GAINCode_, 4), GetSingleBitFromByte(VGA_2GAINCode_, 5), SERVO_ENAS2_, SDBUFp5dB_ }));
            this.DATA_07 = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(MX1_SEL_, 0), GetSingleBitFromByte(MX1_SEL_, 1), GetSingleBitFromByte(MX2_SEL_, 0), GetSingleBitFromByte(MX2_SEL_, 1), MXx_OUT_ENA_, OFF_SIGN_, OFF_DIS_, VREF1V2_ }));
            this.DATA_08 = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(TstswLNA1_, 0), GetSingleBitFromByte(TstswLNA1_, 1), GetSingleBitFromByte(TstswLNA1_, 2), GetSingleBitFromByte(TstswLNA1_, 3), GetSingleBitFromByte(TstswA2_, 0), GetSingleBitFromByte(TstswA2_, 1), GetSingleBitFromByte(TstswA2_, 2), GetSingleBitFromByte(TstswA2_, 3) }));
            this.DATA_09 = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(TstswVGA1_, 0), GetSingleBitFromByte(TstswVGA1_, 1), GetSingleBitFromByte(TstswVGA1_, 2), GetSingleBitFromByte(TstswVGA1_, 3), GetSingleBitFromByte(TstswVGA2_, 0), GetSingleBitFromByte(TstswVGA2_, 1), GetSingleBitFromByte(TstswVGA2_, 2), GetSingleBitFromByte(TstswVGA2_, 3) }));
            this.DATA_10 = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(TstSDM_, 0), GetSingleBitFromByte(TstSDM_, 1), GetSingleBitFromByte(TstSDM_, 2), GetSingleBitFromByte(TstSDM_, 3), TstBuff_Pass_, POR_TST_IN_TMA_, POR_Test_Ena_, false }));
            this.DATA_11 = ConvertBitsToByte(new List<bool>(new bool[] { GetSingleBitFromByte(ANASel_, 0), GetSingleBitFromByte(ANASel_, 1), GetSingleBitFromByte(ANASel_, 2), Tx_TST_SEL1_, Tx_TST_SEL2_, Tx_TST_SEL3_, Tx_TST_SEL4_, false }));
            this.DATA_12 = ConvertBitsToByte(new List<bool>(new bool[] { PD_AGND_, PD_SDM_, PD_BUF_, PDVGA2_, PDVGA1_, PDS2_, PDS1_, false }));
            this.DATA_13 = ConvertBitsToByte(new List<bool>(new bool[] { PD_TstBuf_, PD_VREF_, PD_BIAS_, PD_BIA3_, PD_LDR_, PD_VBG_, PD_POR_, TxPD_ }));
            this.DATA_14 = ConvertBitsToByte(new List<bool>(new bool[] { SWgmTIA1_S_, SWgmTIA1_A_, SWLNA_VGA_S_, SWLNA_VGA_A_, SWVGAA2_S_, SWVGAA2_A_, SEL_LIN_ver_, PD_LIN_ }));

            build.Add(0x01, DATA_01);
            build.Add(0x02, DATA_02);
            build.Add(0x03, DATA_03);
            build.Add(0x04, DATA_04);
            build.Add(0x05, DATA_05);
            build.Add(0x06, DATA_06);
            build.Add(0x07, DATA_07);
            build.Add(0x08, DATA_08);
            build.Add(0x09, DATA_09);
            build.Add(0x0A, DATA_10);
            build.Add(0x0B, DATA_11);
            build.Add(0x0C, DATA_12);
            build.Add(0x0D, DATA_13);
            build.Add(0x0E, DATA_14);

            return build;
        
        }


    }
}
