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