serialio.cs

来自「WJ Communications RFID example code」· CS 代码 · 共 48 行

CS
48 行
字号
//==========================================================================================
//
//	WJ.Serial.SerialIO
//	Copyright (c) 2006, WJ Communications, Inc.
//
//	When enabled by the SERIAL_MODE "Conditional Compilation Constant", this class
//	provides calls to an external "SerialIO.dll" to perform low level serial IO functions.
//
//==========================================================================================
using System;
using System.Runtime.InteropServices;

namespace WJ.Serial
{
	/// <summary>
	/// Class for calling a DLL that controls external IO lines when in Serial only mode.
	/// The Reset, Bootload lines can be set high or low, 
	///		and power to the MPR can be turned on and off.
	/// 
	/// An external "SerialIO.dll" is required to actually perform these actions.
	/// This class is only referenced when SERIAL_MODE "Conditional Compilation Constant" is defined
	/// in Project->MPR DLL Properties->Configuration Properties->Build.
	/// 
	/// </summary>
	public class SerialIO
	{
		/// <summary>
		/// Set the Reset line to 5V (true) or 0V (false)
		/// </summary>
		/// <param name="bOn"></param>
		[DllImport("SerialIO.dll", EntryPoint="SetResetLine")]
		public static extern void SetResetLine(bool bOn); 

		/// <summary>
		/// Set the BootLoad line to 5V (true) or 0V (false)
		/// </summary>
		/// <param name="bOn"></param>
		[DllImport("SerialIO.dll", EntryPoint="SetBootloadLine")]
		public static extern void SetBootloadLine(bool bOn);

		/// <summary>
		/// Set the Power line to 5V (true) or 0V (false)
		/// </summary>
		/// <param name="bOn"></param>
		[DllImport("SerialIO.dll", EntryPoint="SetPowerState")]
		public static extern void SetPowerState(bool bOn);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?