中级
30 分钟

使用 GROW R503 和 ATmega328P 保护您的项目

轻松应对各种挑战

Fingerprint 3 Click with Arduino UNO Rev3

已发布 6月 24, 2024

点击板

Fingerprint 3 Click

开发板

Arduino UNO Rev3

编译器

NECTO Studio

微控制器单元

ATmega328P

创建一个高效的访问控制应用程序,该应用程序将包含一个身份验证解决方案。

A

A

硬件概览

它是如何工作的?

Fingerprint 3 Click 是一个适配器 Click board™,它简化了扩展板与 mikroBUS™ 插槽的连接。这个 Click board™ 是一个小尺寸 PCB,可以像其他 Click board™ 一样连接到 mikroBUS™ 插槽,其上有一个 1x6 1.0mm 间距的垂直型线对板连接器。每个针脚对应于 mikroBUS™ 插槽上的一个针脚,如 UART 线路(TX,RX)、3V3 电源、指纹检测信号、GROW R503 模块的环形 LED 使能和地线。这个 Click board™ 允许轻松访问和操作针脚,同时始终保持完美的连接质量。指纹处理包括两个部分:指纹录入和指纹匹配。第一步是初始化所有必要的驱动程序、外设和针脚。上电时,初始化大约需要 200 毫秒;在此期

间,模块无法接受任何命令。接下来是检查传感器并验证模块密码,如果一切正确,则开始新的指纹图案录入。用户需要输入手指两次。系统将处理两次指纹图像,根据处理结果生成指纹模板并存储模板。在匹配时,用户通过光学传感器输入指纹,系统将生成指纹模板并与指纹库中的模板进行比较。在两种情况下,系统都会返回匹配结果,成功或失败。这可以在示例代码中看到,示例代码包含易于使用的函数,可以作为进一步开发的参考。Fingerprint 3 Click 使用 UART 接口与 MCU 通信,默认波特率为 57600bps 数据传输,而这个 Click board™ 上的 GPIO 针脚用于指纹检测和环形指示灯 LED 使能。标记为 VD 的环形指示灯 

LED 可以通过切换路由到 mikroBUS™ 上 RST 针脚的信号来启用,而路由到 mikroBUS™ 上 INT 针脚的信号表示中断,并指示模块上的指纹检测。当指示灯显示紫色时,模块处于待机模式,等待手指按下。除了紫色外,模块还可以显示蓝色或红色,指示指纹匹配的正确性(蓝色表示找到匹配,红色表示未找到匹配)。这个 Click board™ 只能在 3.3V 逻辑电压水平下操作。使用不同逻辑电平的 MCU 之前,必须进行适当的逻辑电平转换。然而,Click board™ 附带一个包含函数和示例代码的库,可以作为进一步开发的参考。

Fingerprint 3 Click top side image
Fingerprint 3 Click bottom side image

功能概述

开发板

Arduino UNO 是围绕 ATmega328P 芯片构建的多功能微控制器板。它为各种项目提供了广泛的连接选项,具有 14 个数字输入/输出引脚,其中六个支持 PWM 输出,以及六个模拟输入。其核心组件包括一个 16MHz 的陶瓷谐振器、一个 USB 连接器、一个电

源插孔、一个 ICSP 头和一个复位按钮,提供了为板 子供电和编程所需的一切。UNO 可以通过 USB 连接到计算机,也可以通过 AC-to-DC 适配器或电池供电。作为第一个 USB Arduino 板,它成为 Arduino 平台的基准,"Uno" 符号化其作为系列首款产品的地

位。这个名称选择,意为意大利语中的 "一",是为了 纪念 Arduino Software(IDE)1.0 的推出。最初与 Arduino Software(IDE)版本1.0 同时推出,Uno 自此成为后续 Arduino 发布的基础模型,体现了该平台的演进。

Arduino UNO Rev3 double side image

微控制器概述 

MCU卡片 / MCU

default

建筑

AVR

MCU 内存 (KB)

32

硅供应商

Microchip

引脚数

28

RAM (字节)

2048

你完善了我!

配件

