LibDriver NTAG21X
Loading...
Searching...
No Matches
driver_ntag21x.c File Reference

driver ntag21x source file More...

#include "driver_ntag21x.h"
Include dependency graph for driver_ntag21x.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "NXP NTAG213/5/6"
 chip information definition
#define MANUFACTURER_NAME   "NXP"
#define SUPPLY_VOLTAGE_MIN   3.3f
#define SUPPLY_VOLTAGE_MAX   4.0f
#define MAX_CURRENT   30.0f
#define TEMPERATURE_MIN   -25.0f
#define TEMPERATURE_MAX   70.0f
#define DRIVER_VERSION   1000
#define NTAG21X_COMMAND_REQUEST   0x26
 chip command definition
#define NTAG21X_COMMAND_WAKE_UP   0x52
#define NTAG21X_COMMAND_ANTICOLLISION_CL1   0x9320U
#define NTAG21X_COMMAND_SELECT_CL1   0x9370U
#define NTAG21X_COMMAND_ANTICOLLISION_CL2   0x9520U
#define NTAG21X_COMMAND_SELECT_CL2   0x9570U
#define NTAG21X_COMMAND_HALT   0x5000U
#define NTAG21X_COMMAND_GET_VERSION   0x60
#define NTAG21X_COMMAND_READ   0x30
#define NTAG21X_COMMAND_FAST_READ   0x3A
#define NTAG21X_COMMAND_WRITE   0xA2
#define NTAG21X_COMMAND_COMP_WRITE   0xA0
#define NTAG21X_COMMAND_READ_CNT   0x39
#define NTAG21X_COMMAND_PWD_AUTH   0x1B
#define NTAG21X_COMMAND_READ_SIG   0x3C

Functions

uint8_t ntag21x_init (ntag21x_handle_t *handle)
 initialize the chip
uint8_t ntag21x_deinit (ntag21x_handle_t *handle)
 close the chip
uint8_t ntag21x_request (ntag21x_handle_t *handle, ntag21x_type_t *type)
 ntag21x request
uint8_t ntag21x_wake_up (ntag21x_handle_t *handle, ntag21x_type_t *type)
 ntag21x wake up
uint8_t ntag21x_halt (ntag21x_handle_t *handle)
 ntag21x halt
uint8_t ntag21x_anticollision_cl1 (ntag21x_handle_t *handle, uint8_t id[4])
 ntag21x anti collision cl1
uint8_t ntag21x_anticollision_cl2 (ntag21x_handle_t *handle, uint8_t id[4])
 ntag21x anti collision cl2
uint8_t ntag21x_select_cl1 (ntag21x_handle_t *handle, uint8_t id[4])
 ntag21x select cl1
uint8_t ntag21x_select_cl2 (ntag21x_handle_t *handle, uint8_t id[4])
 ntag21x select cl2
uint8_t ntag21x_get_version (ntag21x_handle_t *handle, ntag21x_version_t *version)
 ntag21x get the version
uint8_t ntag21x_read_counter (ntag21x_handle_t *handle, uint32_t *cnt)
 ntag21x read the counter
uint8_t ntag21x_read_signature (ntag21x_handle_t *handle, uint8_t signature[32])
 ntag21x read the signature
uint8_t ntag21x_get_serial_number (ntag21x_handle_t *handle, uint8_t number[7])
 ntag21x get the serial number
uint8_t ntag21x_get_capability_container (ntag21x_handle_t *handle, ntag21x_capability_container_t *container)
 ntag21x get the capability container
uint8_t ntag21x_read_four_pages (ntag21x_handle_t *handle, uint8_t start_page, uint8_t data[16])
 ntag21x read four pages
uint8_t ntag21x_read_page (ntag21x_handle_t *handle, uint8_t page, uint8_t data[4])
 ntag21x read page
uint8_t ntag21x_fast_read_page (ntag21x_handle_t *handle, uint8_t start_page, uint8_t stop_page, uint8_t *data, uint16_t *len)
 ntag21x fast read page
uint8_t ntag21x_compatibility_write_page (ntag21x_handle_t *handle, uint8_t page, uint8_t data[4])
 ntag21x compatibility write page
uint8_t ntag21x_write_page (ntag21x_handle_t *handle, uint8_t page, uint8_t data[4])
 ntag21x write page
uint8_t ntag21x_authenticate (ntag21x_handle_t *handle, uint8_t pwd[4], uint8_t pack[2])
 ntag21x authenticate
uint8_t ntag21x_set_password (ntag21x_handle_t *handle, uint8_t pwd[4])
 ntag21x set the password
uint8_t ntag21x_set_pack (ntag21x_handle_t *handle, uint8_t pack[2])
 ntag21x set the pack
uint8_t ntag21x_set_dynamic_lock (ntag21x_handle_t *handle, uint8_t lock[3])
 ntag21x set the dynamic lock
uint8_t ntag21x_get_dynamic_lock (ntag21x_handle_t *handle, uint8_t lock[3])
 ntag21x get the dynamic lock
uint8_t ntag21x_set_static_lock (ntag21x_handle_t *handle, uint8_t lock[2])
 ntag21x set the static lock
uint8_t ntag21x_get_static_lock (ntag21x_handle_t *handle, uint8_t lock[2])
 ntag21x get the static lock
