39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_spi_master.h"
75#define FINGERPRINT4_CMD_NONE 0x0000
76#define FINGERPRINT4_CMD_CAPTURE 0x0001
77#define FINGERPRINT4_CMD_ENROLL 0x0002
78#define FINGERPRINT4_CMD_IDENTIFY 0x0003
79#define FINGERPRINT4_CMD_MATCH 0x0004
80#define FINGERPRINT4_CMD_IMAGE 0x0005
81#define FINGERPRINT4_CMD_TEMPLATE 0x0006
82#define FINGERPRINT4_CMD_WAIT 0x0007
83#define FINGERPRINT4_CMD_SETTINGS 0x0008
84#define FINGERPRINT4_CMD_NAVIGATE 0x1001
85#define FINGERPRINT4_CMD_SENSOR 0x1002
86#define FINGERPRINT4_CMD_DEADPIXELS 0x1003
87#define FINGERPRINT4_CMD_CONNECT 0x2001
88#define FINGERPRINT4_CMD_RECONNECT 0x2002
89#define FINGERPRINT4_CMD_RESET 0x3002
90#define FINGERPRINT4_CMD_CANCEL 0x3003
91#define FINGERPRINT4_CMD_INFO 0x3004
92#define FINGERPRINT4_CMD_STORAGE_TEMPLATE 0x4002
93#define FINGERPRINT4_CMD_STORAGE_CALIBRATION 0x4003
94#define FINGERPRINT4_CMD_STORAGE_LOG 0x4004
95#define FINGERPRINT4_CMD_STORAGE_SETTINGS 0x4005
96#define FINGERPRINT4_CMD_TEST 0x5001
97#define FINGERPRINT4_CMD_MCU 0x5002
98#define FINGERPRINT4_CMD_GPIO 0x5003
99#define FINGERPRINT4_CMD_COMMUNICATION 0x6001
100#define FINGERPRINT4_CMD_APP_BASE 0xE000
101#define FINGERPRINT4_CMD_DIAG 0xF003
102#define FINGERPRINT4_CMD_FFFF 0xFFFF
108#define FINGERPRINT4_ARG_NONE 0x0000
109#define FINGERPRINT4_ARG_FINGER_DOWN 0x0001
110#define FINGERPRINT4_ARG_FINGER_UP 0x0002
111#define FINGERPRINT4_ARG_START 0x0003
112#define FINGERPRINT4_ARG_ADD 0x0004
113#define FINGERPRINT4_ARG_FINISH 0x0005
114#define FINGERPRINT4_ARG_ID 0x0006
115#define FINGERPRINT4_ARG_ALL 0x0007
116#define FINGERPRINT4_ARG_EXTRACT 0x0008
117#define FINGERPRINT4_ARG_MATCH_IMAGE 0x0009
118#define FINGERPRINT4_ARG_MATCH 0x000A
119#define FINGERPRINT4_ARG_ACQUIRE 0x1001
120#define FINGERPRINT4_ARG_RELEASE 0x1002
121#define FINGERPRINT4_ARG_SET 0x1003
122#define FINGERPRINT4_ARG_GET 0x1004
123#define FINGERPRINT4_ARG_UPLOAD 0x1005
124#define FINGERPRINT4_ARG_DOWNLOAD 0x1006
125#define FINGERPRINT4_ARG_CREATE 0x1007
126#define FINGERPRINT4_ARG_SAVE 0x1008
127#define FINGERPRINT4_ARG_DELETE 0x1009
128#define FINGERPRINT4_ARG_DATA 0x100A
129#define FINGERPRINT4_ARG_UPDATE 0x100B
130#define FINGERPRINT4_ARG_SEQ_NR 0x100C
131#define FINGERPRINT4_ARG_SEQ_LEN 0x100D
132#define FINGERPRINT4_ARG_RESULT 0x2001
133#define FINGERPRINT4_ARG_COUNT 0x2002
134#define FINGERPRINT4_ARG_SIZE 0x2003
135#define FINGERPRINT4_ARG_LEVEL 0x2004
136#define FINGERPRINT4_ARG_FORMAT 0x2005
137#define FINGERPRINT4_ARG_FLAG 0x2006
138#define FINGERPRINT4_ARG_PROPERTIES 0x2007
139#define FINGERPRINT4_ARG_SPEED 0x2008
140#define FINGERPRINT4_ARG_PROD_TEST 0x2009
141#define FINGERPRINT4_ARG_SENSOR_TYPE 0x3001
142#define FINGERPRINT4_ARG_WIDTH 0x3002
143#define FINGERPRINT4_ARG_HEIGHT 0x3003
144#define FINGERPRINT4_ARG_RESET 0x3004
145#define FINGERPRINT4_ARG_DPI 0x3005
146#define FINGERPRINT4_ARG_MAX_SPI_CLOCK 0x3006
147#define FINGERPRINT4_ARG_NUM_SUB_AREAS_WIDTH 0x3007
148#define FINGERPRINT4_ARG_NUM_SUB_AREAS_HEIGHT 0x3008
149#define FINGERPRINT4_ARG_IRQ_STATUS 0x3009
150#define FINGERPRINT4_ARG_RESET_HARD 0x300A
151#define FINGERPRINT4_ARG_IDLE 0x4001
152#define FINGERPRINT4_ARG_SLEEP 0x4002
153#define FINGERPRINT4_ARG_DEEP_SLEEP 0x4003
154#define FINGERPRINT4_ARG_POWER_MODE 0x4004
155#define FINGERPRINT4_ARG_BUSY_WAIT 0x4005
156#define FINGERPRINT4_ARG_TIMEOUT 0x5001
157#define FINGERPRINT4_ARG_DONE 0x5002
158#define FINGERPRINT4_ARG_BOOT 0x6001
159#define FINGERPRINT4_ARG_STATUS 0x6002
160#define FINGERPRINT4_ARG_VERSION 0x6003
161#define FINGERPRINT4_ARG_UNIQUE_ID 0x6004
162#define FINGERPRINT4_ARG_APP_BASE 0x7000
163#define FINGERPRINT4_ARG_NONCE 0x8001
164#define FINGERPRINT4_ARG_MAC 0x8002
165#define FINGERPRINT4_ARG_RANDOM 0x8003
166#define FINGERPRINT4_ARG_CLAIM 0x8004
167#define FINGERPRINT4_ARG_PUBLIC_KEY 0x8005
168#define FINGERPRINT4_ARG_CIPHERTEXT 0x8006
169#define FINGERPRINT4_ARG_MTU 0x9001
170#define FINGERPRINT4_ARG_STACK 0xE001
171#define FINGERPRINT4_ARG_FILL 0xE002
172#define FINGERPRINT4_ARG_HEAP 0xE003
173#define FINGERPRINT4_ARG_MODE 0xF001
174#define FINGERPRINT4_ARG_DEBUG 0xF002
175#define FINGERPRINT4_ARG_FFFF 0xFFFF
193#define FINGERPRINT4_ARG_PAYLOAD_MAX_SIZE 234
194#define FINGERPRINT4_PHY_MTU_SIZE 256
195#define FINGERPRINT4_TRANSPORT_LAYER_PLD_SIZE 242
201#define FINGERPRINT4_ACK_BYTES 0x7F01FF7Ful
207#define FINGERPRINT4_NUM_IMAGES 3
213#define FINGERPRINT4_DEFAULT_PHY_RX_TIMEOUT_MS 3000
214#define FINGERPRINT4_INFINITE_TIMEOUT 0
220#define FINGERPRINT4_DRV_INTERFACE_UART 0
221#define FINGERPRINT4_DRV_INTERFACE_SPI 1
222#define FINGERPRINT4_DRV_INTERFACE FINGERPRINT4_DRV_INTERFACE_SPI
232#define FINGERPRINT4_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
233#define FINGERPRINT4_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
251#if ( FINGERPRINT4_DRV_INTERFACE == FINGERPRINT4_DRV_INTERFACE_SPI )
252#define FINGERPRINT4_MAP_MIKROBUS( cfg, mikrobus ) \
253 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
254 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
255 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
256 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
257 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
258 cfg.irq = MIKROBUS( mikrobus, MIKROBUS_INT )
259#elif ( FINGERPRINT4_DRV_INTERFACE == FINGERPRINT4_DRV_INTERFACE_UART )
260#define FINGERPRINT4_MAP_MIKROBUS( cfg, mikrobus ) \
261 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
262 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
263 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST );
317#if ( FINGERPRINT4_DRV_INTERFACE == FINGERPRINT4_DRV_INTERFACE_SPI )
324#elif ( FINGERPRINT4_DRV_INTERFACE == FINGERPRINT4_DRV_INTERFACE_UART )
346#if ( FINGERPRINT4_DRV_INTERFACE == FINGERPRINT4_DRV_INTERFACE_SPI )
361#elif ( FINGERPRINT4_DRV_INTERFACE == FINGERPRINT4_DRV_INTERFACE_UART )
369 uart_data_bits_t data_bit;
370 uart_parity_t parity_bit;
371 uart_stop_bits_t stop_bit;
486#if ( FINGERPRINT4_DRV_INTERFACE == FINGERPRINT4_DRV_INTERFACE_SPI )
640 uint16_t arg2_key,
void *arg2_data, uint16_t arg2_length );
fingerprint4_return_value_t
Fingerprint 4 Click return value data.
Definition fingerprint4.h:384
@ FINGERPRINT4_RES_IMAGE_CAPTURE_ERROR
Definition fingerprint4.h:400
@ FINGERPRINT4_RES_SENSOR_NOT_INITIALIZED
Definition fingerprint4.h:406
@ FINGERPRINT4_RES_NOT_INITIALIZED
Definition fingerprint4.h:411
@ FINGERPRINT4_RES_STORAGE_NOT_FORMATTED
Definition fingerprint4.h:405
@ FINGERPRINT4_RES_ERROR
Definition fingerprint4.h:386
@ FINGERPRINT4_RES_OK
Definition fingerprint4.h:385
@ FINGERPRINT4_RES_SENSOR_MISMATCH
Definition fingerprint4.h:401
@ FINGERPRINT4_RES_TIMEOUT
Definition fingerprint4.h:396
@ FINGERPRINT4_RES_TOO_MANY_BAD_IMAGES
Definition fingerprint4.h:407
@ FINGERPRINT4_RES_WRONG_STATE
Definition fingerprint4.h:395
@ FINGERPRINT4_RES_IO_ERROR
Definition fingerprint4.h:393
@ FINGERPRINT4_RES_NO_MEMORY
Definition fingerprint4.h:391
@ FINGERPRINT4_RES_INVALID_ARGUMENT
Definition fingerprint4.h:388
@ FINGERPRINT4_RES_INTERNAL_ERROR
Definition fingerprint4.h:387
@ FINGERPRINT4_RES_INVALID_FORMAT
Definition fingerprint4.h:399
@ FINGERPRINT4_RES_BROKEN_SENSOR
Definition fingerprint4.h:394
@ FINGERPRINT4_RES_CANCELLED
Definition fingerprint4.h:390
@ FINGERPRINT4_RES_NOT_IMPLEMENTED
Definition fingerprint4.h:389
@ FINGERPRINT4_RES_ID_NOT_UNIQUE
Definition fingerprint4.h:397
@ FINGERPRINT4_RES_INVALID_CALIBRATION
Definition fingerprint4.h:404
@ FINGERPRINT4_RES_MISSING_TEMPLATE
Definition fingerprint4.h:403
@ FINGERPRINT4_RES_FINGER_NOT_STABLE
Definition fingerprint4.h:410
@ FINGERPRINT4_RES_NO_RESOURCE
Definition fingerprint4.h:392
@ FINGERPRINT4_RES_NOT_SUPPORTED
Definition fingerprint4.h:409
@ FINGERPRINT4_RES_CRYPTO_ERROR
Definition fingerprint4.h:408
@ FINGERPRINT4_RES_ID_NOT_FOUND
Definition fingerprint4.h:398
@ FINGERPRINT4_RES_INVALID_PARAMETER
Definition fingerprint4.h:402
#define FINGERPRINT4_ARG_PAYLOAD_MAX_SIZE
Fingerprint 4 buffers size setting.
Definition fingerprint4.h:193
#define FINGERPRINT4_PHY_MTU_SIZE
Definition fingerprint4.h:194
err_t fingerprint4_template_remove_all(fingerprint4_t *ctx)
Fingerprint 4 template remove all function.
err_t fingerprint4_template_save(fingerprint4_t *ctx, uint16_t template_id)
Fingerprint 4 template save function.
err_t fingerprint4_init(fingerprint4_t *ctx, fingerprint4_cfg_t *cfg)
Fingerprint 4 initialization function.
err_t fingerprint4_template_get(fingerprint4_t *ctx, uint8_t *data_out, uint32_t size)
Fingerprint 4 template get function.
err_t fingerprint4_template_get_ids(fingerprint4_t *ctx)
Fingerprint 4 template get ids function.
err_t fingerprint4_send_cmd_arg(fingerprint4_t *ctx, uint16_t cmd, uint16_t arg1_key, uint16_t arg2_key, void *arg2_data, uint16_t arg2_length)
Fingerprint 4 send cmd arg function.
err_t fingerprint4_sensor_calibrate_remove(fingerprint4_t *ctx)
Fingerprint 4 sensor calibrate remove function.
err_t fingerprint4_unique_id_get(fingerprint4_t *ctx, uint8_t *unique_id)
Fingerprint 4 version function.
err_t fingerprint4_receive(fingerprint4_t *ctx)
Fingerprint 4 receive function.
err_t fingerprint4_init_cmd(fingerprint4_t *ctx, uint16_t cmd, uint16_t arg_key)
Fingerprint 4 init cmd function.
err_t fingerprint4_wait_finger_not_present(fingerprint4_t *ctx, uint32_t timeout)
Fingerprint 4 wait finger not present function.
err_t fingerprint4_generic_read(fingerprint4_t *ctx, uint8_t *data_out, uint16_t len)
Fingerprint 4 data reading function.
err_t fingerprint4_sensor_calibrate(fingerprint4_t *ctx)
Fingerprint 4 sensor calibrate function.
err_t fingerprint4_sensor_reset(fingerprint4_t *ctx)
Fingerprint 4 sensor reset function.
err_t fingerprint4_wait_finger_present(fingerprint4_t *ctx, uint32_t timeout)
Fingerprint 4 wait finger present function.
err_t fingerprint4_copy_arg(fingerprint4_t *ctx, uint16_t arg_key, void *arg_data, uint16_t arg_size)
Fingerprint 4 copy arg function.
err_t fingerprint4_add_arg(fingerprint4_t *ctx, uint16_t arg_key, void *arg_data, uint16_t arg_size)
Fingerprint 4 add arg function.
err_t fingerprint4_template_get_count(fingerprint4_t *ctx, uint16_t *count)
Fingerprint 4 template get count function.
void fingerprint4_set_rst_pin(fingerprint4_t *ctx, uint8_t state)
Fingerprint 4 set rst pin function.
err_t fingerprint4_get_arg(fingerprint4_t *ctx, uint16_t arg_key)
Fingerprint 4 get arg function.
err_t fingerprint4_template_put(fingerprint4_t *ctx, uint8_t *data_in, uint16_t size)
Fingerprint 4 template put function.
void fingerprint4_reset_device(fingerprint4_t *ctx)
Fingerprint 4 reset device function.
err_t fingerprint4_uart_speed_set(fingerprint4_t *ctx, uint32_t speed)
Fingerprint 4 uart speed set function.
err_t fingerprint4_send_cmd(fingerprint4_t *ctx, uint16_t cmd, uint16_t arg_key)
Fingerprint 4 send cmd function.
uint8_t fingerprint4_get_irq_pin(fingerprint4_t *ctx)
Fingerprint 4 get irq pin function.
err_t fingerprint4_identify_finger(fingerprint4_t *ctx, uint32_t timeout, uint16_t *template_id, bool *match)
Fingerprint 4 identify finger function.
err_t fingerprint4_send(fingerprint4_t *ctx)
Fingerprint 4 send function.
err_t fingerprint4_template_remove(fingerprint4_t *ctx, uint16_t template_id)
Fingerprint 4 template remove function.
err_t fingerprint4_image_delete(fingerprint4_t *ctx)
Fingerprint 4 image delete function.
void fingerprint4_cfg_setup(fingerprint4_cfg_t *cfg)
Fingerprint 4 configuration object setup function.
err_t fingerprint4_sw_reset(fingerprint4_t *ctx)
Fingerprint 4 sw reset function.
err_t fingerprint4_image_put(fingerprint4_t *ctx, uint8_t *data_in, uint32_t size)
Fingerprint 4 image put function.
err_t fingerprint4_template_remove_ram(fingerprint4_t *ctx)
Fingerprint 4 template remove ram function.
err_t fingerprint4_identify(fingerprint4_t *ctx)
Fingerprint 4 identify function.
err_t fingerprint4_generic_write(fingerprint4_t *ctx, uint8_t *data_in, uint16_t len)
Fingerprint 4 data writing function.
err_t fingerprint4_uart_speed_get(fingerprint4_t *ctx, uint32_t *speed)
Fingerprint 4 uart speed get function.
err_t fingerprint4_transceive(fingerprint4_t *ctx)
Fingerprint 4 transceive function.
err_t fingerprint4_image_create(fingerprint4_t *ctx)
Fingerprint 4 image create function.
err_t fingerprint4_image_get(fingerprint4_t *ctx, uint8_t *data_out, uint32_t size)
Fingerprint 4 image get function.
err_t fingerprint4_image_get_size(fingerprint4_t *ctx, uint32_t *size)
Fingerprint 4 image get size function.
err_t fingerprint4_version(fingerprint4_t *ctx, char *version, uint8_t len)
Fingerprint 4 version function.
err_t fingerprint4_template_load_storage(fingerprint4_t *ctx, uint16_t template_id)
Fingerprint 4 template load storage function.
err_t fingerprint4_image_extract(fingerprint4_t *ctx)
Fingerprint 4 image extract function.
This file contains SPI specific macros, functions, etc.
Fingerprint 4 Click configuration object.
Definition fingerprint4.h:345
pin_name_t irq
Definition fingerprint4.h:360
spi_master_chip_select_polarity_t cs_polarity
Definition fingerprint4.h:356
pin_name_t sck
Definition fingerprint4.h:350
spi_master_mode_t spi_mode
Definition fingerprint4.h:355
pin_name_t mosi
Definition fingerprint4.h:349
uint32_t spi_speed
Definition fingerprint4.h:354
pin_name_t miso
Definition fingerprint4.h:348
pin_name_t rst
Definition fingerprint4.h:359
pin_name_t cs
Definition fingerprint4.h:351
Fingerprint 4 Click HCP argument data object.
Definition fingerprint4.h:274
uint16_t size
Definition fingerprint4.h:276
uint16_t arg
Definition fingerprint4.h:275
Fingerprint 4 Click HCP packet object.
Definition fingerprint4.h:286
uint16_t cmd_id
Definition fingerprint4.h:287
uint16_t num_args
Definition fingerprint4.h:288
Fingerprint 4 Click PHY packet object.
Definition fingerprint4.h:298
uint16_t t_seq_len
Definition fingerprint4.h:303
fingerprint4_hcp_packet_t hcp_packet
Definition fingerprint4.h:304
uint16_t t_seq_nr
Definition fingerprint4.h:302
uint16_t lnk_chn
Definition fingerprint4.h:299
uint32_t crc
Definition fingerprint4.h:305
uint16_t lnk_size
Definition fingerprint4.h:300
uint16_t t_size
Definition fingerprint4.h:301
Fingerprint 4 Click context object.
Definition fingerprint4.h:314
spi_master_t spi
Definition fingerprint4.h:321
digital_in_t irq
Definition fingerprint4.h:319
fingerprint4_hcp_arg_data_t arg
Definition fingerprint4.h:334
digital_out_t rst
Definition fingerprint4.h:316
fingerprint4_packet_t phy_pkt
Definition fingerprint4.h:336
uint32_t phy_rx_timeout
Definition fingerprint4.h:332
pin_name_t chip_select
Definition fingerprint4.h:323