Click Shield for Arduino UNO 具有两个专有的 mikroBUS™ 插座,使所有 Click board™ 设备能够轻松与 Arduino UNO 板进行接口连接。Arduino UNO 是一款基于 ATmega328P 的微控制器开发板,为用户提供了一种经济实惠且灵活的方式来测试新概念并构建基于 ATmega328P 微控制器的原型系统,结合了性能、功耗和功能的多种配置选择。Arduino UNO 具有 14 个数字输入/输出引脚(其中 6 个可用作 PWM 输出)、6 个模拟输入、16 MHz 陶瓷谐振器(CSTCE16M0V53-R0)、USB 接口、电源插座、ICSP 头和复位按钮。大多数 ATmega328P 微控制器的引脚都连接到开发板左右两侧的 IO 引脚,然后再连接到两个 mikroBUS™ 插座。这款 Click Shield 还配备了多个开关,可执行各种功能,例如选择 mikroBUS™ 插座上模拟信号的逻辑电平,以及选择 mikroBUS™ 插座本身的逻辑电压电平。此外,用户还可以通过现有的双向电平转换电压转换器使用任何 Click board™,无论 Click board™ 运行在 3.3V 还是 5V 逻辑电压电平。一旦将 Arduino UNO 板与 Click Shield for Arduino UNO 连接,用户即可访问数百种 Click board™,并兼容 3.3V 或 5V 逻辑电压电平的设备。

Click Shield for Arduino UNO accessories 1 image

指纹传感器带双色LED环(GROW R503)是一种带有双色环指示灯的电容指纹传感器模块扫描仪。该模块设计为直径为28mm的圆形。值得一提的是,该模块集成了图像采集和算法芯片。GROW R503模块具有图像缓冲区和六个特征文件缓冲区。一个重要提示是,所有缓冲区内容在断电后不会保存。指纹图案模板可以由2-6个特征文件组成。如果复合模板具有更多的特征文件,指纹图案模板的质量会更好。该模块的外壳防尘但不防水,环形指示灯由命令控制,具有高识别率,并能灵活适应不同的手指条件,无论是干燥、潮湿,还是不同年龄的人。该模块可以连接到Fingerprint 3 Click或任何具有1.0mm间距垂直类型线对板连接器的产品,以及合适类型的通信接口。

Fingerprint 3 Click accessories image

使用的MCU引脚

mikroBUS™映射器

NC
NC
AN
Ring Indicator LED Enable
PD2
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Fingerprint Detection
PC3
INT
UART TX
PD0
TX
UART RX
PD1
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

Fingerprint 3 Click Schematic schematic

一步一步来

项目组装

Click Shield for Arduino UNO front image hardware assembly

从选择您的开发板和Click板™开始。以Arduino UNO Rev3作为您的开发板开始。

Click Shield for Arduino UNO front image hardware assembly
Arduino UNO Rev3 front image hardware assembly
Charger 27 Click front image hardware assembly
Prog-cut hardware assembly
Charger 27 Click complete accessories setup image hardware assembly
Arduino UNO Rev3 Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Arduino UNO MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

实时跟踪您的结果

应用程序输出

1. 应用程序输出 - 在调试模式下,“应用程序输出”窗口支持实时数据监控,直接提供执行结果的可视化。请按照提供的教程正确配置环境,以确保数据正确显示。

2. UART 终端 - 使用UART Terminal通过USB to UART converter监视数据传输,实现Click board™与开发系统之间的直接通信。请根据项目需求配置波特率和其他串行设置,以确保正常运行。有关分步设置说明,请参考提供的教程

3. Plot 输出 - Plot功能提供了一种强大的方式来可视化实时传感器数据,使趋势分析、调试和多个数据点的对比变得更加直观。要正确设置,请按照提供的教程,其中包含使用Plot功能显示Click board™读数的分步示例。在代码中使用Plot功能时,请使用以下函数:plot(insert_graph_name, variable_name);。这是一个通用格式,用户需要将“insert_graph_name”替换为实际图表名称,并将“variable_name”替换为要显示的参数。

软件支持

库描述

该库包含 Fingerprint 3 Click 驱动程序的 API。

