加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fingerprintWrapper.h 2.16 KB
一键复制 编辑 原始数据 按行查看 历史
80233596 提交于 2019-05-14 17:28 . Add CMD setting mode
#pragma once
#include "fingerprint.h"
#include "Keyboard.h"
#define MAX_FINGERS 20
enum FbStatus
{
ERROR_SENSOR_NOT_FOUND = -2,
SUCCESS = 0,
ERROR_NO_FINGER = -1
};
class FingerBoard
{
public:
FingerBoard(HardwareSerial* hs);
FbStatus Begin();
FbStatus Begin(Serial_* hs);
bool CmdCheck();
int GetFingerID();
bool AddFinger(unsigned int id);
void DeleteAllFingers();
void InputPassword(String pswd);
void TypeString(String s, bool enter);
void PressKey(uint8_t k);
void ReleaseAll();
private:
Serial_* debug = NULL;
HardwareSerial* sensorSerial = NULL;
Fingerprint sensor = NULL;
char comdata[256], data_p; //串口缓存数据
long time;
long INTERVAL = 200; //ms
bool isTouching = false;
String passwords[MAX_FINGERS];
volatile unsigned char FPMXX_RECEIVE_BUFFER[64];
unsigned char FPMXX_Pack_Head[6] = { 0xEF, 0x01, 0xFF, 0xFF, 0xFF, 0xFF }; //协议包头
unsigned char FPMXX_Get_Img[6] = { 0x01, 0x00, 0x03, 0x01, 0x0, 0x05 }; //获得指纹图像
unsigned char FPMXX_Save_Finger[9] = { 0x01, 0x00, 0x06, 0x06, 0x01, 0x00, 0x0B, 0x00, 0x19 }; //将BUFFER1中的特征码存放到指定的位置
unsigned char FPMXX_Search[11] = { 0x01, 0x0, 0x08, 0x04, 0x01, 0x0, 0x0, 0x03, 0xE7, 0x0, 0xF8 }; //搜索指纹搜索范围0 - 999,使用BUFFER1中的特征码搜索
unsigned char FPMXX_Get_Device[6] = { 0x01, 0x00, 0x03, 0x16, 0x00, 0x1A };
unsigned char FPMXX_Get_Templete_Count[6] = { 0x01, 0x00, 0x03, 0x1D, 0x00, 0x21 }; //获得模版总数
unsigned char FPMXX_Img_To_Buffer1[7] = { 0x01, 0x0, 0x04, 0x02, 0x01, 0x0, 0x08 }; //将图像放入到BUFFER1
unsigned char FPMXX_Img_To_Buffer2[7] = { 0x01, 0x0, 0x04, 0x02, 0x02, 0x0, 0x09 }; //将图像放入到BUFFER2
unsigned char FPMXX_Reg_Model[6] = { 0x01, 0x0, 0x03, 0x05, 0x0, 0x09 }; //将BUFFER1跟BUFFER2合成特征模版
unsigned char FPMXX_Delete_All_Model[6] = { 0x01, 0x0, 0x03, 0x0d, 0x00, 0x11 }; //删除指纹模块里所有的模版
void FPMXX_Cmd_Save_Finger(unsigned int storeID);
void FPMXX_Send_Cmd(unsigned char length, unsigned char* address, unsigned char returnLength);
void FPMXX_Cmd_Receive_Data(unsigned int r_size);
void FPMXX_Cmd_StoreTemplate(unsigned int ID);
bool FPMXX_Add_Fingerprint(unsigned int writeID);
void FPMXX_Delete_All_Fingerprint();
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化