Beispiel #1
0
 protected SyntaxBase(SyntaxBase syntaxBase)
 {
     Relay = syntaxBase.Relay.ToList();
     Relay.Add(syntaxBase);
     Parameters      = syntaxBase.Parameters;
     LocalParameters = new List <string>();
     ParameterCount  = syntaxBase.ParameterCount;
 }
Beispiel #2
0
 internal void AddRelay(SyntaxBase syntax)
 {
     Relay.Add(syntax);
 }
Beispiel #3
0
        //public static List<ErrorData> ErrorList { get; } = new List<ErrorData>();

        /*
         * /// <summary>
         * /// Gets the can talon.
         * /// </summary>
         * /// <param name="id">The identifier.</param>
         * /// <returns></returns>
         * public static CanTalonData GetCanTalon(int id)
         * {
         *  CanTalonData data;
         *  bool retVal = s_canTalon.TryGetValue(id, out data);
         *  if (retVal)
         *  {
         *      //Contains key. Just return it
         *      return data;
         *  }
         *  else
         *  {
         *      //CAN Talon does not exist yet. Return null.
         *      return null;
         *  }
         * }
         *
         * /// <summary>
         * /// Initializes the can talon.
         * /// </summary>
         * /// <param name="id">The identifier.</param>
         * /// <returns></returns>
         * public static bool InitializeCanTalon(int id)
         * {
         *  CanTalonData data;
         *  bool retVal = s_canTalon.TryGetValue(id, out data);
         *  if (retVal)
         *  {
         *      //Contains key. return false saying we did not initialize a new one.
         *      return false;
         *  }
         *  else
         *  {
         *      //Create a new Can Talon data and return true.
         *      data = new CanTalonData();
         *      s_canTalon.Add(id, data);
         *      OnTalonSRXAddedOrRemoved?.Invoke(id, new TalonSRXEventArgs(true));
         *      return true;
         *  }
         * }
         *
         * /// <summary>
         * /// Removes the can talon.
         * /// </summary>
         * /// <param name="id">The identifier.</param>
         * public static void RemoveCanTalon(int id)
         * {
         *  s_canTalon.Remove(id);
         *  OnTalonSRXAddedOrRemoved?.Invoke(id, new TalonSRXEventArgs(false));
         * }
         *
         * /// <summary>
         * /// Gets the PCM.
         * /// </summary>
         * /// <param name="id">The identifier.</param>
         * /// <returns></returns>
         * public static PCMData GetPCM(int id)
         * {
         *  PCMData data;
         *  bool retVal = s_pcm.TryGetValue(id, out data);
         *  if (retVal)
         *  {
         *      //Contains key. Just return it
         *      return data;
         *  }
         *  else
         *  {
         *      data = new PCMData();
         *      s_pcm.Add(id, data);
         *      OnPCMAdded?.Invoke(data, null);
         *      return data;
         *  }
         * }
         *
         * /// <summary>
         * /// Initializes the PCM.
         * /// </summary>
         * /// <param name="id">The identifier.</param>
         * /// <returns></returns>
         * public static bool InitializePCM(int id)
         * {
         *  PCMData data;
         *  bool retVal = s_pcm.TryGetValue(id, out data);
         *  if (retVal)
         *  {
         *      //Contains key. return false saying we did not initialize a new one.
         *      return false;
         *  }
         *  else
         *  {
         *      //Create a new PCM data and return true.
         *      data = new PCMData();
         *      s_pcm.Add(id, data);
         *      OnPCMAdded?.Invoke(data, null);
         *      return true;
         *  }
         * }
         *
         * /// <summary>
         * /// Gets the PDP.
         * /// </summary>
         * /// <param name="id">The identifier.</param>
         * /// <returns></returns>
         * public static PDPData GetPDP(int id)
         * {
         *  PDPData data;
         *  bool retVal = s_pdp.TryGetValue(id, out data);
         *  if (retVal)
         *  {
         *      //Contains key. Just return it
         *      return data;
         *  }
         *  else
         *  {
         *      data = new PDPData();
         *      s_pdp.Add(id, data);
         *      OnPDPAdded?.Invoke(data, null);
         *      return data;
         *  }
         * }
         *
         * /// <summary>
         * /// Initializes a new PDP.
         * /// </summary>
         * /// <param name="id">The identifier.</param>
         * /// <returns>True if new PDP was created, otherwise false</returns>
         * public static bool InitializePDP(int id)
         * {
         *  PDPData data;
         *  bool retVal = s_pdp.TryGetValue(id, out data);
         *  if (retVal)
         *  {
         *      //Contains key. return false saying we did not initialize a new one.
         *      return false;
         *  }
         *  else
         *  {
         *      //Create a new PCM data and return true.
         *      data = new PDPData();
         *      s_pdp.Add(id, data);
         *      OnPDPAdded?.Invoke(data, null);
         *      return true;
         *  }
         * }
         *
         * /// <summary>
         * /// Occurs on talon SRX added or removed.
         * /// </summary>
         * public static event EventHandler<TalonSRXEventArgs> OnTalonSRXAddedOrRemoved;
         * /// <summary>
         * /// Occurs when a PCM is added.
         * /// </summary>
         * public static event EventHandler OnPCMAdded;
         * /// <summary>
         * /// Occurs when a PDP is added.
         * /// </summary>
         * public static event EventHandler OnPDPAdded;
         *
         */
        static SimData()
        {
            for (int i = 0; i < HAL_GetNumPCMModules(); i++)
            {
                PCM.Add(new HALSimPCMData(i));
            }

            for (int i = 0; i < HAL_GetNumPDPModules(); i++)
            {
                PDP.Add(new HALSimPDPData(i));
            }

            for (int i = 0; i < HAL_GetNumAccumulators(); i++)
            {
                AnalogGyro.Add(new HALSimAnalogGyroData(i));
            }

            for (int i = 0; i < HAL_GetNumAnalogOutputs(); i++)
            {
                AnalogOut.Add(new HALSimAnalogOutData(i));
            }

            for (int i = 0; i < HAL_GetNumAnalogInputs(); i++)
            {
                AnalogIn.Add(new HALSimAnalogInData(i));
            }

            for (int i = 0; i < HAL_GetNumAnalogTriggers(); i++)
            {
                AnalogTrigger.Add(new HALSimAnalogTriggerData(i));
            }

            for (int i = 0; i < HAL_GetNumDigitalChannels(); i++)
            {
                DIO.Add(new HALSimDIOData(i));
            }

            for (int i = 0; i < HAL_GetNumDigitalPWMOutputs(); i++)
            {
                DigitalPWM.Add(new HALSimDigitalPWMData(i));
            }

            for (int i = 0; i < 4; i++)
            {
                //DigitalGlitchFilter.Add(new DigitalGlitchFilterData());
            }

            for (int i = 0; i < HAL_GetNumPWMChannels(); i++)
            {
                PWM.Add(new HALSimPWMData(i));
            }

            for (int i = 0; i < 4; i++)
            {
                Relay.Add(new HALSimRelayData(i));
            }

            for (int i = 0; i < 8; i++)
            {
                //Counter.Add(new CounterData());
            }

            for (int i = 0; i < 8; i++)
            {
                Encoder.Add(new HALSimEncoderData(i));
            }

            for (int i = 0; i < 5; i++)
            {
                SPIAccelerometer.Add(new HALSimSPIAccelerometerData(i));
            }

            for (int i = 0; i < 5; i++)
            {
                //SPIAccumulator.Add(new SPIAccumulatorData());
            }

            //InitializePDP(0);
            //ErrorList.Clear();
        }