nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
st25r3911b_nfca.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef ST25R3911B_NFCA_H_
8#define ST25R3911B_NFCA_H_
9
10#include <zephyr/kernel.h>
11#include <zephyr/types.h>
12
21#ifdef __cplusplus
22extern "C" {
23#endif
24
26#define ST25R3911B_NFCA_EVENT_CNT 2
27
29#define ST25R3911B_NFCA_CRC_LEN 2
30
32#define ST25R3911B_NFCA_NFCID1_MAX_LEN 10
33
38#define ST25R3911B_NFCA_ERR_CRC 1
39#define ST25R3911B_NFCA_ERR_PARITY 2
40#define ST25R3911B_NFCA_ERR_FRAMING 3
41#define ST25R3911B_NFCA_ERR_SOFT_FRAMING 4
42#define ST25R3911B_NFCA_ERR_HARD_FRAMING 5
43#define ST25R3911B_NFCA_ERR_LAST_BYTE_INCOMPLETE 6
44#define ST25R3911B_NFCA_ERR_TRANSMISSION 7
45
59
66
71 uint8_t *data;
72
74 size_t len;
75};
76
86
108
115
125 void (*field_on)(void);
126
129 void (*field_off)(void);
130
137 void (*tag_detected)(const struct st25r3911b_nfca_sens_resp *sens_resp);
138
144 void (*anticollision_completed)(const struct st25r3911b_nfca_tag_info *tag_info,
145 int err);
146
153 void (*transfer_completed)(const uint8_t *data, size_t len, int err);
154
159 void (*rx_timeout)(bool tag_sleep);
160
163 void (*tag_sleep)(void);
164};
165
178int st25r3911b_nfca_init(struct k_poll_event *events, uint8_t cnt,
179 const struct st25r3911b_nfca_cb *cb);
180
190
200
213
224
240 const struct st25r3911b_nfca_buf *rx,
241 uint32_t fdt, bool auto_crc);
242
255 const struct st25r3911b_nfca_buf *rx,
256 uint32_t fdt)
257{
258 return st25r3911b_nfca_transfer(tx, rx, fdt, true);
259}
260
275 const struct st25r3911b_nfca_buf *rx,
276 uint32_t fdt)
277{
278 return st25r3911b_nfca_transfer(tx, rx, fdt, false);
279}
280
290
303int st25r3911b_nfca_crc_calculate(const uint8_t *data, size_t len,
304 struct st25r3911b_nfca_crc *crc_val);
305
315
316
317#ifdef __cplusplus
318}
319#endif
320
325#endif /* ST25R3911B_NFCA_H_ */
int st25r3911b_nfca_process(void)
Process NFC-A library.
int st25r3911b_nfca_tag_sleep(void)
Send NFC-A tag sleep command.
#define ST25R3911B_NFCA_CRC_LEN
Definition st25r3911b_nfca.h:29
int st25r3911b_nfca_crc_calculate(const uint8_t *data, size_t len, struct st25r3911b_nfca_crc *crc_val)
Calculate CRC 16 for NFC-A payload.
static int st25r3911b_nfca_transfer_with_crc(const struct st25r3911b_nfca_buf *tx, const struct st25r3911b_nfca_buf *rx, uint32_t fdt)
Exchange the specified amount of data with an automatically generated CRC.
Definition st25r3911b_nfca.h:254
int st25r3911b_nfca_init(struct k_poll_event *events, uint8_t cnt, const struct st25r3911b_nfca_cb *cb)
Initialize NFC Reader NFC-A technology.
int st25r3911b_nfca_tag_detect(enum st25r3911b_nfca_detect_cmd cmd)
Detect tag by sending a detection command.
int st25r3911b_nfca_anticollision_start(void)
NFC-A collision resolution procedure.
#define ST25R3911B_NFCA_NFCID1_MAX_LEN
Definition st25r3911b_nfca.h:32
int st25r3911b_nfca_field_on(void)
Switch on the NFC Reader field.
st25r3911b_nfca_detect_cmd
NFC-A Tag detect command.
Definition st25r3911b_nfca.h:62
@ ST25R3911B_NFCA_DETECT_CMD_ALL_REQ
Definition st25r3911b_nfca.h:63
@ ST25R3911B_NFCA_DETECT_CMD_SENS_REQ
Definition st25r3911b_nfca.h:64
int st25r3911b_nfca_transfer(const struct st25r3911b_nfca_buf *tx, const struct st25r3911b_nfca_buf *rx, uint32_t fdt, bool auto_crc)
Exchange the specified amount of data.
st25r3911b_nfca_tag_type
NFC-A Tag types.
Definition st25r3911b_nfca.h:52
@ ST25R3911B_NFCA_TAG_TYPE_T4T
Definition st25r3911b_nfca.h:54
@ ST25R3911B_NFCA_TAG_TYPE_NFCDEP
Definition st25r3911b_nfca.h:55
@ ST25R3911B_NFCA_TAG_TYPE_T1T
Definition st25r3911b_nfca.h:57
@ ST25R3911B_NFCA_TAG_TYPE_T4T_NFCDEP
Definition st25r3911b_nfca.h:56
@ ST25R3911B_NFCA_TAG_TYPE_T2T
Definition st25r3911b_nfca.h:53
int st25r3911b_nfca_field_off(void)
Switch off the NFC Reader field.
static int st25r3911b_nfca_transfer_without_crc(const struct st25r3911b_nfca_buf *tx, const struct st25r3911b_nfca_buf *rx, uint32_t fdt)
Exchange the specified amount of data with a manually generated CRC.
Definition st25r3911b_nfca.h:274
uint8_t * data
Definition st25r3911b_nfca.h:71
size_t len
Definition st25r3911b_nfca.h:74
NFC-A transceiver buffer.
Definition st25r3911b_nfca.h:69
void(* transfer_completed)(const uint8_t *data, size_t len, int err)
NFC-A transceive operation completed.
Definition st25r3911b_nfca.h:153
void(* field_off)(void)
Field off indication callback.
Definition st25r3911b_nfca.h:129
void(* rx_timeout)(bool tag_sleep)
NFC-A receive time-out.
Definition st25r3911b_nfca.h:159
void(* tag_sleep)(void)
NFC-A tag sleep state notification.
Definition st25r3911b_nfca.h:163
void(* tag_detected)(const struct st25r3911b_nfca_sens_resp *sens_resp)
Tag detected callback.
Definition st25r3911b_nfca.h:137
void(* anticollision_completed)(const struct st25r3911b_nfca_tag_info *tag_info, int err)
Collision resolution procedure completed.
Definition st25r3911b_nfca.h:144
void(* field_on)(void)
Field on indication callback.
Definition st25r3911b_nfca.h:125
NFC-A callback.
Definition st25r3911b_nfca.h:120
uint8_t crc[2]
Definition st25r3911b_nfca.h:113
NFCA_A CRC structure.
Definition st25r3911b_nfca.h:111
uint8_t anticollison
Definition st25r3911b_nfca.h:81
uint8_t platform_info
Definition st25r3911b_nfca.h:84
NFC-A SENS response.
Definition st25r3911b_nfca.h:79
enum st25r3911b_nfca_tag_type type
Definition st25r3911b_nfca.h:91
uint8_t nfcid1[10]
Definition st25r3911b_nfca.h:103
struct st25r3911b_nfca_sens_resp sens_resp
Definition st25r3911b_nfca.h:94
uint8_t nfcid1_len
Definition st25r3911b_nfca.h:100
uint8_t sel_resp
Definition st25r3911b_nfca.h:97
bool sleep
Definition st25r3911b_nfca.h:106
NFC-A Tag information.
Definition st25r3911b_nfca.h:89