mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-25 09:16:41 +00:00
Port of EightBit library to .Net (unworking!)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
namespace EightBit
|
||||
{
|
||||
using System;
|
||||
|
||||
public class Device
|
||||
{
|
||||
private PinLevel powerLine;
|
||||
|
||||
protected Device() { }
|
||||
|
||||
public event EventHandler<EventArgs> RaisingPOWER;
|
||||
public event EventHandler<EventArgs> RaisedPOWER;
|
||||
public event EventHandler<EventArgs> LoweringPOWER;
|
||||
public event EventHandler<EventArgs> LoweredPOWER;
|
||||
|
||||
public ref PinLevel POWER() { return ref powerLine; }
|
||||
|
||||
public bool Powered => POWER().Raised();
|
||||
|
||||
public virtual void RaisePOWER()
|
||||
{
|
||||
OnRaisingPOWER();
|
||||
POWER().Raise();
|
||||
OnRaisedPOWER();
|
||||
}
|
||||
|
||||
public virtual void LowerPOWER()
|
||||
{
|
||||
OnLoweringPOWER();
|
||||
POWER().Lower();
|
||||
OnLoweredPOWER();
|
||||
}
|
||||
|
||||
protected virtual void OnRaisingPOWER() => RaisingPOWER?.Invoke(this, EventArgs.Empty);
|
||||
protected virtual void OnRaisedPOWER() => RaisedPOWER?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnLoweringPOWER() => LoweringPOWER?.Invoke(this, EventArgs.Empty);
|
||||
protected virtual void OnLoweredPOWER() => LoweredPOWER?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user