未验证 提交 0bd54a20 编写于 作者: P Patrick Grawehr 提交者: GitHub

Add ! operator to PinValue (#1246)

* Add ! operator to PinValue

* Use shorter form of implementation
Co-authored-by: NKrzysztof Wicher <mordotymoja@gmail.com>
Co-authored-by: NKrzysztof Wicher <mordotymoja@gmail.com>
上级 022f40fe
......@@ -81,6 +81,13 @@ namespace System.Device.Gpio
/// </summary>
public static bool operator !=(PinValue a, PinValue b) => !a.Equals(b);
/// <summary>
/// Returns the inverse of the value
/// </summary>
/// <param name="v">Input value</param>
/// <returns>High, when the input is low, low when the input is high</returns>
public static PinValue operator !(PinValue v) => (v._value == 0) ? High : Low;
/// <inheritdoc />
public override int GetHashCode() => _value.GetHashCode();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册