1*150812a8SEvalZero /*
2*150812a8SEvalZero * Copyright (c) 2018, Nordic Semiconductor ASA
3*150812a8SEvalZero * All rights reserved.
4*150812a8SEvalZero *
5*150812a8SEvalZero * Redistribution and use in source and binary forms, with or without
6*150812a8SEvalZero * modification, are permitted provided that the following conditions are met:
7*150812a8SEvalZero *
8*150812a8SEvalZero * 1. Redistributions of source code must retain the above copyright notice, this
9*150812a8SEvalZero * list of conditions and the following disclaimer.
10*150812a8SEvalZero *
11*150812a8SEvalZero * 2. Redistributions in binary form must reproduce the above copyright
12*150812a8SEvalZero * notice, this list of conditions and the following disclaimer in the
13*150812a8SEvalZero * documentation and/or other materials provided with the distribution.
14*150812a8SEvalZero *
15*150812a8SEvalZero * 3. Neither the name of the copyright holder nor the names of its
16*150812a8SEvalZero * contributors may be used to endorse or promote products derived from this
17*150812a8SEvalZero * software without specific prior written permission.
18*150812a8SEvalZero *
19*150812a8SEvalZero * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20*150812a8SEvalZero * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*150812a8SEvalZero * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*150812a8SEvalZero * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23*150812a8SEvalZero * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*150812a8SEvalZero * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*150812a8SEvalZero * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*150812a8SEvalZero * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*150812a8SEvalZero * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*150812a8SEvalZero * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*150812a8SEvalZero * POSSIBILITY OF SUCH DAMAGE.
30*150812a8SEvalZero */
31*150812a8SEvalZero
32*150812a8SEvalZero #ifndef NRF_NFCT_H__
33*150812a8SEvalZero #define NRF_NFCT_H__
34*150812a8SEvalZero
35*150812a8SEvalZero #include <nrfx.h>
36*150812a8SEvalZero
37*150812a8SEvalZero #ifdef __cplusplus
38*150812a8SEvalZero extern "C" {
39*150812a8SEvalZero #endif
40*150812a8SEvalZero
41*150812a8SEvalZero /**
42*150812a8SEvalZero * @defgroup nrf_nfct_hal NFCT HAL
43*150812a8SEvalZero * @{
44*150812a8SEvalZero * @ingroup nrf_nfct
45*150812a8SEvalZero *
46*150812a8SEvalZero * @brief Hardware access layer (HAL) for the Near Field Communication Tag (NFCT) peripheral.
47*150812a8SEvalZero */
48*150812a8SEvalZero
49*150812a8SEvalZero #define NRF_NFCT_CRC_SIZE 2 /**< CRC size in bytes. */
50*150812a8SEvalZero #define NRF_NFCT_DISABLE_ALL_INT 0xFFFFFFFF /**< Value to disable all interrupts. */
51*150812a8SEvalZero
52*150812a8SEvalZero /**
53*150812a8SEvalZero * @brief NFCT tasks
54*150812a8SEvalZero */
55*150812a8SEvalZero typedef enum /*lint -save -e30 */
56*150812a8SEvalZero {
57*150812a8SEvalZero NRF_NFCT_TASK_ACTIVATE = offsetof(NRF_NFCT_Type, TASKS_ACTIVATE), /**< Activate the NFCT peripheral for the incoming and outgoing frames, change state to activated. */
58*150812a8SEvalZero NRF_NFCT_TASK_DISABLE = offsetof(NRF_NFCT_Type, TASKS_DISABLE), /**< Disable the NFCT peripheral. */
59*150812a8SEvalZero NRF_NFCT_TASK_SENSE = offsetof(NRF_NFCT_Type, TASKS_SENSE), /**< Enable the NFC sense field mode, change state to sense mode. */
60*150812a8SEvalZero NRF_NFCT_TASK_STARTTX = offsetof(NRF_NFCT_Type, TASKS_STARTTX), /**< Start the transmission of an outgoing frame, change state to transmit. */
61*150812a8SEvalZero NRF_NFCT_TASK_ENABLERXDATA = offsetof(NRF_NFCT_Type, TASKS_ENABLERXDATA), /**< Initialize EasyDMA for receive. */
62*150812a8SEvalZero NRF_NFCT_TASK_GOIDLE = offsetof(NRF_NFCT_Type, TASKS_GOIDLE), /**< Force state machine to the IDLE state. */
63*150812a8SEvalZero NRF_NFCT_TASK_GOSLEEP = offsetof(NRF_NFCT_Type, TASKS_GOSLEEP), /**< Force state machine to the SLEEP_A state. */
64*150812a8SEvalZero } nrf_nfct_task_t; /*lint -restore */
65*150812a8SEvalZero
66*150812a8SEvalZero /**
67*150812a8SEvalZero * @brief NFCT events
68*150812a8SEvalZero */
69*150812a8SEvalZero typedef enum /*lint -save -e30 */
70*150812a8SEvalZero {
71*150812a8SEvalZero NRF_NFCT_EVENT_READY = offsetof(NRF_NFCT_Type, EVENTS_READY), /**< The NFCT peripheral is ready to receive and send frames. */
72*150812a8SEvalZero NRF_NFCT_EVENT_FIELDDETECTED = offsetof(NRF_NFCT_Type, EVENTS_FIELDDETECTED), /**< Remote NFC field is detected. */
73*150812a8SEvalZero NRF_NFCT_EVENT_FIELDLOST = offsetof(NRF_NFCT_Type, EVENTS_FIELDLOST), /**< Remote NFC field is lost. */
74*150812a8SEvalZero NRF_NFCT_EVENT_TXFRAMESTART = offsetof(NRF_NFCT_Type, EVENTS_TXFRAMESTART), /**< The start of the first symbol of a transmitted frame. */
75*150812a8SEvalZero NRF_NFCT_EVENT_TXFRAMEEND = offsetof(NRF_NFCT_Type, EVENTS_TXFRAMEEND), /**< The end of the last transmitted on-air symbol of a frame. */
76*150812a8SEvalZero NRF_NFCT_EVENT_RXFRAMESTART = offsetof(NRF_NFCT_Type, EVENTS_RXFRAMESTART), /**< The end of the first symbol of a received frame. */
77*150812a8SEvalZero NRF_NFCT_EVENT_RXFRAMEEND = offsetof(NRF_NFCT_Type, EVENTS_RXFRAMEEND), /**< Received data was checked (CRC, parity) and transferred to RAM, and EasyDMA ended accessing the RX buffer. */
78*150812a8SEvalZero NRF_NFCT_EVENT_ERROR = offsetof(NRF_NFCT_Type, EVENTS_ERROR), /**< NFC error reported. The ERRORSTATUS register contains details on the source of the error. */
79*150812a8SEvalZero NRF_NFCT_EVENT_RXERROR = offsetof(NRF_NFCT_Type, EVENTS_RXERROR), /**< NFC RX frame error reported. The FRAMESTATUS.RX register contains details on the source of the error. */
80*150812a8SEvalZero NRF_NFCT_EVENT_ENDRX = offsetof(NRF_NFCT_Type, EVENTS_ENDRX), /**< RX buffer (as defined by PACKETPTR and MAXLEN) in Data RAM full. */
81*150812a8SEvalZero NRF_NFCT_EVENT_ENDTX = offsetof(NRF_NFCT_Type, EVENTS_ENDTX), /**< Transmission of data in RAM ended, and EasyDMA ended accessing the TX buffer. */
82*150812a8SEvalZero NRF_NFCT_EVENT_AUTOCOLRESSTARTED = offsetof(NRF_NFCT_Type, EVENTS_AUTOCOLRESSTARTED), /**< Auto collision resolution process started. */
83*150812a8SEvalZero NRF_NFCT_EVENT_COLLISION = offsetof(NRF_NFCT_Type, EVENTS_COLLISION), /**< NFC auto collision resolution error reported. */
84*150812a8SEvalZero NRF_NFCT_EVENT_SELECTED = offsetof(NRF_NFCT_Type, EVENTS_SELECTED), /**< NFC auto collision resolution successfully completed. */
85*150812a8SEvalZero NRF_NFCT_EVENT_STARTED = offsetof(NRF_NFCT_Type, EVENTS_STARTED), /**< EasyDMA is ready to receive or send frames. */
86*150812a8SEvalZero } nrf_nfct_event_t; /*lint -restore */
87*150812a8SEvalZero
88*150812a8SEvalZero /**
89*150812a8SEvalZero * @brief NFCT shorts
90*150812a8SEvalZero */
91*150812a8SEvalZero typedef enum
92*150812a8SEvalZero {
93*150812a8SEvalZero NRF_NFCT_SHORT_FIELDDETECTED_ACTIVATE_MASK = NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Msk, /**< Shortcut between the FIELDDETECTED event and the ACTIVATE task. */
94*150812a8SEvalZero NRF_NFCT_SHORT_FIELDLOST_SENSE_MASK = NFCT_SHORTS_FIELDLOST_SENSE_Msk, /**< Shortcut between the FIELDLOST event and the SENSE task. */
95*150812a8SEvalZero #if defined(NFCT_SHORTS_TXFRAMEEND_ENABLERXDATA_Msk) || defined(__NRFX_DOXYGEN__)
96*150812a8SEvalZero NRF_NFCT_SHORT_TXFRAMEEND_ENABLERXDATA_MASK = NFCT_SHORTS_TXFRAMEEND_ENABLERXDATA_Msk, /**< Shortcut between the TXFRAMEEND event and the ENABLERXDATA task. */
97*150812a8SEvalZero #endif // defined(NFCT_SHORTS_TXFRAMEEND_ENABLERXDATA_Msk) || defined(__NRFX_DOXYGEN__)
98*150812a8SEvalZero } nrf_nfct_short_mask_t;
99*150812a8SEvalZero
100*150812a8SEvalZero /**
101*150812a8SEvalZero * @brief NFCT interrupts
102*150812a8SEvalZero */
103*150812a8SEvalZero typedef enum
104*150812a8SEvalZero {
105*150812a8SEvalZero NRF_NFCT_INT_READY_MASK = NFCT_INTEN_READY_Msk, /**< Interrupt on READY event. */
106*150812a8SEvalZero NRF_NFCT_INT_FIELDDETECTED_MASK = NFCT_INTEN_FIELDDETECTED_Msk, /**< Interrupt on FIELDDETECTED event. */
107*150812a8SEvalZero NRF_NFCT_INT_FIELDLOST_MASK = NFCT_INTEN_FIELDLOST_Msk, /**< Interrupt on FIELDLOST event. */
108*150812a8SEvalZero NRF_NFCT_INT_TXFRAMESTART_MASK = NFCT_INTEN_TXFRAMESTART_Msk, /**< Interrupt on TXFRAMESTART event. */
109*150812a8SEvalZero NRF_NFCT_INT_TXFRAMEEND_MASK = NFCT_INTEN_TXFRAMEEND_Msk, /**< Interrupt on TXFRAMEEND event. */
110*150812a8SEvalZero NRF_NFCT_INT_RXFRAMESTART_MASK = NFCT_INTEN_RXFRAMESTART_Msk, /**< Interrupt on RXFRAMESTART event. */
111*150812a8SEvalZero NRF_NFCT_INT_RXFRAMEEND_MASK = NFCT_INTEN_RXFRAMEEND_Msk, /**< Interrupt on RXFRAMEEND event. */
112*150812a8SEvalZero NRF_NFCT_INT_ERROR_MASK = NFCT_INTEN_ERROR_Msk, /**< Interrupt on ERROR event. */
113*150812a8SEvalZero NRF_NFCT_INT_RXERROR_MASK = NFCT_INTEN_RXERROR_Msk, /**< Interrupt on RXERROR event. */
114*150812a8SEvalZero NRF_NFCT_INT_ENDRX_MASK = NFCT_INTEN_ENDRX_Msk, /**< Interrupt on ENDRX event. */
115*150812a8SEvalZero NRF_NFCT_INT_ENDTX_MASK = NFCT_INTEN_ENDTX_Msk, /**< Interrupt on ENDTX event. */
116*150812a8SEvalZero NRF_NFCT_INT_AUTOCOLRESSTARTED_MASK = NFCT_INTEN_AUTOCOLRESSTARTED_Msk, /**< Interrupt on AUTOCOLRESSTARTED event. */
117*150812a8SEvalZero NRF_NFCT_INT_COLLISION_MASK = NFCT_INTEN_COLLISION_Msk, /**< Interrupt on COLLISION event. */
118*150812a8SEvalZero NRF_NFCT_INT_SELECTED_MASK = NFCT_INTEN_SELECTED_Msk, /**< Interrupt on SELECTED event. */
119*150812a8SEvalZero NRF_NFCT_INT_STARTED_MASK = NFCT_INTEN_STARTED_Msk, /**< Interrupt on STARTED event. */
120*150812a8SEvalZero } nrf_nfct_int_mask_t;
121*150812a8SEvalZero
122*150812a8SEvalZero /**
123*150812a8SEvalZero * @brief NFC error status bit masks.
124*150812a8SEvalZero */
125*150812a8SEvalZero typedef enum
126*150812a8SEvalZero {
127*150812a8SEvalZero NRF_NFCT_ERROR_FRAMEDELAYTIMEOUT_MASK = NFCT_ERRORSTATUS_FRAMEDELAYTIMEOUT_Msk, /**< Timeout of the Frame Delay Timer (no frame transmission started in the FDT window). */
128*150812a8SEvalZero #if defined(NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk) || defined(__NRFX_DOXYGEN__)
129*150812a8SEvalZero NRF_NFCT_ERROR_NFCFIELDTOOSTRONG_MASK = NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk, /**< Field level is too high at maximum load resistance. */
130*150812a8SEvalZero #endif // defined(NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk) || defined(__NRFX_DOXYGEN__)
131*150812a8SEvalZero #if defined(NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk) || defined(__NRFX_DOXYGEN__)
132*150812a8SEvalZero NRF_NFCT_ERROR_NFCFIELDTOOWEAK_MASK = NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk, /**< Field level is too low at minimum load resistance. */
133*150812a8SEvalZero #endif // defined(NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk) || defined(__NRFX_DOXYGEN__)
134*150812a8SEvalZero } nrf_nfct_error_status_t;
135*150812a8SEvalZero
136*150812a8SEvalZero /**
137*150812a8SEvalZero * @brief NFC received frame status bit masks.
138*150812a8SEvalZero */
139*150812a8SEvalZero typedef enum
140*150812a8SEvalZero {
141*150812a8SEvalZero NRF_NFCT_RX_FRAME_STATUS_CRC_MASK = NFCT_FRAMESTATUS_RX_CRCERROR_Msk, /**< CRC status mask. */
142*150812a8SEvalZero NRF_NFCT_RX_FRAME_STATUS_PARITY_MASK = NFCT_FRAMESTATUS_RX_PARITYSTATUS_Msk, /**< Parity status mask. */
143*150812a8SEvalZero NRF_NFCT_RX_FRAME_STATUS_OVERRUN_MASK = NFCT_FRAMESTATUS_RX_OVERRUN_Msk, /**< Overrun status mask. */
144*150812a8SEvalZero } nrf_nfct_rx_frame_status_t;
145*150812a8SEvalZero
146*150812a8SEvalZero #if defined(NFCT_NFCTAGSTATE_NFCTAGSTATE_Msk) || defined(__NRFX_DOXYGEN__)
147*150812a8SEvalZero /**
148*150812a8SEvalZero * @brief NFC tag state.
149*150812a8SEvalZero */
150*150812a8SEvalZero typedef enum
151*150812a8SEvalZero {
152*150812a8SEvalZero NRF_NFCT_TAG_STATE_DISABLED = NFCT_NFCTAGSTATE_NFCTAGSTATE_Disabled, /**< Disabled or sensing NFC field. */
153*150812a8SEvalZero NRF_NFCT_TAG_STATE_RAMP_UP = NFCT_NFCTAGSTATE_NFCTAGSTATE_RampUp, /**< Ramping up. */
154*150812a8SEvalZero NRF_NFCT_TAG_STATE_IDLE = NFCT_NFCTAGSTATE_NFCTAGSTATE_Idle, /**< Idle. */
155*150812a8SEvalZero NRF_NFCT_TAG_STATE_RECEIVE = NFCT_NFCTAGSTATE_NFCTAGSTATE_Receive, /**< Receiving data. */
156*150812a8SEvalZero NRF_NFCT_TAG_STATE_FRAME_DELAY = NFCT_NFCTAGSTATE_NFCTAGSTATE_FrameDelay, /**< Counting Frame Delay Time since the last symbol of the last received frame. */
157*150812a8SEvalZero NRF_NFCT_TAG_STATE_TRANSMIT = NFCT_NFCTAGSTATE_NFCTAGSTATE_Transmit /**< Transmitting data. */
158*150812a8SEvalZero } nrf_nfct_tag_state_t;
159*150812a8SEvalZero #endif // defined(NFCT_NFCTAGSTATE_NFCTAGSTATE_Msk) || defined(__NRFX_DOXYGEN__)
160*150812a8SEvalZero
161*150812a8SEvalZero #if defined (NFCT_SLEEPSTATE_SLEEPSTATE_Msk) || defined(__NRFX_DOXYGEN__)
162*150812a8SEvalZero /**
163*150812a8SEvalZero * @brief NFC tag sleep state.
164*150812a8SEvalZero *
165*150812a8SEvalZero * @details Shows the sleep state during automatic collision resolution
166*150812a8SEvalZero * according to the NFC Forum Activity Technical Specification v2.0.
167*150812a8SEvalZero */
168*150812a8SEvalZero typedef enum
169*150812a8SEvalZero {
170*150812a8SEvalZero NRF_NFCT_SLEEP_STATE_IDLE = NFCT_SLEEPSTATE_SLEEPSTATE_Idle, /**< 'IDLE' state. */
171*150812a8SEvalZero NRF_NFCT_SLEEP_STATE_SLEEP_A = NFCT_SLEEPSTATE_SLEEPSTATE_SleepA /**< 'SLEEP_A' state. */
172*150812a8SEvalZero } nrf_nfct_sleep_state_t;
173*150812a8SEvalZero #endif // defined (NFCT_SLEEPSTATE_SLEEPSTATE_Msk) || defined(__NRFX_DOXYGEN__)
174*150812a8SEvalZero
175*150812a8SEvalZero /**
176*150812a8SEvalZero * @brief NFC field state bit masks.
177*150812a8SEvalZero */
178*150812a8SEvalZero typedef enum
179*150812a8SEvalZero {
180*150812a8SEvalZero NRF_NFCT_FIELD_STATE_PRESENT_MASK = NFCT_FIELDPRESENT_FIELDPRESENT_Msk, /**< Field presence mask. */
181*150812a8SEvalZero NRF_NFCT_FIELD_STATE_LOCK_MASK = NFCT_FIELDPRESENT_LOCKDETECT_Msk /**< Field lock mask. */
182*150812a8SEvalZero } nrf_nfct_field_state_t;
183*150812a8SEvalZero
184*150812a8SEvalZero /**
185*150812a8SEvalZero * @brief NFC frame delay mode for data transmission.
186*150812a8SEvalZero */
187*150812a8SEvalZero typedef enum
188*150812a8SEvalZero {
189*150812a8SEvalZero NRF_NFCT_FRAME_DELAY_MODE_FREERUN = NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_FreeRun, /**< Frame transmission starts when @ref NRF_NFCT_TASK_STARTTX is set (delay timer is not used). */
190*150812a8SEvalZero NRF_NFCT_FRAME_DELAY_MODE_WINDOW = NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_Window, /**< Frame transmission starts in a window between FRAMEDELAYMIN and FRAMEDELAYMAX. */
191*150812a8SEvalZero NRF_NFCT_FRAME_DELAY_MODE_EXACTVAL = NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_ExactVal, /**< Frame transmission starts when the delay timer reaches FRAMEDELAYMAX. */
192*150812a8SEvalZero NRF_NFCT_FRAME_DELAY_MODE_WINDOWGRID = NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_WindowGrid /**< Frame transmission starts in a bit grid between FRAMEDELAYMIN and FRAMEDELAYMAX. */
193*150812a8SEvalZero } nrf_nfct_frame_delay_mode_t;
194*150812a8SEvalZero
195*150812a8SEvalZero /**
196*150812a8SEvalZero * @brief Bit masks for NFC transmission frame configuration.
197*150812a8SEvalZero */
198*150812a8SEvalZero typedef enum
199*150812a8SEvalZero {
200*150812a8SEvalZero NRF_NFCT_TX_FRAME_CONFIG_PARITY = NFCT_TXD_FRAMECONFIG_PARITY_Msk, /**< Indicates whether parity is added in the transmitted frames. */
201*150812a8SEvalZero NRF_NFCT_TX_FRAME_CONFIG_DISCARD_START = NFCT_TXD_FRAMECONFIG_DISCARDMODE_Msk, /**< Indicates whether unused bits are discarded at the start or at the end of the transmitted frames. */
202*150812a8SEvalZero NRF_NFCT_TX_FRAME_CONFIG_SOF = NFCT_TXD_FRAMECONFIG_SOF_Msk, /**< Indicates whether SoF symbol is added in the transmitted frames. */
203*150812a8SEvalZero NRF_NFCT_TX_FRAME_CONFIG_CRC16 = NFCT_TXD_FRAMECONFIG_CRCMODETX_Msk /**< Indicates whether CRC is added in the transmitted frames. */
204*150812a8SEvalZero } nrf_nfct_tx_frame_config_t;
205*150812a8SEvalZero
206*150812a8SEvalZero /**
207*150812a8SEvalZero * @brief Bit masks for NFC reception frame configuration.
208*150812a8SEvalZero */
209*150812a8SEvalZero typedef enum
210*150812a8SEvalZero {
211*150812a8SEvalZero NRF_NFCT_RX_FRAME_CONFIG_PARITY = NFCT_RXD_FRAMECONFIG_PARITY_Msk, /**< Indicates whether parity is expected in the received frames. */
212*150812a8SEvalZero NRF_NFCT_RX_FRAME_CONFIG_SOF = NFCT_RXD_FRAMECONFIG_SOF_Msk, /**< Indicates whether SoF symbol is expected in the received frames. */
213*150812a8SEvalZero NRF_NFCT_RX_FRAME_CONFIG_CRC16 = NFCT_RXD_FRAMECONFIG_CRCMODERX_Msk /**< Indicates whether CRC is expected and checked in the received frames. */
214*150812a8SEvalZero } nrf_nfct_rx_frame_config_t;
215*150812a8SEvalZero
216*150812a8SEvalZero /**
217*150812a8SEvalZero * @brief 'NFCI1 size' NFC field configuration for the SENS_RES frame according to the NFC Forum Digital Protocol Technical Specification.
218*150812a8SEvalZero */
219*150812a8SEvalZero typedef enum
220*150812a8SEvalZero {
221*150812a8SEvalZero NRF_NFCT_SENSRES_NFCID1_SIZE_SINGLE =
222*150812a8SEvalZero NFCT_SENSRES_NFCIDSIZE_NFCID1Single << NFCT_SENSRES_NFCIDSIZE_Pos, /**< Single size NFCID1 (4 bytes). */
223*150812a8SEvalZero NRF_NFCT_SENSRES_NFCID1_SIZE_DOUBLE =
224*150812a8SEvalZero NFCT_SENSRES_NFCIDSIZE_NFCID1Double << NFCT_SENSRES_NFCIDSIZE_Pos, /**< Double size NFCID1 (7 bytes). */
225*150812a8SEvalZero NRF_NFCT_SENSRES_NFCID1_SIZE_TRIPLE =
226*150812a8SEvalZero NFCT_SENSRES_NFCIDSIZE_NFCID1Triple << NFCT_SENSRES_NFCIDSIZE_Pos, /**< Triple size NFCID1 (10 bytes). */
227*150812a8SEvalZero NRF_NFCT_SENSRES_NFCID1_SIZE_DEFAULT =
228*150812a8SEvalZero NFCT_SENSRES_NFCIDSIZE_Msk /**< Default size. Use this option to leave NFCID1 size unchanged. */
229*150812a8SEvalZero } nrf_nfct_sensres_nfcid1_size_t;
230*150812a8SEvalZero
231*150812a8SEvalZero /**
232*150812a8SEvalZero * @brief 'Bit frame SDD' NFC field configuration for the SENS_RES frame according to the NFC Forum Digital Protocol Technical Specification.
233*150812a8SEvalZero */
234*150812a8SEvalZero typedef enum
235*150812a8SEvalZero {
236*150812a8SEvalZero NRF_NFCT_SENSRES_BIT_FRAME_SDD_00000 =
237*150812a8SEvalZero NFCT_SENSRES_BITFRAMESDD_SDD00000 << NFCT_SENSRES_BITFRAMESDD_Pos, /**< SDD pattern 00000. */
238*150812a8SEvalZero NRF_NFCT_SENSRES_BIT_FRAME_SDD_00001 =
239*150812a8SEvalZero NFCT_SENSRES_BITFRAMESDD_SDD00001 << NFCT_SENSRES_BITFRAMESDD_Pos, /**< SDD pattern 00001. */
240*150812a8SEvalZero NRF_NFCT_SENSRES_BIT_FRAME_SDD_00010 =
241*150812a8SEvalZero NFCT_SENSRES_BITFRAMESDD_SDD00010 << NFCT_SENSRES_BITFRAMESDD_Pos, /**< SDD pattern 00010. */
242*150812a8SEvalZero NRF_NFCT_SENSRES_BIT_FRAME_SDD_00100 =
243*150812a8SEvalZero NFCT_SENSRES_BITFRAMESDD_SDD00100 << NFCT_SENSRES_BITFRAMESDD_Pos, /**< SDD pattern 00100. */
244*150812a8SEvalZero NRF_NFCT_SENSRES_BIT_FRAME_SDD_01000 =
245*150812a8SEvalZero NFCT_SENSRES_BITFRAMESDD_SDD01000 << NFCT_SENSRES_BITFRAMESDD_Pos, /**< SDD pattern 01000. */
246*150812a8SEvalZero NRF_NFCT_SENSRES_BIT_FRAME_SDD_10000 =
247*150812a8SEvalZero NFCT_SENSRES_BITFRAMESDD_SDD10000 << NFCT_SENSRES_BITFRAMESDD_Pos /**< SDD pattern 10000. */
248*150812a8SEvalZero } nrf_nfct_sensres_bit_frame_sdd_t;
249*150812a8SEvalZero
250*150812a8SEvalZero /**
251*150812a8SEvalZero * @brief 'Platofrm Config' NFC field configuration for the SENS_RES frame according to the NFC Forum Digital Protocol Technical Specification.
252*150812a8SEvalZero */
253*150812a8SEvalZero typedef enum
254*150812a8SEvalZero {
255*150812a8SEvalZero /**< SENS_RES 'Platform Config' field (b4-b1) value for Type 1 Tag platform. */
256*150812a8SEvalZero NRF_NFCT_SENSRES_PLATFORM_CONFIG_T1T = 6 << NFCT_SENSRES_PLATFCONFIG_Pos,
257*150812a8SEvalZero /**< SENS_RES 'Platform Config' field (b7-b6) value for any platform except Type 1 Tag platform. */
258*150812a8SEvalZero NRF_NFCT_SENSRES_PLATFORM_CONFIG_OTHER = 0 << NFCT_SENSRES_PLATFCONFIG_Pos
259*150812a8SEvalZero } nrf_nfct_sensres_platform_config_t;
260*150812a8SEvalZero
261*150812a8SEvalZero /**
262*150812a8SEvalZero * @brief Bit masks for SEL_RES NFC frame configuration.
263*150812a8SEvalZero */
264*150812a8SEvalZero typedef enum
265*150812a8SEvalZero {
266*150812a8SEvalZero NRF_NFCT_SELRES_CASCADE_MASK = NFCT_SELRES_CASCADE_Msk, /**< SEL_RES Cascade field bit mask. */
267*150812a8SEvalZero NRF_NFCT_SELRES_PROTOCOL_MASK = NFCT_SELRES_PROTOCOL_Msk /**< SEL_RES Protocol field bit mask. */
268*150812a8SEvalZero } nrf_nfct_selres_t;
269*150812a8SEvalZero
270*150812a8SEvalZero /**
271*150812a8SEvalZero * @brief Protocol NFC field (bits b7 and b6) configuration for the SEL_RES frame according to the NFC Forum Digital Protocol Technical Specification.
272*150812a8SEvalZero */
273*150812a8SEvalZero typedef enum
274*150812a8SEvalZero {
275*150812a8SEvalZero NRF_NFCT_SELRES_PROTOCOL_T2T = 0, /**< Type 2 Tag platform. */
276*150812a8SEvalZero NRF_NFCT_SELRES_PROTOCOL_T4AT = 1, /**< Type 4A Tag platform. */
277*150812a8SEvalZero NRF_NFCT_SELRES_PROTOCOL_NFCDEP = 2, /**< NFC-DEP Protocol. */
278*150812a8SEvalZero NRF_NFCT_SELRES_PROTOCOL_NFCDEP_T4AT = 3, /**< NFC-DEP Protocol and Type 4A Tag platform). */
279*150812a8SEvalZero } nrf_nfct_selres_protocol_t;
280*150812a8SEvalZero
281*150812a8SEvalZero /**
282*150812a8SEvalZero * @brief Function for activating a specific NFCT task.
283*150812a8SEvalZero *
284*150812a8SEvalZero * @param[in] task Task.
285*150812a8SEvalZero */
286*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_task_trigger(nrf_nfct_task_t task);
287*150812a8SEvalZero
288*150812a8SEvalZero /**
289*150812a8SEvalZero * @brief Function for returning the address of a specific NFCT task register.
290*150812a8SEvalZero *
291*150812a8SEvalZero * @param[in] task Task.
292*150812a8SEvalZero *
293*150812a8SEvalZero * @return Task address.
294*150812a8SEvalZero */
295*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_task_address_get(nrf_nfct_task_t task);
296*150812a8SEvalZero
297*150812a8SEvalZero /**
298*150812a8SEvalZero * @brief Function for clearing a specific event.
299*150812a8SEvalZero *
300*150812a8SEvalZero * @param[in] event Event.
301*150812a8SEvalZero */
302*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_event_clear(nrf_nfct_event_t event);
303*150812a8SEvalZero
304*150812a8SEvalZero /**
305*150812a8SEvalZero * @brief Function for returning the state of a specific event.
306*150812a8SEvalZero *
307*150812a8SEvalZero * @param[in] event Event.
308*150812a8SEvalZero *
309*150812a8SEvalZero * @retval true If the event is set.
310*150812a8SEvalZero * @retval false If the event is not set.
311*150812a8SEvalZero */
312*150812a8SEvalZero __STATIC_INLINE bool nrf_nfct_event_check(nrf_nfct_event_t event);
313*150812a8SEvalZero
314*150812a8SEvalZero /**
315*150812a8SEvalZero * @brief Function for returning the address of a specific NFCT event register.
316*150812a8SEvalZero *
317*150812a8SEvalZero * @param[in] event Event.
318*150812a8SEvalZero *
319*150812a8SEvalZero * @return Address.
320*150812a8SEvalZero */
321*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_event_address_get(nrf_nfct_event_t event);
322*150812a8SEvalZero
323*150812a8SEvalZero /**
324*150812a8SEvalZero * @brief Function for enabling selected shortcuts.
325*150812a8SEvalZero *
326*150812a8SEvalZero * @param[in] short_mask Shortcut mask.
327*150812a8SEvalZero */
328*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_shorts_enable(uint32_t short_mask);
329*150812a8SEvalZero
330*150812a8SEvalZero /**
331*150812a8SEvalZero * @brief Function for disabling selected shortcuts.
332*150812a8SEvalZero *
333*150812a8SEvalZero * @param[in] short_mask Shortcut mask.
334*150812a8SEvalZero */
335*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_shorts_disable(uint32_t short_mask);
336*150812a8SEvalZero
337*150812a8SEvalZero /**
338*150812a8SEvalZero * @brief Function for retrieving the enabled shortcuts.
339*150812a8SEvalZero *
340*150812a8SEvalZero * @return Flags of the currently enabled shortcuts.
341*150812a8SEvalZero */
342*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_shorts_get(void);
343*150812a8SEvalZero
344*150812a8SEvalZero /**
345*150812a8SEvalZero * @brief Function for setting shortcuts.
346*150812a8SEvalZero *
347*150812a8SEvalZero * @param[in] short_mask Shortcut mask.
348*150812a8SEvalZero */
349*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_shorts_set(uint32_t short_mask);
350*150812a8SEvalZero
351*150812a8SEvalZero /**
352*150812a8SEvalZero * @brief Function for enabling the selected interrupts.
353*150812a8SEvalZero *
354*150812a8SEvalZero * @param[in] int_mask Interrupt mask.
355*150812a8SEvalZero */
356*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_int_enable(uint32_t int_mask);
357*150812a8SEvalZero
358*150812a8SEvalZero /**
359*150812a8SEvalZero * @brief Function for retrieving the state of the selected interrupts.
360*150812a8SEvalZero *
361*150812a8SEvalZero * @param[in] int_mask Interrupt mask.
362*150812a8SEvalZero *
363*150812a8SEvalZero * @retval true If any of the selected interrupts is enabled.
364*150812a8SEvalZero * @retval false If none of the selected interrupts is enabled.
365*150812a8SEvalZero */
366*150812a8SEvalZero __STATIC_INLINE bool nrf_nfct_int_enable_check(uint32_t int_mask);
367*150812a8SEvalZero
368*150812a8SEvalZero /**
369*150812a8SEvalZero * @brief Function for retrieving the information about enabled interrupts.
370*150812a8SEvalZero *
371*150812a8SEvalZero * @return The flags of the enabled interrupts.
372*150812a8SEvalZero */
373*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_int_enable_get(void);
374*150812a8SEvalZero
375*150812a8SEvalZero /**
376*150812a8SEvalZero * @brief Function for disabling the selected interrupts.
377*150812a8SEvalZero *
378*150812a8SEvalZero * @param[in] int_mask Interrupt mask.
379*150812a8SEvalZero */
380*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_int_disable(uint32_t int_mask);
381*150812a8SEvalZero
382*150812a8SEvalZero /**
383*150812a8SEvalZero * @brief Function for getting the NFCT error status.
384*150812a8SEvalZero *
385*150812a8SEvalZero * @return The NFCT error status flags, defined in @ref nrf_nfct_error_status_t.
386*150812a8SEvalZero */
387*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_error_status_get(void);
388*150812a8SEvalZero
389*150812a8SEvalZero /**
390*150812a8SEvalZero * @brief Function for clearing the NFCT error status.
391*150812a8SEvalZero *
392*150812a8SEvalZero * @param[in] error_flag Error flags to be cleared, defined in @ref nrf_nfct_error_status_t.
393*150812a8SEvalZero */
394*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_error_status_clear(uint32_t error_flag);
395*150812a8SEvalZero
396*150812a8SEvalZero /**
397*150812a8SEvalZero * @brief Function for getting the NFC frame reception status.
398*150812a8SEvalZero *
399*150812a8SEvalZero * @return The flags of the NFC frame reception status, defined in @ref nrf_nfct_rx_frame_status_t.
400*150812a8SEvalZero */
401*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_rx_frame_status_get(void);
402*150812a8SEvalZero
403*150812a8SEvalZero /**
404*150812a8SEvalZero * @brief Function for clearing the NFC frame reception status.
405*150812a8SEvalZero *
406*150812a8SEvalZero * @param[in] framestatus_flags Status flags to be cleared, defined in @ref nrf_nfct_rx_frame_status_t.
407*150812a8SEvalZero */
408*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_rx_frame_status_clear(uint32_t framestatus_flags);
409*150812a8SEvalZero
410*150812a8SEvalZero #if defined(NFCT_NFCTAGSTATE_NFCTAGSTATE_Msk) || defined(__NRFX_DOXYGEN__)
411*150812a8SEvalZero /**
412*150812a8SEvalZero * @brief Function for getting the NFC tag state.
413*150812a8SEvalZero *
414*150812a8SEvalZero * @retval NRF_NFCT_TAG_STATE_DISABLED NFC tag is disabled.
415*150812a8SEvalZero * @retval NRF_NFCT_TAG_STATE_RAMP_UP NFC tag is ramping up.
416*150812a8SEvalZero * @retval NRF_NFCT_TAG_STATE_IDLE NFC tag is activated and idle.
417*150812a8SEvalZero * @retval NRF_NFCT_TAG_STATE_RECEIVE NFC tag is receiving data.
418*150812a8SEvalZero * @retval NRF_NFCT_TAG_STATE_FRAME_DELAY Frame Delay Timer of the NFC tag is counting ticks
419*150812a8SEvalZero * since the last symbol of the last received frame.
420*150812a8SEvalZero * @retval NRF_NFCT_TAG_STATE_TRANSMIT NFC tag is transmitting data.
421*150812a8SEvalZero */
422*150812a8SEvalZero __STATIC_INLINE nrf_nfct_tag_state_t nrf_nfct_tag_state_get(void);
423*150812a8SEvalZero #endif // defined(NFCT_NFCTAGSTATE_NFCTAGSTATE_Msk) || defined(__NRFX_DOXYGEN__)
424*150812a8SEvalZero
425*150812a8SEvalZero #if defined (NFCT_SLEEPSTATE_SLEEPSTATE_Msk) || defined(__NRFX_DOXYGEN__)
426*150812a8SEvalZero /**
427*150812a8SEvalZero * @brief Function for getting the NFC tag sleep state during the automatic collision resolution.
428*150812a8SEvalZero *
429*150812a8SEvalZero * @details The returned value is the last state before the autimatic collision resolution started.
430*150812a8SEvalZero *
431*150812a8SEvalZero * @retval NRF_NFCT_SLEEP_STATE_IDLE NFC tag was in IDLE state before the automatic collision resolution started.
432*150812a8SEvalZero * @retval NRF_NFCT_SLEEP_STATE_SLEEP_A NFC tag was in SLEEP_A state before the automatic collision resolution started.
433*150812a8SEvalZero */
434*150812a8SEvalZero __STATIC_INLINE nrf_nfct_sleep_state_t nrf_nfct_sleep_state_get(void);
435*150812a8SEvalZero #endif // defined (NFCT_SLEEPSTATE_SLEEPSTATE_Msk) || defined(__NRFX_DOXYGEN__)
436*150812a8SEvalZero
437*150812a8SEvalZero /**
438*150812a8SEvalZero * @brief Function for getting the status of the external NFC field detection.
439*150812a8SEvalZero *
440*150812a8SEvalZero * @return The NFC field detection status. Status bits can be checked by using @ref nrf_nfct_field_state_t.
441*150812a8SEvalZero */
442*150812a8SEvalZero __STATIC_INLINE uint8_t nrf_nfct_field_status_get(void);
443*150812a8SEvalZero
444*150812a8SEvalZero /**
445*150812a8SEvalZero * @brief Function for getting the minimum Frame Delay Time value.
446*150812a8SEvalZero *
447*150812a8SEvalZero * @details This is the minimum value for Frame Delay Timer. It controls the shortest time between
448*150812a8SEvalZero * the last symbol of the last received frame and the start of the transmission of a new TX frame.
449*150812a8SEvalZero *
450*150812a8SEvalZero *
451*150812a8SEvalZero * @return The minimum Frame Delay Time value in 13.56-MHz clock ticks.
452*150812a8SEvalZero */
453*150812a8SEvalZero __STATIC_INLINE uint16_t nrf_nfct_frame_delay_min_get(void);
454*150812a8SEvalZero
455*150812a8SEvalZero /**
456*150812a8SEvalZero * @brief Function for setting the minimum Frame Delay Time value.
457*150812a8SEvalZero *
458*150812a8SEvalZero * @details This is the minimum value for Frame Delay Timer. It controls the shortest time between
459*150812a8SEvalZero * the last symbol of the last received frame and the start of the transmission of a new TX frame.
460*150812a8SEvalZero *
461*150812a8SEvalZero * @param[in] frame_delay_min Minimum Frame Delay Time value in 13.56-MHz clock ticks.
462*150812a8SEvalZero */
463*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_frame_delay_min_set(uint16_t frame_delay_min);
464*150812a8SEvalZero
465*150812a8SEvalZero /**
466*150812a8SEvalZero * @brief Function for getting the maximum Frame Delay Time value.
467*150812a8SEvalZero *
468*150812a8SEvalZero * @details This is the maximum value for Frame Delay Timer. It controls the longest time between
469*150812a8SEvalZero * the last symbol of the last received frame and the start of the transmission of a new TX frame.
470*150812a8SEvalZero * If no transmission starts before the Frame Delay Timer timeout,
471*150812a8SEvalZero * @ref NRF_NFCT_ERROR_FRAMEDELAYTIMEOUT_MASK is set.
472*150812a8SEvalZero *
473*150812a8SEvalZero * @return The maximum Frame Delay Time value in 13.56-MHz clock ticks.
474*150812a8SEvalZero */
475*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_frame_delay_max_get(void);
476*150812a8SEvalZero
477*150812a8SEvalZero /**
478*150812a8SEvalZero * @brief Function for setting the maximum Frame Delay Time value.
479*150812a8SEvalZero *
480*150812a8SEvalZero * @details This is the maximum value for Frame Delay Timer. It controls the longest time between
481*150812a8SEvalZero * the last symbol of the last received frame and the start of the transmission of a new TX frame.
482*150812a8SEvalZero * If no transmission starts before the Frame Delay Timer timeout,
483*150812a8SEvalZero * @ref NRF_NFCT_ERROR_FRAMEDELAYTIMEOUT_MASK is set.
484*150812a8SEvalZero *
485*150812a8SEvalZero * @param[in] frame_delay_max Maximum Frame Delay Time value in 13.56-MHz clock ticks.
486*150812a8SEvalZero */
487*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_frame_delay_max_set(uint32_t frame_delay_max);
488*150812a8SEvalZero
489*150812a8SEvalZero /**
490*150812a8SEvalZero * @brief Function for getting the Frame Delay Mode configuration.
491*150812a8SEvalZero *
492*150812a8SEvalZero * @return The configured Frame Delay Mode.
493*150812a8SEvalZero */
494*150812a8SEvalZero __STATIC_INLINE nrf_nfct_frame_delay_mode_t nrf_nfct_frame_delay_mode_get(void);
495*150812a8SEvalZero
496*150812a8SEvalZero /**
497*150812a8SEvalZero * @brief Function for setting the NFC Frame Delay Mode configuration.
498*150812a8SEvalZero *
499*150812a8SEvalZero * @param[in] frame_delay_mode Frame Delay Mode configuration.
500*150812a8SEvalZero */
501*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_frame_delay_mode_set(nrf_nfct_frame_delay_mode_t frame_delay_mode);
502*150812a8SEvalZero
503*150812a8SEvalZero /**
504*150812a8SEvalZero * @brief Function for getting the pointer to the NFCT RX/TX buffer.
505*150812a8SEvalZero *
506*150812a8SEvalZero * @return The configured pointer to the receive or transmit buffer.
507*150812a8SEvalZero */
508*150812a8SEvalZero __STATIC_INLINE uint8_t * nrf_nfct_rxtx_buffer_get(void);
509*150812a8SEvalZero
510*150812a8SEvalZero /**
511*150812a8SEvalZero * @brief Function for setting the the NFCT RX/TX buffer (address and maximum length).
512*150812a8SEvalZero *
513*150812a8SEvalZero * @note Buffer for the NFC RX/TX data is used by EasyDMA and must be located in RAM.
514*150812a8SEvalZero *
515*150812a8SEvalZero * @param[in] p_rxtx_buf Pointer to the receive or transmit buffer.
516*150812a8SEvalZero * @param[in] max_txrx_len Maximum receive or transmit length in bytes (size of the RAM buffer for EasyDMA).
517*150812a8SEvalZero */
518*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_rxtx_buffer_set(uint8_t * p_rxtx_buf,
519*150812a8SEvalZero uint16_t max_txrx_len);
520*150812a8SEvalZero
521*150812a8SEvalZero /**
522*150812a8SEvalZero * @brief Function for getting the NFCT RX/TX maximum buffer length.
523*150812a8SEvalZero *
524*150812a8SEvalZero * @return The configured maximum receive or transmit length in bytes (size of the RX/TX buffer for EasyDMA).
525*150812a8SEvalZero */
526*150812a8SEvalZero __STATIC_INLINE uint16_t nrf_nfct_max_rxtx_length_get(void);
527*150812a8SEvalZero
528*150812a8SEvalZero /**
529*150812a8SEvalZero * @brief Function for getting the flags for NFC frame transmission configuration.
530*150812a8SEvalZero *
531*150812a8SEvalZero * @return The flags of the NFCT frame transmission configuration, defined in @ref nrf_nfct_tx_frame_config_t.
532*150812a8SEvalZero */
533*150812a8SEvalZero __STATIC_INLINE uint8_t nrf_nfct_tx_frame_config_get(void);
534*150812a8SEvalZero
535*150812a8SEvalZero /**
536*150812a8SEvalZero * @brief Function for setting up the flags of the NFC frame transmission configuration.
537*150812a8SEvalZero *
538*150812a8SEvalZero * @param[in] flags Flags for NFCT TX configuration. Use @ref nrf_nfct_tx_frame_config_t for setting.
539*150812a8SEvalZero */
540*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_tx_frame_config_set(uint8_t flags);
541*150812a8SEvalZero
542*150812a8SEvalZero /**
543*150812a8SEvalZero * @brief Function for getting the length of the configured transmission frame.
544*150812a8SEvalZero *
545*150812a8SEvalZero * @note NFC frames do not have to consist of full bytes only, therefore data amount for transmission
546*150812a8SEvalZero * is configured in number of bits.
547*150812a8SEvalZero *
548*150812a8SEvalZero * @return Number of bits to be sent excluding CRC, parity, SoF, and EoF.
549*150812a8SEvalZero */
550*150812a8SEvalZero __STATIC_INLINE uint16_t nrf_nfct_tx_bits_get(void);
551*150812a8SEvalZero
552*150812a8SEvalZero /**
553*150812a8SEvalZero * @brief Function for setting up the NFC frame transmission.
554*150812a8SEvalZero *
555*150812a8SEvalZero * @details Set the number of TX bits excluding CRC, parity, SoF, and EoF.
556*150812a8SEvalZero *
557*150812a8SEvalZero * @note Source of data for transmission is set by using @ref nrf_nfct_rxtx_buffer_set.
558*150812a8SEvalZero * @note NFC frames do not have to consist of full bytes only, therefore data amount for transmission
559*150812a8SEvalZero * is configured in number of bits.
560*150812a8SEvalZero *
561*150812a8SEvalZero * @param[in] tx_bits Overall number of bits to be sent.
562*150812a8SEvalZero */
563*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_tx_bits_set(uint16_t tx_bits);
564*150812a8SEvalZero
565*150812a8SEvalZero /**
566*150812a8SEvalZero * @brief Function for getting the flags of the NFC frame reception configuration.
567*150812a8SEvalZero *
568*150812a8SEvalZero * @return The flags for NFCT frame reception configuration, defined in @ref nrf_nfct_rx_frame_config_t.
569*150812a8SEvalZero */
570*150812a8SEvalZero __STATIC_INLINE uint8_t nrf_nfct_rx_frame_config_get(void);
571*150812a8SEvalZero
572*150812a8SEvalZero /**
573*150812a8SEvalZero * @brief Function for setting up the NFC frame reception.
574*150812a8SEvalZero *
575*150812a8SEvalZero * @note Destination for the received data is set using @ref nrf_nfct_rxtx_buffer_set.
576*150812a8SEvalZero *
577*150812a8SEvalZero * @param[in] flags NFCT RX configuration flags. Use @ref nrf_nfct_rx_frame_config_t for setting
578*150812a8SEvalZero * the desired configuration.
579*150812a8SEvalZero */
580*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_rx_frame_config_set(uint8_t flags);
581*150812a8SEvalZero
582*150812a8SEvalZero /**
583*150812a8SEvalZero * @brief Function for getting the number of bits received from the NFC poller.
584*150812a8SEvalZero *
585*150812a8SEvalZero * @param[in] crc_excluded Flag for excluding CRC size from calculation.
586*150812a8SEvalZero *
587*150812a8SEvalZero * @return Number of received bits including or excluding CRC, and excluding parity and SoF/EoF framing.
588*150812a8SEvalZero */
589*150812a8SEvalZero __STATIC_INLINE uint16_t nrf_nfct_rx_bits_get(bool crc_excluded);
590*150812a8SEvalZero
591*150812a8SEvalZero /**
592*150812a8SEvalZero * @brief Function for getting the NFCID1 (NFC tag identifier).
593*150812a8SEvalZero *
594*150812a8SEvalZero * @note This function always returns the full configuration of the NFCID1 setting (10 bytes), regardless
595*150812a8SEvalZero * of the NFCID1 size. The NFCID1 size can be configured using @ref nrf_nfct_sensres_nfcid1_size_set or
596*150812a8SEvalZero * @ref nrf_nfct_nfcid1_set.
597*150812a8SEvalZero *
598*150812a8SEvalZero * @param[out] p_nfcid1_buf Pointer to a buffer for the NDFCID1 parameter. The NFCID1 values are in
599*150812a8SEvalZero * little endian order, that is: |NFCID1_3RD_LAST|NFCID1_2ND_LAST|NFCID1_LAST|.
600*150812a8SEvalZero *
601*150812a8SEvalZero * @return Configured NFCID1 length
602*150812a8SEvalZero */
603*150812a8SEvalZero __STATIC_INLINE nrf_nfct_sensres_nfcid1_size_t nrf_nfct_nfcid1_get(uint8_t * p_nfcid1_buf);
604*150812a8SEvalZero
605*150812a8SEvalZero /**
606*150812a8SEvalZero * @brief Function for setting the NFCID1 (NFC tag identifier).
607*150812a8SEvalZero *
608*150812a8SEvalZero * @note This function also configures the NFCIDSIZE field in the SENSRES register of the NRF_NFCT peripheral.
609*150812a8SEvalZero *
610*150812a8SEvalZero * @param[in] p_nfcid1_buf Pointer to the buffer with NDFCID1 bytes.
611*150812a8SEvalZero * @param[in] nfcid1_size Size of the NFCID1 in bytes.
612*150812a8SEvalZero */
613*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_nfcid1_set(uint8_t const * p_nfcid1_buf,
614*150812a8SEvalZero nrf_nfct_sensres_nfcid1_size_t nfcid1_size);
615*150812a8SEvalZero
616*150812a8SEvalZero #if defined (NFCT_AUTOCOLRESCONFIG_MODE_Msk) || defined(__NRFX_DOXYGEN__)
617*150812a8SEvalZero /**
618*150812a8SEvalZero * @brief Function for getting the setting for the automatic collision resolution.
619*150812a8SEvalZero *
620*150812a8SEvalZero * @details The automatic collision resolution mechanism as defined in ISO 14443-3 and NFC Forum
621*150812a8SEvalZero * Digital Protocol Technical Specification 2.0, section 6.
622*150812a8SEvalZero *
623*150812a8SEvalZero * @retval true If automatic collision resolution is enabled.
624*150812a8SEvalZero * @retval false If automatic collision resolution is disabled.
625*150812a8SEvalZero */
626*150812a8SEvalZero __STATIC_INLINE bool nrf_nfct_autocolres_is_enabled(void);
627*150812a8SEvalZero
628*150812a8SEvalZero /**
629*150812a8SEvalZero * @brief Function for enabling the automatic collision resolution.
630*150812a8SEvalZero *
631*150812a8SEvalZero * @details The automatic collision resolution mechanism as defined in ISO 14443-3 and NFC Forum
632*150812a8SEvalZero * Digital Protocol Technical Specification 2.0, section 6.
633*150812a8SEvalZero */
634*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_autocolres_enable(void);
635*150812a8SEvalZero
636*150812a8SEvalZero /**
637*150812a8SEvalZero * @brief Function for disabling the automatic collision resolution.
638*150812a8SEvalZero *
639*150812a8SEvalZero * @details The automatic collision resolution mechanism as defined in ISO 14443-3 and NFC Forum
640*150812a8SEvalZero * Digital Protocol Technical Specification 2.0, section 6.
641*150812a8SEvalZero */
642*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_autocolres_disable(void);
643*150812a8SEvalZero #endif // defined (NFCT_AUTOCOLRESCONFIG_MODE_Msk) || defined(__NRFX_DOXYGEN__)
644*150812a8SEvalZero
645*150812a8SEvalZero /**
646*150812a8SEvalZero * @brief Function for getting the NFCID1 size from the SENS_RES frame configuration.
647*150812a8SEvalZero *
648*150812a8SEvalZero * @details The SENS_RES frame is handled automatically by the NFCT hardware.
649*150812a8SEvalZero *
650*150812a8SEvalZero * @return NFCID1 (tag identifier) size.
651*150812a8SEvalZero */
652*150812a8SEvalZero __STATIC_INLINE nrf_nfct_sensres_nfcid1_size_t nrf_nfct_sensres_nfcid1_size_get(void);
653*150812a8SEvalZero
654*150812a8SEvalZero /**
655*150812a8SEvalZero * @brief Function for setting the NFCID1 (tag identifier) size.field in the SENS_RES frame
656*150812a8SEvalZero * configuration.
657*150812a8SEvalZero *
658*150812a8SEvalZero * @note The SENS_RES frame is handled automatically by the NFCT hardware.
659*150812a8SEvalZero *
660*150812a8SEvalZero * @param[in] nfcid1_size NFCID1 (tag identifier) size.
661*150812a8SEvalZero *
662*150812a8SEvalZero * @sa nrf_nfct_nfcid1_set()
663*150812a8SEvalZero */
664*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_sensres_nfcid1_size_set(nrf_nfct_sensres_nfcid1_size_t nfcid1_size);
665*150812a8SEvalZero
666*150812a8SEvalZero /**
667*150812a8SEvalZero * @brief Function for getting the Bit Frame SDD field from the SENS_RES frame configuration.
668*150812a8SEvalZero *
669*150812a8SEvalZero * @details The SENS_RES frame is handled automatically by the NFCT hardware.
670*150812a8SEvalZero *
671*150812a8SEvalZero * @return The Bit Frame SDD field configuration.
672*150812a8SEvalZero */
673*150812a8SEvalZero __STATIC_INLINE nrf_nfct_sensres_bit_frame_sdd_t nrf_nfct_sensres_bit_frame_sdd_get(void);
674*150812a8SEvalZero
675*150812a8SEvalZero /**
676*150812a8SEvalZero * @brief Function for setting the Bit Frame SDD field in the SENS_RES frame configuration.
677*150812a8SEvalZero *
678*150812a8SEvalZero * @note The SENS_RES frame is handled automatically by the NFCT hardware.
679*150812a8SEvalZero *
680*150812a8SEvalZero * @param[in] bit_frame_sdd The Bit Frame SDD field configuration.
681*150812a8SEvalZero */
682*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_sensres_bit_frame_sdd_set(nrf_nfct_sensres_bit_frame_sdd_t bit_frame_sdd);
683*150812a8SEvalZero
684*150812a8SEvalZero /**
685*150812a8SEvalZero * @brief Function for getting the Platform Config field from the SENS_RES frame configuration.
686*150812a8SEvalZero *
687*150812a8SEvalZero * @details The SENS_RES frame is handled automatically by the NFCT hardware.
688*150812a8SEvalZero *
689*150812a8SEvalZero * @return The Platform Config field configuration.
690*150812a8SEvalZero */
691*150812a8SEvalZero __STATIC_INLINE nrf_nfct_sensres_platform_config_t nrf_nfct_sensres_platform_config_get(void);
692*150812a8SEvalZero
693*150812a8SEvalZero /**
694*150812a8SEvalZero * @brief Function for setting the Platform Config field in the SENS_RES frame configuration.
695*150812a8SEvalZero *
696*150812a8SEvalZero * @note The SENS_RES frame is handled automatically by the NFCT hardware.
697*150812a8SEvalZero *
698*150812a8SEvalZero * @param[in] platform_config The Platform Config field configuration.
699*150812a8SEvalZero */
700*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_sensres_platform_config_set(nrf_nfct_sensres_platform_config_t platform_config);
701*150812a8SEvalZero
702*150812a8SEvalZero /**
703*150812a8SEvalZero * @brief Function for checking the CASCADE bit of the SEL_RES frame.
704*150812a8SEvalZero *
705*150812a8SEvalZero * @details The CASCADE bit in the SEL_RES register is handled automatically by the NFCT hardware
706*150812a8SEvalZero * and indicates the status of the NFCID1 read operation to the NFC poller according to
707*150812a8SEvalZero * the NFC Forum Digital Protocol Speficiation 2.0, section 6.8.2.
708*150812a8SEvalZero *
709*150812a8SEvalZero * @retval true If NFCID1 read procedure is not complete.
710*150812a8SEvalZero * @retval false If NFCID1 read procedure is complete.
711*150812a8SEvalZero */
712*150812a8SEvalZero __STATIC_INLINE bool nrf_nfct_selsres_cascade_check(void);
713*150812a8SEvalZero
714*150812a8SEvalZero /**
715*150812a8SEvalZero * @brief Function for getting the Protocol field in the SEL_RES frame.
716*150812a8SEvalZero *
717*150812a8SEvalZero * @details The SEL_RES frame is handled automatically by the NFCT hardware.
718*150812a8SEvalZero *
719*150812a8SEvalZero * @return Value of the Protocol field in the SEL_RES frame.
720*150812a8SEvalZero */
721*150812a8SEvalZero __STATIC_INLINE nrf_nfct_selres_protocol_t nrf_nfct_selsres_protocol_get(void);
722*150812a8SEvalZero
723*150812a8SEvalZero /**
724*150812a8SEvalZero * @brief Function for setting the Protocol field in the SEL_RES frame configuration.
725*150812a8SEvalZero *
726*150812a8SEvalZero * @details The SEL_RES frame is handled automatically by the NFCT hardware.
727*150812a8SEvalZero *
728*150812a8SEvalZero * @param[in] sel_res_protocol Value of the Protocol field in the SEL_RES frame.
729*150812a8SEvalZero */
730*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_selres_protocol_set(nrf_nfct_selres_protocol_t sel_res_protocol);
731*150812a8SEvalZero
732*150812a8SEvalZero #ifndef SUPPRESS_INLINE_IMPLEMENTATION
nrf_nfct_task_trigger(nrf_nfct_task_t task)733*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_task_trigger(nrf_nfct_task_t task)
734*150812a8SEvalZero {
735*150812a8SEvalZero *((volatile uint32_t *)((uint8_t *)NRF_NFCT + (uint32_t)task)) = 1UL;
736*150812a8SEvalZero }
737*150812a8SEvalZero
nrf_nfct_task_address_get(nrf_nfct_task_t task)738*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_task_address_get(nrf_nfct_task_t task)
739*150812a8SEvalZero {
740*150812a8SEvalZero return (uint32_t)((uint8_t *)NRF_NFCT + (uint32_t)task);
741*150812a8SEvalZero }
742*150812a8SEvalZero
nrf_nfct_event_clear(nrf_nfct_event_t event)743*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_event_clear(nrf_nfct_event_t event)
744*150812a8SEvalZero {
745*150812a8SEvalZero *((volatile uint32_t *)((uint8_t *)NRF_NFCT + (uint32_t)event)) = 0UL;
746*150812a8SEvalZero __DSB();
747*150812a8SEvalZero }
748*150812a8SEvalZero
nrf_nfct_event_check(nrf_nfct_event_t event)749*150812a8SEvalZero __STATIC_INLINE bool nrf_nfct_event_check(nrf_nfct_event_t event)
750*150812a8SEvalZero {
751*150812a8SEvalZero return (bool)*(volatile const uint32_t *)((uint8_t *)NRF_NFCT + (uint32_t)event);
752*150812a8SEvalZero }
753*150812a8SEvalZero
nrf_nfct_event_address_get(nrf_nfct_event_t event)754*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_event_address_get(nrf_nfct_event_t event)
755*150812a8SEvalZero {
756*150812a8SEvalZero return (uint32_t)((uint8_t *)NRF_NFCT + (uint32_t)event);
757*150812a8SEvalZero }
758*150812a8SEvalZero
nrf_nfct_shorts_enable(uint32_t short_mask)759*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_shorts_enable(uint32_t short_mask)
760*150812a8SEvalZero {
761*150812a8SEvalZero NRF_NFCT->SHORTS |= short_mask;
762*150812a8SEvalZero }
763*150812a8SEvalZero
nrf_nfct_shorts_disable(uint32_t short_mask)764*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_shorts_disable(uint32_t short_mask)
765*150812a8SEvalZero {
766*150812a8SEvalZero NRF_NFCT->SHORTS &= ~short_mask;
767*150812a8SEvalZero }
768*150812a8SEvalZero
nrf_nfct_shorts_get(void)769*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_shorts_get(void)
770*150812a8SEvalZero {
771*150812a8SEvalZero return NRF_NFCT->SHORTS;
772*150812a8SEvalZero }
773*150812a8SEvalZero
nrf_nfct_shorts_set(uint32_t short_mask)774*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_shorts_set(uint32_t short_mask)
775*150812a8SEvalZero {
776*150812a8SEvalZero NRF_NFCT->SHORTS = short_mask;
777*150812a8SEvalZero }
778*150812a8SEvalZero
nrf_nfct_int_enable(uint32_t int_mask)779*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_int_enable(uint32_t int_mask)
780*150812a8SEvalZero {
781*150812a8SEvalZero NRF_NFCT->INTENSET = int_mask;
782*150812a8SEvalZero }
783*150812a8SEvalZero
nrf_nfct_int_enable_check(uint32_t int_mask)784*150812a8SEvalZero __STATIC_INLINE bool nrf_nfct_int_enable_check(uint32_t int_mask)
785*150812a8SEvalZero {
786*150812a8SEvalZero return (bool)(NRF_NFCT->INTENSET & int_mask);
787*150812a8SEvalZero }
788*150812a8SEvalZero
nrf_nfct_int_enable_get(void)789*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_int_enable_get(void)
790*150812a8SEvalZero {
791*150812a8SEvalZero return NRF_NFCT->INTENSET;
792*150812a8SEvalZero }
793*150812a8SEvalZero
nrf_nfct_int_disable(uint32_t int_mask)794*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_int_disable(uint32_t int_mask)
795*150812a8SEvalZero {
796*150812a8SEvalZero NRF_NFCT->INTENCLR = int_mask;
797*150812a8SEvalZero }
798*150812a8SEvalZero
nrf_nfct_error_status_get(void)799*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_error_status_get(void)
800*150812a8SEvalZero {
801*150812a8SEvalZero return NRF_NFCT->ERRORSTATUS;
802*150812a8SEvalZero }
803*150812a8SEvalZero
nrf_nfct_error_status_clear(uint32_t error_flags)804*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_error_status_clear(uint32_t error_flags)
805*150812a8SEvalZero {
806*150812a8SEvalZero NRF_NFCT->ERRORSTATUS = error_flags;
807*150812a8SEvalZero }
808*150812a8SEvalZero
nrf_nfct_rx_frame_status_get(void)809*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_rx_frame_status_get(void)
810*150812a8SEvalZero {
811*150812a8SEvalZero return NRF_NFCT->FRAMESTATUS.RX;
812*150812a8SEvalZero }
813*150812a8SEvalZero
nrf_nfct_rx_frame_status_clear(uint32_t framestatus_flags)814*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_rx_frame_status_clear(uint32_t framestatus_flags)
815*150812a8SEvalZero {
816*150812a8SEvalZero NRF_NFCT->FRAMESTATUS.RX = framestatus_flags;
817*150812a8SEvalZero }
818*150812a8SEvalZero
819*150812a8SEvalZero #if defined(NFCT_NFCTAGSTATE_NFCTAGSTATE_Msk) || defined(__NRFX_DOXYGEN__)
nrf_nfct_tag_state_get(void)820*150812a8SEvalZero __STATIC_INLINE nrf_nfct_tag_state_t nrf_nfct_tag_state_get(void)
821*150812a8SEvalZero {
822*150812a8SEvalZero return (nrf_nfct_tag_state_t)((NRF_NFCT->NFCTAGSTATE & NFCT_NFCTAGSTATE_NFCTAGSTATE_Msk) >>
823*150812a8SEvalZero NFCT_NFCTAGSTATE_NFCTAGSTATE_Pos);
824*150812a8SEvalZero }
825*150812a8SEvalZero #endif // defined(NFCT_NFCTAGSTATE_NFCTAGSTATE_Msk) || defined(__NRFX_DOXYGEN__)
826*150812a8SEvalZero
827*150812a8SEvalZero #if defined (NFCT_SLEEPSTATE_SLEEPSTATE_Msk) || defined(__NRFX_DOXYGEN__)
nrf_nfct_sleep_state_get(void)828*150812a8SEvalZero __STATIC_INLINE nrf_nfct_sleep_state_t nrf_nfct_sleep_state_get(void)
829*150812a8SEvalZero {
830*150812a8SEvalZero return (nrf_nfct_sleep_state_t)((NRF_NFCT->SLEEPSTATE & NFCT_SLEEPSTATE_SLEEPSTATE_Msk) >>
831*150812a8SEvalZero NFCT_SLEEPSTATE_SLEEPSTATE_Pos);
832*150812a8SEvalZero }
833*150812a8SEvalZero #endif // defined (NFCT_SLEEPSTATE_SLEEPSTATE_Msk) || defined(__NRFX_DOXYGEN__)
834*150812a8SEvalZero
nrf_nfct_field_status_get(void)835*150812a8SEvalZero __STATIC_INLINE uint8_t nrf_nfct_field_status_get(void)
836*150812a8SEvalZero {
837*150812a8SEvalZero return (uint8_t)(NRF_NFCT->FIELDPRESENT);
838*150812a8SEvalZero }
839*150812a8SEvalZero
nrf_nfct_frame_delay_min_get(void)840*150812a8SEvalZero __STATIC_INLINE uint16_t nrf_nfct_frame_delay_min_get(void)
841*150812a8SEvalZero {
842*150812a8SEvalZero return (uint16_t)((NRF_NFCT->FRAMEDELAYMIN & NFCT_FRAMEDELAYMIN_FRAMEDELAYMIN_Msk) >>
843*150812a8SEvalZero NFCT_FRAMEDELAYMIN_FRAMEDELAYMIN_Pos);
844*150812a8SEvalZero }
845*150812a8SEvalZero
nrf_nfct_frame_delay_min_set(uint16_t frame_delay_min)846*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_frame_delay_min_set(uint16_t frame_delay_min)
847*150812a8SEvalZero {
848*150812a8SEvalZero NRF_NFCT->FRAMEDELAYMIN =
849*150812a8SEvalZero ((uint32_t)frame_delay_min << NFCT_FRAMEDELAYMIN_FRAMEDELAYMIN_Pos) &
850*150812a8SEvalZero NFCT_FRAMEDELAYMIN_FRAMEDELAYMIN_Msk;
851*150812a8SEvalZero }
852*150812a8SEvalZero
nrf_nfct_frame_delay_max_get(void)853*150812a8SEvalZero __STATIC_INLINE uint32_t nrf_nfct_frame_delay_max_get(void)
854*150812a8SEvalZero {
855*150812a8SEvalZero return (NRF_NFCT->FRAMEDELAYMAX & NFCT_FRAMEDELAYMAX_FRAMEDELAYMAX_Msk) >>
856*150812a8SEvalZero NFCT_FRAMEDELAYMAX_FRAMEDELAYMAX_Pos;
857*150812a8SEvalZero }
858*150812a8SEvalZero
nrf_nfct_frame_delay_max_set(uint32_t frame_delay_max)859*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_frame_delay_max_set(uint32_t frame_delay_max)
860*150812a8SEvalZero {
861*150812a8SEvalZero NRF_NFCT->FRAMEDELAYMAX =
862*150812a8SEvalZero ((uint32_t)frame_delay_max << NFCT_FRAMEDELAYMAX_FRAMEDELAYMAX_Pos) &
863*150812a8SEvalZero NFCT_FRAMEDELAYMAX_FRAMEDELAYMAX_Msk;
864*150812a8SEvalZero }
865*150812a8SEvalZero
nrf_nfct_frame_delay_mode_get(void)866*150812a8SEvalZero __STATIC_INLINE nrf_nfct_frame_delay_mode_t nrf_nfct_frame_delay_mode_get(void)
867*150812a8SEvalZero {
868*150812a8SEvalZero return (nrf_nfct_frame_delay_mode_t)(NRF_NFCT->FRAMEDELAYMODE &
869*150812a8SEvalZero NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_Msk);
870*150812a8SEvalZero }
871*150812a8SEvalZero
nrf_nfct_frame_delay_mode_set(nrf_nfct_frame_delay_mode_t frame_delay_mode)872*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_frame_delay_mode_set(nrf_nfct_frame_delay_mode_t frame_delay_mode)
873*150812a8SEvalZero {
874*150812a8SEvalZero NRF_NFCT->FRAMEDELAYMODE = (uint32_t)frame_delay_mode;
875*150812a8SEvalZero }
876*150812a8SEvalZero
nrf_nfct_rxtx_buffer_get(void)877*150812a8SEvalZero __STATIC_INLINE uint8_t * nrf_nfct_rxtx_buffer_get(void)
878*150812a8SEvalZero {
879*150812a8SEvalZero return (uint8_t *)(NRF_NFCT->PACKETPTR);
880*150812a8SEvalZero }
881*150812a8SEvalZero
nrf_nfct_rxtx_buffer_set(uint8_t * p_rxtx_buf,uint16_t max_txrx_len)882*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_rxtx_buffer_set(uint8_t * p_rxtx_buf,
883*150812a8SEvalZero uint16_t max_txrx_len)
884*150812a8SEvalZero {
885*150812a8SEvalZero NRF_NFCT->PACKETPTR = (uint32_t)p_rxtx_buf;
886*150812a8SEvalZero NRF_NFCT->MAXLEN = ((uint32_t)max_txrx_len << NFCT_MAXLEN_MAXLEN_Pos) &
887*150812a8SEvalZero NFCT_MAXLEN_MAXLEN_Msk;
888*150812a8SEvalZero }
889*150812a8SEvalZero
nrf_nfct_max_rxtx_length_get(void)890*150812a8SEvalZero __STATIC_INLINE uint16_t nrf_nfct_max_rxtx_length_get(void)
891*150812a8SEvalZero {
892*150812a8SEvalZero return (uint16_t)((NRF_NFCT->MAXLEN & NFCT_MAXLEN_MAXLEN_Msk) >> NFCT_MAXLEN_MAXLEN_Pos);
893*150812a8SEvalZero }
894*150812a8SEvalZero
nrf_nfct_tx_frame_config_get(void)895*150812a8SEvalZero __STATIC_INLINE uint8_t nrf_nfct_tx_frame_config_get(void)
896*150812a8SEvalZero {
897*150812a8SEvalZero return (uint8_t)(NRF_NFCT->TXD.FRAMECONFIG);
898*150812a8SEvalZero }
899*150812a8SEvalZero
nrf_nfct_tx_frame_config_set(uint8_t flags)900*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_tx_frame_config_set(uint8_t flags)
901*150812a8SEvalZero {
902*150812a8SEvalZero NRF_NFCT->TXD.FRAMECONFIG = flags;
903*150812a8SEvalZero }
904*150812a8SEvalZero
nrf_nfct_tx_bits_get(void)905*150812a8SEvalZero __STATIC_INLINE uint16_t nrf_nfct_tx_bits_get(void)
906*150812a8SEvalZero {
907*150812a8SEvalZero return (uint16_t)(NRF_NFCT->TXD.AMOUNT & (NFCT_TXD_AMOUNT_TXDATABITS_Msk |
908*150812a8SEvalZero NFCT_TXD_AMOUNT_TXDATABYTES_Msk));
909*150812a8SEvalZero }
910*150812a8SEvalZero
nrf_nfct_tx_bits_set(uint16_t tx_bits)911*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_tx_bits_set(uint16_t tx_bits)
912*150812a8SEvalZero {
913*150812a8SEvalZero NRF_NFCT->TXD.AMOUNT = (tx_bits & (NFCT_TXD_AMOUNT_TXDATABITS_Msk | NFCT_TXD_AMOUNT_TXDATABYTES_Msk));
914*150812a8SEvalZero }
915*150812a8SEvalZero
nrf_nfct_rx_frame_config_get(void)916*150812a8SEvalZero __STATIC_INLINE uint8_t nrf_nfct_rx_frame_config_get(void)
917*150812a8SEvalZero {
918*150812a8SEvalZero return (uint8_t)(NRF_NFCT->RXD.FRAMECONFIG);
919*150812a8SEvalZero }
920*150812a8SEvalZero
nrf_nfct_rx_frame_config_set(uint8_t flags)921*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_rx_frame_config_set(uint8_t flags)
922*150812a8SEvalZero {
923*150812a8SEvalZero NRF_NFCT->RXD.FRAMECONFIG = flags;
924*150812a8SEvalZero }
925*150812a8SEvalZero
nrf_nfct_rx_bits_get(bool crc_excluded)926*150812a8SEvalZero __STATIC_INLINE uint16_t nrf_nfct_rx_bits_get(bool crc_excluded)
927*150812a8SEvalZero {
928*150812a8SEvalZero uint16_t rx_bits = NRF_NFCT->RXD.AMOUNT & (NFCT_RXD_AMOUNT_RXDATABITS_Msk |
929*150812a8SEvalZero NFCT_RXD_AMOUNT_RXDATABYTES_Msk);
930*150812a8SEvalZero return rx_bits - (crc_excluded ? (8u * NRF_NFCT_CRC_SIZE) : 0);
931*150812a8SEvalZero }
932*150812a8SEvalZero
nrf_nfct_nfcid1_get(uint8_t * p_nfcid1_buf)933*150812a8SEvalZero __STATIC_INLINE nrf_nfct_sensres_nfcid1_size_t nrf_nfct_nfcid1_get(uint8_t * p_nfcid1_buf)
934*150812a8SEvalZero {
935*150812a8SEvalZero uint32_t nfcid1_last = NRF_NFCT->NFCID1_LAST;
936*150812a8SEvalZero nrf_nfct_sensres_nfcid1_size_t size =
937*150812a8SEvalZero (nrf_nfct_sensres_nfcid1_size_t)(NRF_NFCT->SENSRES & NFCT_SENSRES_NFCIDSIZE_Msk);
938*150812a8SEvalZero
939*150812a8SEvalZero if (size != NRF_NFCT_SENSRES_NFCID1_SIZE_SINGLE)
940*150812a8SEvalZero {
941*150812a8SEvalZero uint32_t nfcid1_2nd_last = NRF_NFCT->NFCID1_2ND_LAST;
942*150812a8SEvalZero
943*150812a8SEvalZero if (size == NRF_NFCT_SENSRES_NFCID1_SIZE_TRIPLE)
944*150812a8SEvalZero {
945*150812a8SEvalZero uint32_t nfcid1_3rd_last = NRF_NFCT->NFCID1_3RD_LAST;
946*150812a8SEvalZero
947*150812a8SEvalZero *p_nfcid1_buf++ = (uint8_t)(nfcid1_3rd_last >> 16UL);
948*150812a8SEvalZero *p_nfcid1_buf++ = (uint8_t)(nfcid1_3rd_last >> 8UL);
949*150812a8SEvalZero *p_nfcid1_buf++ = (uint8_t)(nfcid1_3rd_last >> 0UL);
950*150812a8SEvalZero }
951*150812a8SEvalZero
952*150812a8SEvalZero *p_nfcid1_buf++ = (uint8_t)(nfcid1_2nd_last >> 16UL);
953*150812a8SEvalZero *p_nfcid1_buf++ = (uint8_t)(nfcid1_2nd_last >> 8UL);
954*150812a8SEvalZero *p_nfcid1_buf++ = (uint8_t)(nfcid1_2nd_last >> 0UL);
955*150812a8SEvalZero }
956*150812a8SEvalZero
957*150812a8SEvalZero *p_nfcid1_buf++ = (uint8_t)(nfcid1_last >> 24UL);
958*150812a8SEvalZero *p_nfcid1_buf++ = (uint8_t)(nfcid1_last >> 16UL);
959*150812a8SEvalZero *p_nfcid1_buf++ = (uint8_t)(nfcid1_last >> 8UL);
960*150812a8SEvalZero *p_nfcid1_buf++ = (uint8_t)(nfcid1_last >> 0UL);
961*150812a8SEvalZero
962*150812a8SEvalZero return size;
963*150812a8SEvalZero }
964*150812a8SEvalZero
nrf_nfct_nfcid1_set(uint8_t const * p_nfcid1_buf,nrf_nfct_sensres_nfcid1_size_t nfcid1_size)965*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_nfcid1_set(uint8_t const * p_nfcid1_buf,
966*150812a8SEvalZero nrf_nfct_sensres_nfcid1_size_t nfcid1_size)
967*150812a8SEvalZero {
968*150812a8SEvalZero nrf_nfct_sensres_nfcid1_size_t size = (nfcid1_size == NRF_NFCT_SENSRES_NFCID1_SIZE_DEFAULT) ?
969*150812a8SEvalZero NRF_NFCT_SENSRES_NFCID1_SIZE_DOUBLE : nfcid1_size;
970*150812a8SEvalZero
971*150812a8SEvalZero if (size != NRF_NFCT_SENSRES_NFCID1_SIZE_SINGLE)
972*150812a8SEvalZero {
973*150812a8SEvalZero if (size == NRF_NFCT_SENSRES_NFCID1_SIZE_TRIPLE)
974*150812a8SEvalZero {
975*150812a8SEvalZero NRF_NFCT->NFCID1_3RD_LAST = ((uint32_t)p_nfcid1_buf[0] << 16UL) |
976*150812a8SEvalZero ((uint32_t)p_nfcid1_buf[1] << 8UL) |
977*150812a8SEvalZero ((uint32_t)p_nfcid1_buf[2] << 0UL);
978*150812a8SEvalZero p_nfcid1_buf += 3UL;
979*150812a8SEvalZero }
980*150812a8SEvalZero NRF_NFCT->NFCID1_2ND_LAST = ((uint32_t)p_nfcid1_buf[0] << 16UL) |
981*150812a8SEvalZero ((uint32_t)p_nfcid1_buf[1] << 8UL) |
982*150812a8SEvalZero ((uint32_t)p_nfcid1_buf[2] << 0UL);
983*150812a8SEvalZero p_nfcid1_buf += 3UL;
984*150812a8SEvalZero }
985*150812a8SEvalZero
986*150812a8SEvalZero NRF_NFCT->NFCID1_LAST = ((uint32_t)p_nfcid1_buf[0] << 24UL) |
987*150812a8SEvalZero ((uint32_t)p_nfcid1_buf[1] << 16UL) |
988*150812a8SEvalZero ((uint32_t)p_nfcid1_buf[2] << 8UL) |
989*150812a8SEvalZero ((uint32_t)p_nfcid1_buf[3] << 0UL);
990*150812a8SEvalZero
991*150812a8SEvalZero NRF_NFCT->SENSRES = ((NRF_NFCT->SENSRES & ~NFCT_SENSRES_NFCIDSIZE_Msk) |
992*150812a8SEvalZero (uint32_t)size);
993*150812a8SEvalZero }
994*150812a8SEvalZero
995*150812a8SEvalZero #if defined (NFCT_AUTOCOLRESCONFIG_MODE_Msk) || defined(__NRFX_DOXYGEN__)
nrf_nfct_autocolres_is_enabled(void)996*150812a8SEvalZero __STATIC_INLINE bool nrf_nfct_autocolres_is_enabled(void)
997*150812a8SEvalZero {
998*150812a8SEvalZero return (NRF_NFCT->AUTOCOLRESCONFIG & NFCT_AUTOCOLRESCONFIG_MODE_Msk) ==
999*150812a8SEvalZero (NFCT_AUTOCOLRESCONFIG_MODE_Enabled << NFCT_AUTOCOLRESCONFIG_MODE_Pos);
1000*150812a8SEvalZero }
1001*150812a8SEvalZero
nrf_nfct_autocolres_enable(void)1002*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_autocolres_enable(void)
1003*150812a8SEvalZero {
1004*150812a8SEvalZero NRF_NFCT->AUTOCOLRESCONFIG =
1005*150812a8SEvalZero (NRF_NFCT->AUTOCOLRESCONFIG & ~NFCT_AUTOCOLRESCONFIG_MODE_Msk) |
1006*150812a8SEvalZero (NFCT_AUTOCOLRESCONFIG_MODE_Enabled << NFCT_AUTOCOLRESCONFIG_MODE_Pos);
1007*150812a8SEvalZero }
1008*150812a8SEvalZero
nrf_nfct_autocolres_disable(void)1009*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_autocolres_disable(void)
1010*150812a8SEvalZero {
1011*150812a8SEvalZero NRF_NFCT->AUTOCOLRESCONFIG =
1012*150812a8SEvalZero (NRF_NFCT->AUTOCOLRESCONFIG & ~NFCT_AUTOCOLRESCONFIG_MODE_Msk) |
1013*150812a8SEvalZero (NFCT_AUTOCOLRESCONFIG_MODE_Disabled << NFCT_AUTOCOLRESCONFIG_MODE_Pos);
1014*150812a8SEvalZero }
1015*150812a8SEvalZero #endif // defined (NFCT_AUTOCOLRESCONFIG_MODE_Msk) || defined(__NRFX_DOXYGEN__)
1016*150812a8SEvalZero
nrf_nfct_sensres_nfcid1_size_get(void)1017*150812a8SEvalZero __STATIC_INLINE nrf_nfct_sensres_nfcid1_size_t nrf_nfct_sensres_nfcid1_size_get(void)
1018*150812a8SEvalZero {
1019*150812a8SEvalZero return (nrf_nfct_sensres_nfcid1_size_t)(NRF_NFCT->SENSRES & NFCT_SENSRES_NFCIDSIZE_Msk);
1020*150812a8SEvalZero }
1021*150812a8SEvalZero
nrf_nfct_sensres_nfcid1_size_set(nrf_nfct_sensres_nfcid1_size_t nfcid1_size)1022*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_sensres_nfcid1_size_set(nrf_nfct_sensres_nfcid1_size_t nfcid1_size)
1023*150812a8SEvalZero {
1024*150812a8SEvalZero NRF_NFCT->SENSRES = ((NRF_NFCT->SENSRES & ~(NFCT_SENSRES_NFCIDSIZE_Msk)) | (uint32_t)nfcid1_size);
1025*150812a8SEvalZero }
1026*150812a8SEvalZero
nrf_nfct_sensres_bit_frame_sdd_get(void)1027*150812a8SEvalZero __STATIC_INLINE nrf_nfct_sensres_bit_frame_sdd_t nrf_nfct_sensres_bit_frame_sdd_get(void)
1028*150812a8SEvalZero {
1029*150812a8SEvalZero return (nrf_nfct_sensres_bit_frame_sdd_t)(NRF_NFCT->SENSRES & NFCT_SENSRES_BITFRAMESDD_Msk);
1030*150812a8SEvalZero }
1031*150812a8SEvalZero
nrf_nfct_sensres_bit_frame_sdd_set(nrf_nfct_sensres_bit_frame_sdd_t bit_frame_sdd)1032*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_sensres_bit_frame_sdd_set(nrf_nfct_sensres_bit_frame_sdd_t bit_frame_sdd)
1033*150812a8SEvalZero {
1034*150812a8SEvalZero NRF_NFCT->SENSRES = ((NRF_NFCT->SENSRES & ~(NFCT_SENSRES_BITFRAMESDD_Msk)) | (uint32_t)bit_frame_sdd);
1035*150812a8SEvalZero }
1036*150812a8SEvalZero
nrf_nfct_sensres_platform_config_get(void)1037*150812a8SEvalZero __STATIC_INLINE nrf_nfct_sensres_platform_config_t nrf_nfct_sensres_platform_config_get(void)
1038*150812a8SEvalZero {
1039*150812a8SEvalZero return (nrf_nfct_sensres_platform_config_t)(NRF_NFCT->SENSRES & NFCT_SENSRES_PLATFCONFIG_Msk);
1040*150812a8SEvalZero }
1041*150812a8SEvalZero
nrf_nfct_sensres_platform_config_set(nrf_nfct_sensres_platform_config_t platform_config)1042*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_sensres_platform_config_set(nrf_nfct_sensres_platform_config_t platform_config)
1043*150812a8SEvalZero {
1044*150812a8SEvalZero NRF_NFCT->SENSRES = ((NRF_NFCT->SENSRES & ~(NFCT_SENSRES_PLATFCONFIG_Msk)) | (uint32_t)platform_config);
1045*150812a8SEvalZero }
1046*150812a8SEvalZero
nrf_nfct_selsres_cascade_check(void)1047*150812a8SEvalZero __STATIC_INLINE bool nrf_nfct_selsres_cascade_check(void)
1048*150812a8SEvalZero {
1049*150812a8SEvalZero return (bool)(NRF_NFCT->SELRES & NFCT_SELRES_CASCADE_Msk);
1050*150812a8SEvalZero }
1051*150812a8SEvalZero
nrf_nfct_selsres_protocol_get(void)1052*150812a8SEvalZero __STATIC_INLINE nrf_nfct_selres_protocol_t nrf_nfct_selsres_protocol_get(void)
1053*150812a8SEvalZero {
1054*150812a8SEvalZero return (nrf_nfct_selres_protocol_t)((NRF_NFCT->SELRES & NFCT_SELRES_PROTOCOL_Msk) >>
1055*150812a8SEvalZero NFCT_SELRES_PROTOCOL_Pos);
1056*150812a8SEvalZero }
1057*150812a8SEvalZero
nrf_nfct_selres_protocol_set(nrf_nfct_selres_protocol_t sel_res_protocol)1058*150812a8SEvalZero __STATIC_INLINE void nrf_nfct_selres_protocol_set(nrf_nfct_selres_protocol_t sel_res_protocol)
1059*150812a8SEvalZero {
1060*150812a8SEvalZero NRF_NFCT->SELRES = (NRF_NFCT->SELRES & ~NFCT_SELRES_PROTOCOL_Msk) |
1061*150812a8SEvalZero ((uint32_t)sel_res_protocol << NFCT_SELRES_PROTOCOL_Pos);
1062*150812a8SEvalZero }
1063*150812a8SEvalZero #endif /* SUPPRESS_INLINE_IMPLEMENTATION */
1064*150812a8SEvalZero
1065*150812a8SEvalZero /** @} */
1066*150812a8SEvalZero
1067*150812a8SEvalZero #ifdef __cplusplus
1068*150812a8SEvalZero }
1069*150812a8SEvalZero #endif
1070*150812a8SEvalZero
1071*150812a8SEvalZero #endif /* NRF_NFCT_H__ */
1072