uint8_t ntag21x_set_mirror (ntag21x_handle_t *handle, ntag21x_mirror_t mirror)
 ntag21x set the mirror
uint8_t ntag21x_get_mirror (ntag21x_handle_t *handle, ntag21x_mirror_t *mirror)
 ntag21x get the mirror
uint8_t ntag21x_set_mirror_byte (ntag21x_handle_t *handle, ntag21x_mirror_byte_t byte)
 ntag21x set the mirror byte
uint8_t ntag21x_get_mirror_byte (ntag21x_handle_t *handle, ntag21x_mirror_byte_t *byte)
 ntag21x get the mirror byte
uint8_t ntag21x_set_modulation_mode (ntag21x_handle_t *handle, ntag21x_modulation_mode_t mode)
 ntag21x set the modulation mode
uint8_t ntag21x_get_modulation_mode (ntag21x_handle_t *handle, ntag21x_modulation_mode_t *mode)
 ntag21x get the modulation mode
uint8_t ntag21x_set_mirror_page (ntag21x_handle_t *handle, uint8_t page)
 ntag21x set the mirror page
uint8_t ntag21x_get_mirror_page (ntag21x_handle_t *handle, uint8_t *page)
 ntag21x get the mirror page
uint8_t ntag21x_set_protect_start_page (ntag21x_handle_t *handle, uint8_t page)
 ntag21x set the start page of protection
uint8_t ntag21x_get_protect_start_page (ntag21x_handle_t *handle, uint8_t *page)
 ntag21x get the start page of protection
uint8_t ntag21x_set_access (ntag21x_handle_t *handle, ntag21x_access_t access, ntag21x_bool_t enable)
 ntag21x enable or disable access
uint8_t ntag21x_get_access (ntag21x_handle_t *handle, ntag21x_access_t access, ntag21x_bool_t *enable)
 ntag21x get the access status
uint8_t ntag21x_set_authenticate_limitation (ntag21x_handle_t *handle, uint8_t limit)
 ntag21x set the authenticate limitation
uint8_t ntag21x_get_authenticate_limitation (ntag21x_handle_t *handle, uint8_t *limit)
 ntag21x get the authenticate limitation
uint8_t ntag21x_transceiver (ntag21x_handle_t *handle, uint8_t *in_buf, uint8_t in_len, uint8_t *out_buf, uint8_t *out_len)
 transceiver data
uint8_t ntag21x_info (ntag21x_info_t *info)
 get chip information

Detailed Description

driver ntag21x source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2022-06-30

history

Date Version Author Description
2022/06/30 1.0 Shifeng Li first upload

Definition in file driver_ntag21x.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "NXP NTAG213/5/6"

chip information definition

chip name

Definition at line 42 of file driver_ntag21x.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_ntag21x.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "NXP"

manufacturer name

Definition at line 43 of file driver_ntag21x.c.

◆ MAX_CURRENT

#define MAX_CURRENT   30.0f

chip max current

Definition at line 46 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_ANTICOLLISION_CL1

#define NTAG21X_COMMAND_ANTICOLLISION_CL1   0x9320U

anti collision cl1 command

Definition at line 56 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_ANTICOLLISION_CL2

#define NTAG21X_COMMAND_ANTICOLLISION_CL2   0x9520U

anti collision cl2 command

Definition at line 58 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_COMP_WRITE

#define NTAG21X_COMMAND_COMP_WRITE   0xA0

comp write command

Definition at line 65 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_FAST_READ

#define NTAG21X_COMMAND_FAST_READ   0x3A

fast read command

Definition at line 63 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_GET_VERSION

#define NTAG21X_COMMAND_GET_VERSION   0x60

get version command

Definition at line 61 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_HALT

#define NTAG21X_COMMAND_HALT   0x5000U

halt command

Definition at line 60 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_PWD_AUTH

#define NTAG21X_COMMAND_PWD_AUTH   0x1B

pwd auth command

Definition at line 67 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_READ

#define NTAG21X_COMMAND_READ   0x30

read command

Definition at line 62 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_READ_CNT

#define NTAG21X_COMMAND_READ_CNT   0x39

read cnt command

Definition at line 66 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_READ_SIG

#define NTAG21X_COMMAND_READ_SIG   0x3C

read sig command

Definition at line 68 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_REQUEST

#define NTAG21X_COMMAND_REQUEST   0x26

chip command definition

request command

Definition at line 54 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_SELECT_CL1

#define NTAG21X_COMMAND_SELECT_CL1   0x9370U

select cl1 command

Definition at line 57 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_SELECT_CL2

#define NTAG21X_COMMAND_SELECT_CL2   0x9570U

select cl2 command

Definition at line 59 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_WAKE_UP

#define NTAG21X_COMMAND_WAKE_UP   0x52

wake up command

Definition at line 55 of file driver_ntag21x.c.

◆ NTAG21X_COMMAND_WRITE

#define NTAG21X_COMMAND_WRITE   0xA2

write command

Definition at line 64 of file driver_ntag21x.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   4.0f

chip max supply voltage

Definition at line 45 of file driver_ntag21x.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   3.3f

chip min supply voltage

Definition at line 44 of file driver_ntag21x.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   70.0f

chip max operating temperature

Definition at line 48 of file driver_ntag21x.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -25.0f

chip min operating temperature

Definition at line 47 of file driver_ntag21x.c.