Exemple #1
0
 public Connector(String name, Enums.ConnectorType type, String[] directions)
 {
     Name       = name;
     Type       = type;
     Directions = new List <PinPort>();
     for (int i = 0; i < directions.Length; i++)
     {
         Directions.Add(new PinPort(i.ToString(), directions[i], type));
     }
     ConnectorEvent = new List <BasicEvent>();
 }
Exemple #2
0
        public void AddConnector(String name, Enums.ConnectorType type, String[] directions)
        {
            foreach (String dir in directions)
            {
                if (!ShieldBase.IsConnectable(dir, type))
                {
                    throw new Exception("El tipo de conector no es compatible en esa direccion del micro");
                }
            }

            Connectors.Add(new Connector(name, type, directions));
        }
Exemple #3
0
 public bool IsConnectable(String portPin, Enums.ConnectorType type)
 {
     if (!IsAvailabe(portPin))
     {
         return(false);
     }
     if (type == Enums.ConnectorType.PWMTTL && !IsPWM(portPin))
     {
         return(false);
     }
     if (type == Enums.ConnectorType.Analog && !IsAnalog(portPin))
     {
         return(false);
     }
     return(true);
 }
Exemple #4
0
        public PinPort(String id, String direction, Enums.ConnectorType type)
        {
            Name      = id;
            Port      = direction[0];
            Pin       = Byte.Parse(direction[1].ToString());
            PinEvents = new List <BasicEvent>();
            Output    = DEFAULT_OUTPUT;
            Digital   = DEFAULT_DIGITAL;

            switch (type)
            {
            case Enums.ConnectorType.SwitchHI:
            case Enums.ConnectorType.SwitchLOW:
            case Enums.ConnectorType.IODigital:
            case Enums.ConnectorType.Dimmer:
                Output        = true;
                Digital       = true;
                DefaultValueD = true;
                break;

            case Enums.ConnectorType.PWMTTL:
                Output        = true;
                Digital       = false;
                DefaultValueA = 123;
                break;

            case Enums.ConnectorType.Analog:
                Output    = false;
                Digital   = false;
                Increment = 24;
                Threshold = 128;
                break;

            default:
                throw new Exception("no implementado este tipo de conector");
            }
        }