关键功能:

  • fingerprint3_parser_rsp - 响应解析函数。

  • fingerprint3_byte_ready - 检查是否接收到新字节。

  • fingerprint3_uart_write - 串口写函数。

开源

代码示例

完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio 应用程序代码也可以在MIKROE的GitHub账户中找到。

/*!
 * \file 
 * \brief Fingerprint 3 Click example
 * 
 * # Description
 * This example reads and processes data from Fingerprint 3 Clicks.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes the driver, configures the sensor, and enrolls fingerprints.
 * 
 * ## Application Task  
 * Takes an image of the finger, then checks if there's a fingerprint in the library that matches the
 * one it has just read. All data is being logged on the USB UART.
 * 
 * ## Additional Function
 * - static void display_error ( uint8_t *message )
 * - static void display_full_rsp ( fingerprint3_t *ctx )
 * - static void search_finger( fingerprint3_t *ctx )
 * - static void match_finger( fingerprint3_t *ctx, uint16_t location )
 * - static uint8_t enroll_finger( fingerprint3_t *ctx, uint16_t location, uint8_t features )
 *  
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "fingerprint3.h"
#include "string.h"

// ------------------------------------------------------------------ VARIABLES

#define LOCATION_IN_LIBRARY            1    // Location in flash where the fingerprint template will be stored.
#define NUMBER_OF_FINGERPRINTS         2    // Number of fingerprints for enrolling.
#define NUMBER_OF_IMAGES               3    // Number of images it will take for a single fingerprint template.

static fingerprint3_t fingerprint3;
static log_t logger;
uint8_t package_content[ FINGERPRINT3_MAX_PACKAGE_LENGTH ];
uint8_t error_check = 0;

// ------------------------------------------------------- ADDITIONAL FUNCTIONS

/**
 * @brief Display error function.
 *
 * @param message  Input string.
 *
 * @details This function concatenates status of response to the input string and prints it on the USB UART.
 */
static void display_error ( uint8_t *message );

/**
 * @brief Display full response function.
 *
 * @param ctx  Click object.
 *
 * @details This function parses and displays full response to the previously sent command on the USB UART.
 */
static void display_full_rsp ( fingerprint3_t *ctx );

/**
 * @brief Search finger function.
 *
 * @param ctx  Click object.
 *
 * @details This function searches the whole finger library for the template that matches the one 
 * it stores in char_buffer 1. All data is being logged on the USB UART.
 */
static void search_finger( fingerprint3_t *ctx );

/**
 * @brief Match finger function.
 *
 * @param ctx       Click object.
 * @param location  Location in library.
 *
 * @details This function checks if the template stored at the desired location matches the fingerprint
 * it reads. All data is being logged on the USB UART.
 */
static void match_finger( fingerprint3_t *ctx, uint16_t location );

/**
 * @brief Enroll finger function.
 *
 * @param ctx       Click object.
 * @param location  Location in library where the fingerprint template will be stored.
 * @param features  Number of fingerprint images it will combine in a template.
 *
 * @details This function enrolls the fingerprint, creates a template combining the taken images and
 *              stores it at the desired location. All data is being logged on the USB UART.
 */
static uint8_t enroll_finger( fingerprint3_t *ctx, uint16_t location, uint8_t features );


// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    fingerprint3_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, "---- Application Init ----" );
    Delay_ms ( 100 );

    //  Click initialization.
    fingerprint3_cfg_setup( &cfg );
    FINGERPRINT3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    err_t init_flag = fingerprint3_init( &fingerprint3, &cfg );
    if ( init_flag == UART_ERROR ) 
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }
    Delay_ms ( 100 );
    
    error_check = fingerprint3_set_config ( &fingerprint3, FINGERPRINT3_DEFAULT_ADDRESS, 
                                                           FINGERPRINT3_DEFAULT_PASSWORD );
    display_error( "Set Config" );
    Delay_ms ( 500 );
    
    error_check = fingerprint3_soft_reset ( &fingerprint3 );
    display_error( "Soft Reset" );
    Delay_ms ( 500 );
    
    error_check = fingerprint3_check_sensor ( &fingerprint3 );
    display_error( "Check Sensor" );
    Delay_ms ( 500 );
    
    error_check = fingerprint3_empty_library ( &fingerprint3 );
    display_error( "Empty the Library" );
    Delay_ms ( 500 );
    
    uint8_t cnt = 0; 
    do 
    {
        log_printf( &logger, " >>>  Register fingerprint %u of %u  <<<\r\n", ( uint16_t ) cnt + 1, 
                                                                             ( uint16_t ) NUMBER_OF_FINGERPRINTS );
        log_printf( &logger, "--------------------------------- \r\n" );
        error_check = enroll_finger ( &fingerprint3, LOCATION_IN_LIBRARY + cnt, NUMBER_OF_IMAGES );
        display_error( "Enroll finger" );
        if ( FINGERPRINT3_OK != error_check )
        {
            log_printf( &logger, " Please enroll your fingerprint again.\r\n" );
            log_printf( &logger, "--------------------------------- \r\n" );
        }
        else
        {
            cnt++;
        }
        Delay_ms ( 1000 );
    }
    while ( FINGERPRINT3_OK != error_check || cnt != NUMBER_OF_FINGERPRINTS );
}

void application_task ( void )
{    
    search_finger( &fingerprint3 );
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

static void display_error ( uint8_t *message )
{
    log_printf( &logger, " %s: ", message );
    if ( FINGERPRINT3_OK == error_check )
    {
        log_printf( &logger, "DONE!\r\n" );
    }
    else
    {
        log_printf( &logger, "FAIL! [ERROR] Num: 0x%.2X\r\n", ( uint16_t ) error_check );
    }
    log_printf( &logger, "--------------------------------- \r\n" );
}

static void display_full_rsp ( fingerprint3_t *ctx )
{
    log_printf( &logger, "* Header            : 0x%.4X\r\n", ctx->rsp.header );
    log_printf( &logger, "* Address           : 0x%.8LX\r\n", ctx->rsp.addr );
    log_printf( &logger, "* Package identifier: 0x%.2X\r\n", ( uint16_t ) ctx->rsp.pkg_id );
    log_printf( &logger, "* Package length    : 0x%.4X\r\n", ctx->rsp.pkg_len );

    log_printf( &logger, "* Confirmation code :" );

    if ( ctx->rsp.pkg_content[ 0 ] == FINGERPRINT3_CONF_CMD_OK )
    {
        log_printf( &logger, " OK!\r\n" );
    }
    else
    {
        log_error( &logger, " Num: 0x%.2X", ( uint16_t ) ctx->rsp.pkg_content[ 0 ] );
    }

    if ( ctx->rsp.pkg_len > 3 )
    {
        log_printf( &logger, "* Package Content: " );
        for ( uint16_t n_cnt = 1; n_cnt < ctx->rsp.pkg_len - 2; n_cnt++ )
        {

            log_printf( &logger, "0x%.2X ", ( uint16_t ) ctx->rsp.pkg_content[ n_cnt ] );
        }
        log_printf( &logger, "\r\n" );
    }

    log_printf( &logger, "* Checksum           : 0x%.4X \r\n", ctx->rsp.checksum );
}

static void search_finger( fingerprint3_t *ctx )
{
    log_printf( &logger, "  >>> Searching Fingerprints <<<  \r\n" );
    log_printf( &logger, "--------------------------------- \r\n" );
    fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0xFF, 
                                               FINGERPRINT3_AURA_LED_PURPLE, FINGERPRINT3_AURA_TIME_INFINITE );
    log_printf( &logger, " Put your finger on the sensor  \r\n" );
    log_printf( &logger, "--------------------------------- \r\n" );
    
    while ( fingerprint3_finger_indicator( &fingerprint3 ) == FINGERPRINT3_DETECT_NO_FINGER );
    
    while ( FINGERPRINT3_OK != fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_OFF, 0xFF, 
                                                                          FINGERPRINT3_AURA_LED_PURPLE, 
                                                                          FINGERPRINT3_AURA_TIME_INFINITE ) )
    {
        Delay_ms ( 100 );
    }
    for ( ; ; )
    {
        error_check = fingerprint3_take_image ( &fingerprint3 );
        if ( FINGERPRINT3_OK != error_check )
        {
            display_error( "Take Image" );
            Delay_ms ( 1000 );
            continue;
        }
        error_check = fingerprint3_extract_features ( &fingerprint3, 1 );
        
        if ( FINGERPRINT3_OK != error_check )
        {
            display_error( "Extract Features" );
            Delay_ms ( 1000 );
            continue;
        }
        break;
    }
    
    uint16_t match_score, location;
    
    error_check = fingerprint3_search_finger ( &fingerprint3, 1, &location, &match_score );
    if ( FINGERPRINT3_OK == error_check )
    {
        log_printf( &logger, "  >>>>> FINGERPRINT MATCH <<<<<< \r\n\r\n" );
        log_printf( &logger, "  Location: 0x%.4X Match score : %u\r\n", location, match_score );
        log_printf( &logger, "---------------------------------\r\n" );
        fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80, 
                                                   FINGERPRINT3_AURA_LED_BLUE, 1 );
    }
    else if ( FINGERPRINT3_CONF_NOT_FOUND == error_check )
    {
        log_printf( &logger, " >>>>> NO MATCH in library <<<<<<\r\n\r\n" );
        log_printf( &logger, "---------------------------------\r\n" );
        fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80, 
                                                   FINGERPRINT3_AURA_LED_RED, 1 );
    }
    else
    {
        display_error( "Search Finger" );
        fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80, 
                                                   FINGERPRINT3_AURA_LED_RED, 1 );
    }
    Delay_ms ( 100 );
    log_printf( &logger, " Lift the finger of the sensor.\r\n" );
    log_printf( &logger, "--------------------------------- \r\n" );
            
    error_check = fingerprint3_take_image ( &fingerprint3 );
    while ( error_check != FINGERPRINT3_CONF_NO_FINGER )
    {
        Delay_ms ( 100 );
        error_check = fingerprint3_take_image ( &fingerprint3 );
    }
    while ( fingerprint3_finger_indicator( &fingerprint3 ) != FINGERPRINT3_DETECT_NO_FINGER );
    
    Delay_ms ( 1000 );
}

