示例#1
0
 /**
  * Attempt to update logic output (enable output if pin is high-Z).
  */
 public bool Write(bool state)
 {
     if (_out != null && CTRE.Watchdog.IsEnabled())
     {
         /* since the back-end may have disabled this output, attempt to re-enable */
         _out.Active = false;
         _out.Active = true;
         /* update the output latch */
         _out.Write(state);
         return(true);
     }
     return(false);
 }
示例#2
0
        public static void Main()
        {
            TristatePort tristatePort = new TristatePort(Cpu.Pin.GPIO_Pin4,
                                                         false, //initial state
                                                         false, //no glitch filter
                                                         Port.ResistorMode.PullUp);

            Debug.Print("Port is inactive and acts as input port.");
            Debug.Print("Input = " + tristatePort.Read());

            tristatePort.Active = true;
            Debug.Print("Port is active and acts as output port.");
            tristatePort.Write(true);
        }
        public override void Write(bool state)
        {
            Mode = IOMode.Output;

            _port.Write(state);
        }