public void Out(byte data) { lock (apilock) { if (DataMode == IODirection.Input) { DataMode = IODirection.Output; } Inpout.Output8((ushort)dataaddress, data); } }
public byte In() { lock (apilock) { if (DataMode == IODirection.Output) { DataMode = IODirection.Input; } return(Inpout.Input8((ushort)dataaddress)); } }
/// <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] }); }
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); }
public ParallelPort(int dataaddress = 0xB010, IODirection datamode = IODirection.Output) { DataAddress = dataaddress; DataMode = datamode; }
public IOSettings(SerializationInfo info, StreamingContext ctxt) { Direction = (IODirection)info.GetValue("Direction", typeof(int)); }