static void match_finger( fingerprint3_t *ctx, uint16_t location )
{
    error_check = fingerprint3_load_template ( &fingerprint3, 2, location );
    display_error( "Load Template" );
    Delay_ms ( 100 );
    
    log_printf( &logger, "  >>> Matching Fingerprints <<<  \r\n" );
    log_printf( &logger, "--------------------------------- \r\n" );
    fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0xFF, 
                                               FINGERPRINT3_AURA_LED_PURPLE, FINGERPRINT3_AURA_TIME_INFINITE );
    log_printf( &logger, " Put your finger on the sensor  \r\n" );
    log_printf( &logger, "--------------------------------- \r\n" );
    
    while ( fingerprint3_finger_indicator( &fingerprint3 ) == FINGERPRINT3_DETECT_NO_FINGER );
    
    while ( FINGERPRINT3_OK != fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_OFF, 0xFF, 
                                                                          FINGERPRINT3_AURA_LED_PURPLE, 
                                                                          FINGERPRINT3_AURA_TIME_INFINITE ) )
    {
        Delay_ms ( 100 );
    }
    
    for ( ; ; )
    {
        error_check = fingerprint3_take_image ( &fingerprint3 );
        if ( FINGERPRINT3_OK != error_check )
        {
            display_error( "Take Image" );
            Delay_ms ( 1000 );
            continue;
        }
        error_check = fingerprint3_extract_features ( &fingerprint3, 3 );
        
        if ( FINGERPRINT3_OK != error_check )
        {
            display_error( "Extract Features" );
            Delay_ms ( 1000 );
            continue;
        }
        break;
    }
    
    uint16_t match_score;
    
    error_check = fingerprint3_match_finger ( &fingerprint3, &match_score );
    if ( FINGERPRINT3_OK == error_check )
    {
        log_printf( &logger, "  >>>>> FINGERPRINT MATCH <<<<<< \r\n\r\n" );
        log_printf( &logger, "  Match score       : %u\r\n", match_score );
        log_printf( &logger, "---------------------------------\r\n" );
        fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80, 
                                                   FINGERPRINT3_AURA_LED_BLUE, 1 );
    }
    else if ( FINGERPRINT3_CONF_NO_MATCH == error_check )
    {
        log_printf( &logger, " >>>>> NO MATCH at location: 0x%.4X <<<<<<\r\n\r\n", location );
        log_printf( &logger, "---------------------------------\r\n" );
        fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80, 
                                                   FINGERPRINT3_AURA_LED_RED, 1 );
    }
    else
    {
        display_error( "Match Finger" );
        fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80, 
                                                   FINGERPRINT3_AURA_LED_RED, 1 );
    }
    Delay_ms ( 100 );
    log_printf( &logger, " Lift the finger of the sensor.\r\n" );
    log_printf( &logger, "--------------------------------- \r\n" );
            
    error_check = fingerprint3_take_image ( &fingerprint3 );
    while ( error_check != FINGERPRINT3_CONF_NO_FINGER )
    {
        Delay_ms ( 100 );
        error_check = fingerprint3_take_image ( &fingerprint3 );
    }
    while ( fingerprint3_finger_indicator( &fingerprint3 ) != FINGERPRINT3_DETECT_NO_FINGER );
    
    Delay_ms ( 1000 );
}

