Exemplo n.º 1
0
 protected override void InternalUpdate(bool reset)
 {
     if (SwitchPins == 1)
     {
         if (SwitchState[0])
         {
             BreadBoardRef.LinkNodes(GetPinNode(0), GetPinNodeIndex(0), GetPinNode(2), GetPinNodeIndex(2));
             BreadBoardRef.LinkNodes(GetPinNode(5), GetPinNodeIndex(5), GetPinNode(3), GetPinNodeIndex(3));
         }
         else
         {
             BreadBoardRef.UnlinkNodes(GetPinNode(0), GetPinNodeIndex(0), GetPinNode(2), GetPinNodeIndex(2));
             BreadBoardRef.UnlinkNodes(GetPinNode(5), GetPinNodeIndex(5), GetPinNode(3), GetPinNodeIndex(3));
         }
     }
     else
     {
         for (int i = 0; i < SwitchPins / 2; i++)
         {
             if (SwitchState[SwitchState.Length - 1 - i])
             {
                 BreadBoardRef.LinkNodes(GetPinNode(i), GetPinNodeIndex(i), GetPinNode(SwitchPins - 1 - i), GetPinNodeIndex(SwitchPins - 1 - i));
             }
             else
             {
                 BreadBoardRef.UnlinkNodes(GetPinNode(i), GetPinNodeIndex(i), GetPinNode(SwitchPins - 1 - i), GetPinNodeIndex(SwitchPins - 1 - i));
             }
         }
     }
 }
Exemplo n.º 2
0
 protected override void InternalReset(bool disable)
 {
     if (disable)
     {
         if (SwitchPins == 1)
         {
             BreadBoardRef.UnlinkNodes(GetPinNode(0), GetPinNodeIndex(0), GetPinNode(2), GetPinNodeIndex(2));
             BreadBoardRef.UnlinkNodes(GetPinNode(5), GetPinNodeIndex(5), GetPinNode(3), GetPinNodeIndex(3));
         }
         else
         {
             for (int i = 0; i < SwitchPins / 2; i++)
             {
                 BreadBoardRef.UnlinkNodes(GetPinNode(i), GetPinNodeIndex(i), GetPinNode(SwitchPins - 1 - i), GetPinNodeIndex(SwitchPins - 1 - i));
             }
         }
         return;
     }
     else
     {
         InternalUpdate(true);
     }
 }