Exemplo n.º 1
0
 public void Out(byte data)
 {
     lock (apilock)
     {
         if (DataMode == IODirection.Input)
         {
             DataMode = IODirection.Output;
         }
         Inpout.Output8((ushort)dataaddress, data);
     }
 }
Exemplo n.º 2
0
 public byte In()
 {
     lock (apilock)
     {
         if (DataMode == IODirection.Output)
         {
             DataMode = IODirection.Input;
         }
         return(Inpout.Input8((ushort)dataaddress));
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize the selected IO pin direction.
        /// </summary>
        /// <param name="pin">The IO pin to be configured.</param>
        /// <param name="direction">The IO pin direction.</param>
        public void InitializePin(IOPins pin, IODirection direction)
        {
            byte[] buffer = new byte[1];

            // Get all the Pins direction
            _touchController.WriteReadPartial(new byte[] { REGISTER_IO_DIR }, buffer);

            // Set the selected pin direction
            if (direction != IODirection.In)
            {
                buffer[0] |= (byte)pin;
            }
            else
            {
                buffer[0] &= (byte)(~((byte)pin));
            }

            // Write the register with the new value
            _touchController.WritePartial(new byte[] { REGISTER_IO_DIR, buffer[0] });
        }
Exemplo n.º 4
0
        internal void UpdateState(bool AITestDirection)
        {
            IODirection dir = m_channel.GetChannelDirection();

            if (AITestDirection)
            {
                //try{
                //     if (dir == IODirection.Input)
                //         m_channel.SetChannelDirection(IODirection.Output);
                //       else
                //         m_channel.SetChannelDirection(IODirection.Input);
                //     m_channel.SetChannelDirection(dir);
                // }
                //catch{
                //    checkBoxDirection.Enabled = false;
                //    if (dir == IODirection.Output)
                //        m_channel.WriteBit(State);
                //}
                if (m_channel.IsDirectionFixed())
                {
                    checkBoxDirection.Enabled = false;
                }
            }
            if (dir == IODirection.Input)
            {
                checkBoxDirection.Checked = false;
            }
            else
            {
                checkBoxDirection.Checked = true;
            }
            if (!checkBoxDirection.Checked)
            {
                State = m_channel.ReadBit();
            }
            SetUIState(State);
        }
Exemplo n.º 5
0
 public ParallelPort(int dataaddress = 0xB010, IODirection datamode = IODirection.Output)
 {
     DataAddress = dataaddress;
     DataMode    = datamode;
 }
Exemplo n.º 6
0
 public IOSettings(SerializationInfo info, StreamingContext ctxt)
 {
     Direction = (IODirection)info.GetValue("Direction", typeof(int));
 }