static uint8_t enroll_finger( fingerprint3_t *ctx, uint16_t location, uint8_t features )
{
    for ( uint8_t cnt = 1; cnt <= features; )
    {
        log_printf( &logger, " >>>  Taking image %u of %u  <<<\r\n", ( uint16_t ) cnt, 
                                                                     ( uint16_t ) features );
        log_printf( &logger, "--------------------------------- \r\n" );

        log_printf( &logger, " Put your finger on the sensor  \r\n" );
        log_printf( &logger, "--------------------------------- \r\n" );
        fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0xFF, 
                                                   FINGERPRINT3_AURA_LED_PURPLE, FINGERPRINT3_AURA_TIME_INFINITE );

        while ( fingerprint3_finger_indicator( &fingerprint3 ) == FINGERPRINT3_DETECT_NO_FINGER );
        
        while ( FINGERPRINT3_OK != fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_OFF, 0xFF, 
                                                                              FINGERPRINT3_AURA_LED_PURPLE, 
                                                                              FINGERPRINT3_AURA_TIME_INFINITE ) )
        {
            Delay_ms ( 100 );
        }

        error_check = fingerprint3_take_image ( &fingerprint3 );
        display_error( "Take Image" );
                
        if ( FINGERPRINT3_OK == error_check )
        {
            Delay_ms ( 100 );
            error_check = fingerprint3_extract_features ( &fingerprint3, cnt );
            display_error( "Extract Features" );
            if ( FINGERPRINT3_OK == error_check )
            {
                cnt++;
            }
            Delay_ms ( 100 );
            fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80, 
                                                       FINGERPRINT3_AURA_LED_BLUE, 1 );
            Delay_ms ( 100 );
            
        }

        log_printf( &logger, " Lift the finger of the sensor.\r\n" );
        log_printf( &logger, "--------------------------------- \r\n" );
        
        error_check = fingerprint3_take_image ( &fingerprint3 );
        while ( error_check != FINGERPRINT3_CONF_NO_FINGER )
        {
            Delay_ms ( 100 );
            error_check = fingerprint3_take_image ( &fingerprint3 );
        }
        while ( fingerprint3_finger_indicator( &fingerprint3 ) != FINGERPRINT3_DETECT_NO_FINGER );
        Delay_ms ( 100 );
    }
    error_check = fingerprint3_create_template ( &fingerprint3 );
    display_error( "Create Template" );
    if ( FINGERPRINT3_OK != error_check )
    {
        return error_check;
    }
    Delay_ms ( 100 );
    error_check = fingerprint3_store_template ( &fingerprint3, 1, location );
    display_error( "Store Template" );
    if ( FINGERPRINT3_OK != error_check )
    {
        return error_check;
    }
    Delay_ms ( 100 );
    
    return FINGERPRINT3_OK;
}

// ------------------------------------------------------------------------ END

额外支持

资源

喜欢这个项目吗?

'购买此套件' 按钮会直接带您进入购物车,您可以在购物车中轻松添加或移除产品。