Techgraphix
New member
To make a long story short: i have a fingerprint-sensor attached to my Teensy 3.2.. When i touch it with a finger (ID 1) it will print a string (a password for instance) as a keyboard to my PC.
To upload the code i set Tools>USB Type: to keyboard.
It works, but unlike a normal keyboard there is no energy-tab (tab Energiebeheer) in the properties (device management - HID-keyboard > properties..) When i look in the details>energydata i miss PDCAP_WAKE FROM_D2_SUPPORTED:
A normal keyboard shows this:
Also in powercfg it is not in a list that shows it can wake my PC from Hibernate (ie D2)
I guess somewhere in the compilation my Teensy get this settings (flags?) but where exactly i could add this PDCAP_WAKE_FROM_D2_SUPPORTED so when i touch the sensor with the right finger, my pc will wake from hibernate
Code:
#include <Bounce.h>
#include <Adafruit_Fingerprint.h>
#define mySerial Serial1
bool wait = true;
int sw = 2;
Bounce swBounced = Bounce(sw, 10);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
void setup()
{ pinMode(sw, INPUT_PULLUP);
digitalWrite(sw, HIGH);
finger.begin(57600);
delay(5);
finger.getParameters();
finger.getTemplateCount();
}
void loop() {
getFingerprintID();
delay(50); //don't ned to run this at full speed.
}
uint8_t getFingerprintID() {
uint8_t p = finger.getImage();
switch (p) {
case FINGERPRINT_NOFINGER:
if (wait) {
finger.LEDcontrol(FINGERPRINT_LED_BREATHING, 500, FINGERPRINT_LED_PURPLE);
wait = false;
}
return p;
case FINGERPRINT_PACKETRECIEVEERR:
return p;
case FINGERPRINT_IMAGEFAIL:
return p;
default:
return p;
}
p = finger.image2Tz();
switch (p) {
case FINGERPRINT_OK:
break;
case FINGERPRINT_IMAGEMESS:
return p;
case FINGERPRINT_PACKETRECIEVEERR:
return p;
case FINGERPRINT_FEATUREFAIL:
return p;
case FINGERPRINT_INVALIDIMAGE:
return p;
default:
return p;
}
// OK converted!
p = finger.fingerSearch();
if (p == FINGERPRINT_OK) {
finger.LEDcontrol(FINGERPRINT_LED_FLASHING, 25, FINGERPRINT_LED_BLUE, 10);
wait = true;
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
return p;
} else if (p == FINGERPRINT_NOTFOUND) {
finger.LEDcontrol(FINGERPRINT_LED_ON, 0, FINGERPRINT_LED_RED);
wait = true;
return p;
} else {
return p;
}
// found a match!
if (finger.fingerID == 1)Keyboard.print("This is where my password is\n ");
return finger.fingerID;
}
// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK) return -1;
p = finger.image2Tz();
if (p != FINGERPRINT_OK) return -1;
p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;
return finger.fingerID;
}
To upload the code i set Tools>USB Type: to keyboard.
It works, but unlike a normal keyboard there is no energy-tab (tab Energiebeheer) in the properties (device management - HID-keyboard > properties..) When i look in the details>energydata i miss PDCAP_WAKE FROM_D2_SUPPORTED:
A normal keyboard shows this:
Also in powercfg it is not in a list that shows it can wake my PC from Hibernate (ie D2)
I guess somewhere in the compilation my Teensy get this settings (flags?) but where exactly i could add this PDCAP_WAKE_FROM_D2_SUPPORTED so when i touch the sensor with the right finger, my pc will wake from hibernate