Add Waked event and Wake command
This commit is contained in:
@@ -19,10 +19,9 @@ namespace WaveshareUARTFingerprintSensor.Sample
|
||||
|
||||
sensor.Start();
|
||||
|
||||
if (sensor.TryGetUserCount(out ushort count))
|
||||
{
|
||||
Console.WriteLine(count);
|
||||
}
|
||||
sensor.Waked += s => sensor.Wake();
|
||||
|
||||
sensor.Sleep();
|
||||
|
||||
Console.WriteLine("End");
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace WaveshareUARTFingerprintSensor
|
||||
public const string SecondarySerialPort = "/dev/ttyS0";
|
||||
public const int DefaultTimeout = 10_000;
|
||||
|
||||
public event Action<FingerprintSensor> Waked;
|
||||
|
||||
public string PortName { get; }
|
||||
|
||||
private const byte PacketSeparator = 0xF5;
|
||||
@@ -169,11 +171,16 @@ namespace WaveshareUARTFingerprintSensor
|
||||
_rstPin.Write(GpioPinValue.Low);
|
||||
}
|
||||
|
||||
public void Wake()
|
||||
{
|
||||
_rstPin.Write(GpioPinValue.High);
|
||||
}
|
||||
|
||||
private void OnWake()
|
||||
{
|
||||
if (_wakePin.Read())
|
||||
{
|
||||
Console.WriteLine("Sensor WAKE signal received");
|
||||
Waked?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user