@@ -23,14 +23,8 @@ K_THREAD_STACK_DEFINE(mStack, CONFIG_RFAL_WORKER_THREAD_STACK_SIZE);
2323void NfcTransportRfal::Run ()
2424{
2525 while (true ) {
26- if (mRxTimeout || mIdleTimeout ) {
27- if (mRxTimeout ) {
28- VerifyAndCall (Instance ().NfcDriver ::mCallbacks .mOnError , ALIRO_TIMEOUT);
29- mRxTimeout = false ;
30- }
31- if (mIdleTimeout ) {
32- mIdleTimeout = false ;
33- }
26+ if (mIdleTimeout ) {
27+ mIdleTimeout = false ;
3428 RecoverPolling ();
3529 }
3630 rfalNfcWorker ();
@@ -73,7 +67,6 @@ void NfcTransportRfal::RfalNotifyCallback(rfalNfcState state)
7367 LOG_DBG (" RFAL: Data exchange state" );
7468 break ;
7569 case RFAL_NFC_STATE_DATAEXCHANGE_DONE:
76- k_timer_stop (&mRxTimer );
7770 CaptureRxData ();
7871 k_timer_start (&mIdleTimer , K_MSEC (sIdleTimerTimeoutMs ), K_NO_WAIT);
7972 break ;
@@ -106,7 +99,7 @@ ReturnCode NfcTransportRfal::RfalNfcInit()
10699 return err;
107100}
108101
109- void NfcTransportRfal::SelectTag ()
102+ void NfcTransportRfal::SelectTag () const
110103{
111104 rfalNfcDevice *nfcDevice;
112105 rfalNfcGetActiveDevice (&nfcDevice);
@@ -150,7 +143,7 @@ void NfcTransportRfal::CaptureRxData()
150143 0 );
151144}
152145
153- void NfcTransportRfal::RecoverPolling ()
146+ void NfcTransportRfal::RecoverPolling () const
154147{
155148 if (rfalNfcIsDevActivated (rfalNfcGetState ())) {
156149 ReturnCode err = rfalNfcDeactivate (RFAL_NFC_DEACTIVATE_SLEEP);
@@ -169,26 +162,26 @@ AliroError NfcTransportRfal::_Init(IsoDep::Callbacks callbacks)
169162 return ALIRO_NO_ERROR;
170163}
171164
172- AliroError NfcTransportRfal::_PrepareData (NfcTransport:: Data data)
165+ AliroError NfcTransportRfal::_PrepareData ([[maybe_unused]] Data data) const
173166{
174167 // ISO-DEP layer is implemented internally in the RFAL, no need for special data handling
175168 return ALIRO_ERROR_NOT_IMPLEMENTED;
176169}
177170
178- AliroError NfcTransportRfal::_PrepareRats ()
171+ AliroError NfcTransportRfal::_PrepareRats () const
179172{
180173 // RATS is sent by the driver internally as an activation procedure, so we can presume the tag is fully selected
181174 // a this point
182175 return ALIRO_ERROR_NOT_IMPLEMENTED;
183176}
184177
185- AliroError NfcTransportRfal::_HandleReceivedData (NfcTransport:: Data data, int transferError)
178+ AliroError NfcTransportRfal::_HandleReceivedData ([[maybe_unused]] Data data, [[maybe_unused]] int transferError) const
186179{
187180 // No specific processing needed, all ISO-DEP specific data handling happens in driver's internals
188181 return ALIRO_ERROR_NOT_IMPLEMENTED;
189182}
190183
191- AliroError NfcTransportRfal::_ReportTimeout ()
184+ AliroError NfcTransportRfal::_ReportTimeout () const
192185{
193186 // No special handling needed with RFAL
194187 return ALIRO_ERROR_NOT_IMPLEMENTED;
@@ -219,7 +212,7 @@ AliroError NfcTransportRfal::_Init(NfcDriver::Callbacks callbacks)
219212 return ALIRO_ERROR_INTERNAL;
220213 }
221214
222- k_tid_t thread = ncs_pal_nfc_worker_start ([](void *, void *, void *) -> void { return Instance ().Run (); });
215+ const k_tid_t thread = ncs_pal_nfc_worker_start ([](void *, void *, void *) { Instance ().Run (); });
223216
224217 VerifyOrReturnStatus (thread, ALIRO_INVALID_STATE, LOG_ERR (" RFAL: Cannot spawn the NFC driver thread" ));
225218
@@ -228,14 +221,6 @@ AliroError NfcTransportRfal::_Init(NfcDriver::Callbacks callbacks)
228221 return ALIRO_ERROR_INTERNAL;
229222 }
230223
231- k_timer_init (
232- &mRxTimer ,
233- [](k_timer *) {
234- LOG_DBG (" RFAL: RX timer expired" );
235- Instance ().mRxTimeout = true ;
236- },
237- nullptr );
238-
239224 k_timer_init (
240225 &mIdleTimer ,
241226 [](k_timer *) {
@@ -247,7 +232,7 @@ AliroError NfcTransportRfal::_Init(NfcDriver::Callbacks callbacks)
247232 return ALIRO_NO_ERROR;
248233}
249234
250- AliroError NfcTransportRfal::_Send (NfcTransport:: Data data, uint32_t maximumFrameDelayTime)
235+ AliroError NfcTransportRfal::_Send (Data data, [[maybe_unused]] uint32_t maximumFrameDelayTime)
251236{
252237 k_timer_stop (&mIdleTimer );
253238
@@ -256,14 +241,13 @@ AliroError NfcTransportRfal::_Send(NfcTransport::Data data, uint32_t maximumFram
256241 // use RFAL_FWT_NONE as FWT because the driver with ISO-DEP enabled will ignore it anyway
257242 ReturnCode err = rfalNfcDataExchangeStart (data.mData , data.mLength , &mRxData , &mRcvLen , RFAL_FWT_NONE);
258243 if (!err) {
259- k_timer_start (&mRxTimer , K_MSEC (sRxTimerTimeoutMs ), K_NO_WAIT);
260244 return ALIRO_NO_ERROR;
261245 }
262246
263247 return ALIRO_ERROR_INTERNAL;
264248}
265249
266- AliroError NfcTransportRfal::_NfcOn ()
250+ AliroError NfcTransportRfal::_NfcOn () const
267251{
268252 // The RF field is turned right after the STR25 boots
269253 // The only thing that must be done is to activate the reader
@@ -277,7 +261,7 @@ AliroError NfcTransportRfal::_NfcOn()
277261 return ALIRO_NO_ERROR;
278262}
279263
280- AliroError NfcTransportRfal::_NfcOff ()
264+ AliroError NfcTransportRfal::_NfcOff () const
281265{
282266 // RFAL handles this internally and knows when the field can be off
283267 return ALIRO_ERROR_NOT_IMPLEMENTED;
0 commit comments