Fork of the GitHub

Files at this revision

API Documentation at this revision

Comitter:
DiegoOstuni
Date:
Thu Nov 14 14:36:52 2019 +0000
Commit message:
Fork of the GitHub

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
LICENSE Show annotated file Show diff for this revision Revisions of this file
README.md Show annotated file Show diff for this revision Revisions of this file
Release_Notes.html Show annotated file Show diff for this revision Revisions of this file
ST25R3911.cpp Show annotated file Show diff for this revision Revisions of this file
ST25R3911.h Show annotated file Show diff for this revision Revisions of this file
st25r3911_com.cpp Show annotated file Show diff for this revision Revisions of this file
st25r3911_com.h Show annotated file Show diff for this revision Revisions of this file
st25r3911_interrupt.cpp Show annotated file Show diff for this revision Revisions of this file
st25r3911_interrupt.h Show annotated file Show diff for this revision Revisions of this file
st_errno.h Show annotated file Show diff for this revision Revisions of this file
timer1.cpp Show annotated file Show diff for this revision Revisions of this file
timer1.h Show annotated file Show diff for this revision Revisions of this file
utils.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,32 @@
+# Prerequisites
+*.d
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Fortran module files
+*.mod
+*.smod
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,5 @@
+# ST25R3911
+ST25R3911 provides a library for STMicroelectronics X-NUCLEO-NFC05A1 expansion board.
+# OVERVIEW
+This library provides the main function in order to read and write the register of the MCU, read and write multiple registers, read and write the FIFO or execute one command or multiple commands.
+It contains as well all the definitions of the registers and some other functions that may very useful for the programming of the board.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Release_Notes.html	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,177 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso">
+
+<!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]-->
+  <title>Release Notes for ST25DV Driver</title>
+
+  
+<!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  
+  <meta content="MCD Application Team" name="author">
+
+</head><body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for ST25DV driver </span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2017 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"> <span style="font-family: &quot;Times New Roman&quot;;"></span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update
+History</span></h2>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 200px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
+/ 6-March-2017</span></h3>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span> <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span> <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span> <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+            <ul style="list-style-type: square;">
+              <li><span style="font-size: 10pt; font-family: Verdana;">First
+official release.</span><span style="color: rgb(0, 0, 0); font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; display: inline ! important; float: none;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span></li>
+            </ul>
+            <span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br>
+            </h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistribution
+and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol>
+              <li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+of source code must retain the above copyright notice, this list of
+conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li>
+              <li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the
+documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li>
+              <li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the
+name of STMicroelectronics nor the names of its contributors may be
+used to endorse or promote products derived </span><br>
+                </font> </li>
+            </ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS
+SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.</span></font> </div>
+            <p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+            <b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ST25R3911.cpp	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,1019 @@
+
+/******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty
+  *
+  * Unless required by applicable law or agreed to in writing, software 
+  * distributed under the License is distributed on an "AS IS" BASIS, 
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+******************************************************************************/
+
+
+/*
+ *      PROJECT:   ST25R3911 firmware
+ *      $Revision: $
+ *      LANGUAGE:  ISO C99
+ */
+
+/*! \file
+ *
+ *  \author Ulrich Herrmann
+ *
+ *  \brief ST25R3911 high level interface
+ *
+ */
+
+/*
+******************************************************************************
+* INCLUDES
+******************************************************************************
+*/
+
+#include "ST25R3911.h"
+#include "st25r3911_com.h"
+#include "st25r3911_interrupt.h"
+
+
+
+#include "stdio.h"
+#include <limits.h>
+
+
+
+
+/*
+******************************************************************************
+* LOCAL VARIABLES
+******************************************************************************
+*/
+static uint32_t st25r3911NoResponseTime_64fcs;
+typedef uint16_t      ReturnCode; //eeeee.... st_errno.h
+#ifdef ST25R391X_COM_SINGLETXRX
+static uint8_t comBuf[ST25R3911_BUF_LEN];
+#endif /* ST25R391X_COM_SINGLETXRX */
+
+/*
+******************************************************************************
+* LOCAL FUNCTION PROTOTYPES
+******************************************************************************
+*/
+static ReturnCode st25r3911ExecuteCommandAndGetResult(uint8_t cmd, uint8_t resreg, uint8_t sleeptime, uint8_t* result, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+static inline void st25r3911CheckFieldSetLED(uint8_t val, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    if (ST25R3911_REG_OP_CONTROL_tx_en & val)
+    {
+    	fieldLED_06 -> write(1);
+
+    }
+    else
+    {
+    	fieldLED_06 -> write(0);
+    }
+
+}
+/*
+******************************************************************************
+* GLOBAL FUNCTIONS
+******************************************************************************
+*/
+
+/*!
+ *****************************************************************************
+ *  \brief  Returns the content of a register within the ST25R3911
+ *
+ *  This function is used to read out the content of ST25R3911 registers.
+ *
+ *  \param[in]  reg: Address of register to read.
+ *  \param[out] val: Returned value.
+ *  \param[in]  mspiChannel: Channel of the SPI
+ *  \param[in]  gpio_cs: Chip Select of the SPI
+ *  \param[in]  IRQ: Interrupt line. Not implemented, It is a polling application.
+ *  \param[out]  fieldLED_01: Digital Output of the LED1
+ *  \param[out]  fieldLED_02: Digital Output of the LED2
+ *  \param[out]  fieldLED_03: Digital Output of the LED3
+ *  \param[out]  fieldLED_04: Digital Output of the LED4
+ *  \param[out]  fieldLED_05: Digital Output of the LED5
+ *  \param[out]  fieldLED_06: Digital Output of the LED6
+ *
+ *
+ *****************************************************************************
+ */
+
+void ST25R3911::readRegister(uint8_t reg, uint8_t* val, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+    uint8_t buf[2];
+    uint8_t buf_rx[2];
+    buf_rx[0] = 0;
+    buf_rx[1] = 0;
+
+
+    buf[0] = (reg | ST25R3911_READ_MODE);
+    buf[1] = 0;
+
+    IRQ->disable_irq();
+    *gpio_cs = 0;
+    wait_us(50);
+    mspiChannel -> write((const char *)(buf) ,2 , (char*)(buf_rx) , 2);
+    *gpio_cs = 1;
+    IRQ->enable_irq();
+
+
+
+    if(val != NULL)
+    {
+      *val = buf_rx[1];
+    }
+
+}
+
+/*!
+ *****************************************************************************
+ *  \brief  Writes a given value to a register within the ST25R3911
+ *
+ *  This function is used to write \a val to address \a reg within the ST25R3911.
+ *
+ *  \param[in]  reg: Address of the register to write.
+ *  \param[in]  val: Value to be written.
+ *  \param[in]  mspiChannel: Channel of the SPI
+ *  \param[in]  gpio_cs: Chip Select of the SPI
+ *  \param[in]  IRQ: Interrupt line. Not implemented, It is a polling application.
+ *  \param[out]  fieldLED_01: Digital Output of the LED1
+ *  \param[out]  fieldLED_02: Digital Output of the LED2
+ *  \param[out]  fieldLED_03: Digital Output of the LED3
+ *  \param[out]  fieldLED_04: Digital Output of the LED4
+ *  \param[out]  fieldLED_05: Digital Output of the LED5
+ *  \param[out]  fieldLED_06: Digital Output of the LED6
+ *
+ *****************************************************************************
+ */
+
+
+void ST25R3911::writeRegister(uint8_t reg, uint8_t val, SPI * mspiChannel,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+    uint8_t buf[2];
+
+    buf[0] = reg | ST25R3911_WRITE_MODE;
+    buf[1] = val;
+
+    if (ST25R3911_REG_OP_CONTROL == reg)
+    {
+        st25r3911CheckFieldSetLED(val, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    }
+
+    IRQ->disable_irq();
+    *gpio_cs = 0;
+    wait_us(50);
+    mspiChannel -> write((const char *)(buf) ,2, NULL , NULL);
+    *gpio_cs = 1;
+    IRQ->enable_irq();
+
+
+}
+
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Reads from multiple ST25R3911 registers
+ *
+ *  This function is used to read from multiple registers using the
+ *  auto-increment feature. That is, after each read the address pointer
+ *  inside the ST25R3911 gets incremented automatically.
+ *
+ *  \param[in]  reg: Address of the frist register to read from.
+ *  \param[in]  values: pointer to a buffer where the result shall be written to.
+ *  \param[in]  length: Number of registers to be read out.
+ *  \param[in]  mspiChannel: Channel of the SPI
+ *  \param[in]  mST25: Object of the ST25 chip
+ *  \param[in]  gpio_cs: Chip Select of the SPI
+ *  \param[in]  IRQ: Interrupt line. Not implemented, It is a polling application.
+ *  \param[out]  fieldLED_01: Digital Output of the LED1
+ *  \param[out]  fieldLED_02: Digital Output of the LED2
+ *  \param[out]  fieldLED_03: Digital Output of the LED3
+ *  \param[out]  fieldLED_04: Digital Output of the LED4
+ *  \param[out]  fieldLED_05: Digital Output of the LED5
+ *  \param[out]  fieldLED_06: Digital Output of the LED6
+ *
+ *****************************************************************************
+ */
+
+
+void ST25R3911::readMultipleRegisters(uint8_t reg, uint8_t* val, uint8_t length, SPI * mspiChannel, ST25R3911* mST25,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+    uint8_t cmd = (reg | ST25R3911_READ_MODE);
+    uint8_t index = 0;
+
+
+    if (length > 0)
+    {
+        /* make this operation atomic */
+    	for(index = 0; index < length; index ++)
+    	{
+
+        	mST25 -> readRegister(cmd + index, (val + index), mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    	}
+    }
+
+
+}
+
+/*!
+ *****************************************************************************
+ *  \brief  Writes multiple values to ST25R3911 registers
+ *
+ *  This function is used to write multiple values to the ST25R3911 using the
+ *  auto-increment feature. That is, after each write the address pointer
+ *  inside the ST25R3911 gets incremented automatically.
+ *
+ *  \param[in]  reg: Address of the frist register to write.
+ *  \param[in]  values: pointer to a buffer containing the values to be written.
+ *  \param[in]  length: Number of values to be written.
+ *  \param[in]  mST25: Object of the ST25 chip
+ *  \param[in]  mspiChannel: Channel of the SPI
+ *  \param[in]  gpio_cs: Chip Select of the SPI
+ *  \param[out]  fieldLED_01: Digital Output of the LED1
+ *  \param[out]  fieldLED_02: Digital Output of the LED2
+ *  \param[out]  fieldLED_03: Digital Output of the LED3
+ *  \param[out]  fieldLED_04: Digital Output of the LED4
+ *  \param[out]  fieldLED_05: Digital Output of the LED5
+ *  \param[out]  fieldLED_06: Digital Output of the LED6
+ *
+ *****************************************************************************
+ */
+
+void ST25R3911::writeMultipleRegisters(uint8_t reg, const uint8_t* values, uint8_t length, SPI * mspiChannel, ST25R3911* mST25,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+    uint8_t cmd = (reg | ST25R3911_WRITE_MODE);
+    uint8_t index = 0;
+
+    if (reg <= ST25R3911_REG_OP_CONTROL && reg+length >= ST25R3911_REG_OP_CONTROL)
+    {
+        st25r3911CheckFieldSetLED(values[ST25R3911_REG_OP_CONTROL-reg], fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    }
+
+    if (length > 0)
+    {
+        /* make this operation atomic */
+    	for(index = 0; index < length; index ++)
+    	{
+        	mST25 -> writeRegister(cmd + index, *(values + index), mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    	}
+    }
+
+}
+
+/*!
+ *****************************************************************************
+ *  \brief  Execute a direct command
+ *
+ *  This function is used to start so-called direct command. These commands
+ *  are implemented inside the chip and each command has unique code (see
+ *  datasheet).
+ *
+ *  \param[in]  cmd : code of the direct command to be executed.
+ *  \param[in]  mspiChannel: Channel of the SPI
+ *  \param[in]  gpio_cs: Chip Select of the SPI
+ *  \param[in]  IRQ: Interrupt line. Not implemented, It is a polling application.
+ *  \param[out]  fieldLED_01: Digital Output of the LED1
+ *  \param[out]  fieldLED_02: Digital Output of the LED2
+ *  \param[out]  fieldLED_03: Digital Output of the LED3
+ *  \param[out]  fieldLED_04: Digital Output of the LED4
+ *  \param[out]  fieldLED_05: Digital Output of the LED5
+ *  \param[out]  fieldLED_06: Digital Output of the LED6
+ *
+ *****************************************************************************
+ */
+
+void ST25R3911::executeCommand(uint8_t cmd, SPI* mspiChannel,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+    uint8_t reg[1];
+    reg[0] = cmd;
+
+    if ( cmd >= ST25R3911_CMD_TRANSMIT_WITH_CRC && cmd <= ST25R3911_CMD_RESPONSE_RF_COLLISION_0)
+    {
+    	fieldLED_06 -> write(0);
+    }
+
+    IRQ->disable_irq();
+    *gpio_cs = 0;
+    wait_us(50);
+    mspiChannel -> write(( const char *)(reg), ST25R3911_CMD_LEN, NULL , NULL);
+    *gpio_cs = 1;
+    IRQ->enable_irq();
+
+
+    return;
+}
+
+/*!
+ *****************************************************************************
+ *  \brief  Execute several direct commands
+ *
+ *  This function is used to start so-called direct command. These commands
+ *  are implemented inside the chip and each command has unique code (see
+ *  datasheet).
+ *
+ *  \param[in]  cmds   : codes of the direct command to be executed.
+ *  \param[in]  length : number of commands to be executed
+ *  \param[in]  mST25: Object of the ST25 chip
+ *  \param[in]  mspiChannel: Channel of the SPI
+ *  \param[in]  gpio_cs: Chip Select of the SPI
+ *  \param[in]  IRQ: Interrupt line. Not implemented, It is a polling application.
+ *  \param[out]  fieldLED_01: Digital Output of the LED1
+ *  \param[out]  fieldLED_02: Digital Output of the LED2
+ *  \param[out]  fieldLED_03: Digital Output of the LED3
+ *  \param[out]  fieldLED_04: Digital Output of the LED4
+ *  \param[out]  fieldLED_05: Digital Output of the LED5
+ *  \param[out]  fieldLED_06: Digital Output of the LED6
+ *
+ *****************************************************************************
+ */
+
+
+void ST25R3911::executeCommands(uint8_t *cmds, uint8_t length, ST25R3911* mST25, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+    uint8_t index;
+
+ 	for(index = 0; index < length; index++)
+ 	{
+    	mST25 -> executeCommand(*cmds, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    	*cmds++;
+ 	}
+
+    return;
+}
+
+
+
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Writes values to ST25R3911 FIFO
+ *
+ *  This function needs to be called in order to write to the ST25R3911 FIFO.
+ *
+ *  \param[in]  values: pointer to a buffer containing the values to be written
+ *                      to the FIFO.
+ *  \param[in]  length: Number of values to be written.
+ *  \param[in]  mspiChannel: Channel of the SPI
+ *  \param[in]  gpio_cs: Chip Select of the SPI
+ *  \param[in]  IRQ: Interrupt line. Not implemented, It is a polling application.
+ *  \param[out]  fieldLED_01: Digital Output of the LED1
+ *  \param[out]  fieldLED_02: Digital Output of the LED2
+ *  \param[out]  fieldLED_03: Digital Output of the LED3
+ *  \param[out]  fieldLED_04: Digital Output of the LED4
+ *  \param[out]  fieldLED_05: Digital Output of the LED5
+ *  \param[out]  fieldLED_06: Digital Output of the LED6
+ *
+ *****************************************************************************
+ */
+
+
+
+void ST25R3911::writeFifo(const uint8_t* val, uint8_t length, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+    if (length > 0)
+    {
+
+        uint8_t cmd = ST25R3911_FIFO_LOAD;
+        uint8_t values[length + 1];
+        values[0] = cmd;
+        for(int i = 0 ; i < length; i++)
+        	values[i + 1] = *(val + i);
+
+        IRQ->disable_irq();
+        *gpio_cs = 0;
+        wait_us(50);
+        mspiChannel -> write( (const char *)values , length + 1, NULL , NULL);
+        *gpio_cs = 1;
+        IRQ->enable_irq();
+
+    }
+
+    return;
+}
+
+/*!
+ *****************************************************************************
+ *  \brief  Read values from ST25R3911 FIFO
+ *
+ *  This function needs to be called in order to read from ST25R3911 FIFO.
+ *
+ *  \param[out]  buf: pointer to a buffer where the FIFO content shall be
+ *                       written to.
+ *  \param[in]  length: Number of bytes to read. (= size of \a buf)
+ *  \note: This function doesn't check whether \a length is really the
+ *  number of available bytes in FIFO
+ *  \param[in]  mspiChannel: Channel of the SPI
+ *  \param[in]  gpio_cs: Chip Select of the SPI
+ *  \param[in]  IRQ: Interrupt line. Not implemented, It is a polling application.
+ *  \param[out]  fieldLED_01: Digital Output of the LED1
+ *  \param[out]  fieldLED_02: Digital Output of the LED2
+ *  \param[out]  fieldLED_03: Digital Output of the LED3
+ *  \param[out]  fieldLED_04: Digital Output of the LED4
+ *  \param[out]  fieldLED_05: Digital Output of the LED5
+ *  \param[out]  fieldLED_06: Digital Output of the LED6
+ *
+ *****************************************************************************
+ */
+
+void ST25R3911::readFifo(uint8_t* buf, uint8_t length, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    if (length > 0)
+    {
+
+        uint8_t cmd[2];
+        cmd[0] = ST25R3911_FIFO_READ;
+        cmd[1] = 0;
+
+        IRQ->disable_irq();
+        *gpio_cs = 0;
+        wait_us(50);
+        mspiChannel -> write((const char *)cmd, ST25R3911_CMD_LEN, NULL, NULL);
+        mspiChannel -> write(NULL, NULL, (char *)buf, length);
+        *gpio_cs = 1;
+        IRQ->enable_irq();
+
+    }
+
+
+
+    return ;
+}
+
+
+
+////////////////////////////////
+void st25r3911TxRxOn( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911SetRegisterBits(ST25R3911_REG_OP_CONTROL, (ST25R3911_REG_OP_CONTROL_rx_en | ST25R3911_REG_OP_CONTROL_tx_en), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+void st25r3911TxRxOff( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911ClrRegisterBits(ST25R3911_REG_OP_CONTROL, (ST25R3911_REG_OP_CONTROL_rx_en | ST25R3911_REG_OP_CONTROL_tx_en), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+
+void st25r3911OscOn( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t reg = 0;
+
+    /* Make sure that oscillator is turned on and stable */
+    mST25 -> readRegister( ST25R3911_REG_OP_CONTROL, &reg, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    /* Use ST25R3911_REG_OP_CONTROL_en instead of ST25R3911_REG_AUX_DISPLAY_osc_ok to be on the safe side */
+    if (!(ST25R3911_REG_OP_CONTROL_en & reg))
+    {
+        /* enable oscillator frequency stable interrupt */
+        st25r3911EnableInterrupts(ST25R3911_IRQ_MASK_OSC, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+        /* enable oscillator and regulator output */
+        st25r3911ModifyRegister(ST25R3911_REG_OP_CONTROL, 0x00, ST25R3911_REG_OP_CONTROL_en, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+        /* wait for the oscillator interrupt */
+        st25r3911WaitForInterruptsTimed(ST25R3911_IRQ_MASK_OSC, ST25R3911_OSC_STABLE_TIMEOUT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+        st25r3911DisableInterrupts(ST25R3911_IRQ_MASK_OSC, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    }
+
+} /* st25r3911OscOn() */
+
+
+void st25r3911Initialize(SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+
+	uint16_t vdd_mV;
+
+
+
+    /* first, reset the st25r3911 */
+    mST25 -> executeCommand(ST25R3911_CMD_SET_DEFAULT, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+
+    /* enable pull downs on miso line */
+    st25r3911ModifyRegister(ST25R3911_REG_IO_CONF2, 0,
+            ST25R3911_REG_IO_CONF2_miso_pd1 |
+            ST25R3911_REG_IO_CONF2_miso_pd2, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    /* after reset all interrupts are enabled. so disable them at first */
+    st25r3911DisableInterrupts(ST25R3911_IRQ_MASK_ALL, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    /* and clear them, just to be sure... */
+    st25r3911ClearInterrupts( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    /* trim settings for VHBR board, will anyway changed later on */
+    mST25 -> writeRegister(ST25R3911_REG_ANT_CAL_TARGET, 0x80, mspiChannel,  gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    st25r3911OscOn( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    /* Measure vdd and set sup3V bit accordingly */
+    vdd_mV = st25r3911MeasureVoltage(ST25R3911_REG_REGULATOR_CONTROL_mpsv_vdd, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    st25r3911ModifyRegister(ST25R3911_REG_IO_CONF2,
+                         ST25R3911_REG_IO_CONF2_sup3V,
+                         (vdd_mV < 3600)?ST25R3911_REG_IO_CONF2_sup3V:0, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    /* Make sure Transmitter and Receiver are disabled */
+    st25r3911TxRxOff( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    return;
+}
+
+void st25r3911Deinitialize(SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911DisableInterrupts(ST25R3911_IRQ_MASK_ALL, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    /* Disabe Tx and Rx, Keep OSC */
+    st25r3911TxRxOff( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    return;
+}
+
+ReturnCode st25r3911AdjustRegulators(uint16_t* result_mV, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t result;
+    uint8_t io_conf2;
+    ReturnCode err = ERR_NONE;
+
+    /* first check the status of the reg_s bit in ST25R3911_REG_VREG_DEF register.
+       if this bit is set adjusting the regulators is not allowed */
+    mST25 -> readRegister(ST25R3911_REG_REGULATOR_CONTROL, &result, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    if (result & ST25R3911_REG_REGULATOR_CONTROL_reg_s)
+    {
+        return ERR_REQUEST;
+    }
+
+    st25r3911ExecuteCommandAndGetResult(ST25R3911_CMD_ADJUST_REGULATORS,
+                                    ST25R3911_REG_REGULATOR_RESULT,
+                                    5,
+                                    &result, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    mST25 -> readRegister(ST25R3911_REG_IO_CONF2, &io_conf2, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    result >>= ST25R3911_REG_REGULATOR_RESULT_shift_reg;
+    result -= 5;
+    if (result_mV)
+    {
+        if(io_conf2 & ST25R3911_REG_IO_CONF2_sup3V)
+        {
+            *result_mV = 2400;
+            *result_mV += result * 100;
+        }
+        else
+        {
+            *result_mV = 3900;
+            *result_mV += result * 120;
+        }
+    }
+    return err;
+}
+
+void st25r3911MeasureRF(uint8_t* result, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911ExecuteCommandAndGetResult(ST25R3911_CMD_MEASURE_AMPLITUDE,
+                                    ST25R3911_REG_AD_RESULT,
+                                    10,
+                                    result, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+void st25r3911MeasureCapacitance(uint8_t* result, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911ExecuteCommandAndGetResult(ST25R3911_CMD_MEASURE_CAPACITANCE,
+                                    ST25R3911_REG_AD_RESULT,
+                                    10,
+                                    result, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+void st25r3911MeasureAntennaResonance(uint8_t* result, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911ExecuteCommandAndGetResult(ST25R3911_CMD_MEASURE_PHASE,
+                                    ST25R3911_REG_AD_RESULT,
+                                    10,
+                                    result, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+void st25r3911CalibrateAntenna(uint8_t* result, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911ExecuteCommandAndGetResult(ST25R3911_CMD_CALIBRATE_ANTENNA,
+                                    ST25R3911_REG_ANT_CAL_RESULT,
+                                    10,
+                                    result, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+void st25r3911CalibrateModulationDepth(uint8_t* result, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911ExecuteCommandAndGetResult(ST25R3911_CMD_CALIBRATE_MODULATION,
+                                    ST25R3911_REG_AM_MOD_DEPTH_RESULT,
+                                    10,
+                                    result, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+
+void st25r3911CalibrateCapacitiveSensor(uint8_t* result, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+  st25r3911ExecuteCommandAndGetResult(ST25R3911_CMD_CALIBRATE_C_SENSOR,
+                                    ST25R3911_REG_CAP_SENSOR_RESULT,
+                                    10,
+                                    result, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+
+ReturnCode st25r3911SetBitrate(uint8_t txRate, uint8_t rxRate, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t reg;
+
+       mST25 -> readRegister(ST25R3911_REG_BIT_RATE, &reg, mspiChannel,  gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    if (rxRate != ST25R3911_BR_DO_NOT_SET)
+    {
+        if(rxRate > ST25R3911_BR_3390)
+        {
+            return ERR_PARAM;
+        }
+        else
+        {
+            reg &= ~ST25R3911_REG_BIT_RATE_mask_rxrate;
+            reg |= rxRate << ST25R3911_REG_BIT_RATE_shift_rxrate;
+        }
+    }
+    if (txRate != ST25R3911_BR_DO_NOT_SET)
+    {
+        if(txRate > ST25R3911_BR_6780)
+        {
+            return ERR_PARAM;
+        }
+        else
+        {
+            reg &= ~ST25R3911_REG_BIT_RATE_mask_txrate;
+            reg |= txRate<<ST25R3911_REG_BIT_RATE_shift_txrate;
+        }
+    }
+    mST25 -> writeRegister(ST25R3911_REG_BIT_RATE, reg, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    return ERR_NONE;
+}
+
+
+uint16_t st25r3911MeasureVoltage(uint8_t mpsv,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t result;
+    uint16_t mV;
+
+    mpsv &= ST25R3911_REG_REGULATOR_CONTROL_mask_mpsv;
+
+    st25r3911ModifyRegister(ST25R3911_REG_REGULATOR_CONTROL,
+                         ST25R3911_REG_REGULATOR_CONTROL_mask_mpsv,
+                         mpsv, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    st25r3911ExecuteCommandAndGetResult(ST25R3911_CMD_MEASURE_VDD,
+            ST25R3911_REG_AD_RESULT,
+            100,
+            &result, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 );
+    mV = ((uint16_t)result) * 23;
+    mV += ((((uint16_t)result) * 438) + 500) / 1000;
+
+    return mV;
+}
+
+
+uint8_t st25r3911GetNumFIFOLastBits(  SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t  reg;
+    
+    mST25 ->  readRegister( ST25R3911_REG_FIFO_RX_STATUS2, &reg, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    
+    return ((reg & ST25R3911_REG_FIFO_RX_STATUS2_mask_fifo_lb) >> ST25R3911_REG_FIFO_RX_STATUS2_shift_fifo_lb);
+}
+
+uint32_t st25r3911GetNoResponseTime_64fcs()
+{
+    return st25r3911NoResponseTime_64fcs;
+}
+
+void st25r3911StartGPTimer_8fcs(uint16_t gpt_8fcs, uint8_t trigger_source, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911SetGPTime_8fcs(gpt_8fcs, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    st25r3911ModifyRegister(ST25R3911_REG_GPT_CONTROL,
+            ST25R3911_REG_GPT_CONTROL_gptc_mask,
+            trigger_source, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    if (!trigger_source)
+    	mST25 -> executeCommand(ST25R3911_CMD_START_GP_TIMER, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    return;
+}
+
+void st25r3911SetGPTime_8fcs(uint16_t gpt_8fcs, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+	mST25 -> writeRegister(ST25R3911_REG_GPT1, gpt_8fcs >> 8, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+	mST25 -> writeRegister(ST25R3911_REG_GPT2, gpt_8fcs & 0xff, mspiChannel,  gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    return;
+}
+
+bool st25r3911CheckReg( uint8_t reg, uint8_t mask, uint8_t val, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t regVal;
+
+    regVal = 0;
+    mST25 -> readRegister( reg, &regVal, mspiChannel,  gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    return ((regVal & mask) == val );
+}
+
+
+bool st25r3911CheckChipID( uint8_t *rev, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t ID;
+
+
+    mST25 -> readRegister(ST25R3911_REG_IC_IDENTITY, &ID, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    /* Check if IC Identity Register contains ST25R3911's IC type code */
+    if( (ID & ST25R3911_REG_IC_IDENTITY_mask_ic_type)  != (ST25R3911_REG_IC_IDENTITY_ic_type) )
+    {
+        return false;
+    }
+
+
+    if(rev != NULL)
+    {
+        *rev = (ID & ST25R3911_REG_IC_IDENTITY_mask_ic_rev);
+    }
+    
+    return true;
+}
+
+ReturnCode st25r3911SetNoResponseTime_64fcs(uint32_t nrt_64fcs, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    ReturnCode err = ERR_NONE;
+    uint8_t nrt_step = 0;
+
+    st25r3911NoResponseTime_64fcs = nrt_64fcs;
+    if (nrt_64fcs > USHRT_MAX)
+    {
+        nrt_step = ST25R3911_REG_GPT_CONTROL_nrt_step;
+        nrt_64fcs = (nrt_64fcs + 63) / 64;
+        if (nrt_64fcs > USHRT_MAX)
+        {
+            nrt_64fcs = USHRT_MAX;
+            err = ERR_PARAM;
+        }
+        st25r3911NoResponseTime_64fcs = 64 * nrt_64fcs;
+    }
+
+    st25r3911ModifyRegister(ST25R3911_REG_GPT_CONTROL, ST25R3911_REG_GPT_CONTROL_nrt_step, nrt_step, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    mST25 -> writeRegister(ST25R3911_REG_NO_RESPONSE_TIMER1, nrt_64fcs >> 8, mspiChannel,  gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    mST25 -> writeRegister(ST25R3911_REG_NO_RESPONSE_TIMER2, nrt_64fcs & 0xff, mspiChannel,  gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    return err;
+}
+
+ReturnCode st25r3911SetStartNoResponseTime_64fcs(uint32_t nrt_64fcs, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    ReturnCode err;
+
+    err = st25r3911SetNoResponseTime_64fcs( nrt_64fcs, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    if(err == ERR_NONE)
+    {
+    	  mST25 -> executeCommand(ST25R3911_CMD_START_NO_RESPONSE_TIMER, mspiChannel,  gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    }
+
+    return err;
+}
+
+ReturnCode st25r3911PerformCollisionAvoidance( uint8_t FieldONCmd, uint8_t pdThreshold, uint8_t caThreshold, uint8_t nTRFW, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t  treMask;
+    uint32_t irqs;
+
+    if( (FieldONCmd != ST25R3911_CMD_INITIAL_RF_COLLISION)    &&
+        (FieldONCmd != ST25R3911_CMD_RESPONSE_RF_COLLISION_0) &&
+        (FieldONCmd != ST25R3911_CMD_RESPONSE_RF_COLLISION_N)   )
+    {
+        return ERR_PARAM;
+    }
+
+    /* Check if new thresholds are to be applied */
+    if( (pdThreshold != ST25R3911_THRESHOLD_DO_NOT_SET) || (caThreshold != ST25R3911_THRESHOLD_DO_NOT_SET) )
+    {
+        treMask = 0;
+
+        if(pdThreshold != ST25R3911_THRESHOLD_DO_NOT_SET)
+        {
+            treMask |= ST25R3911_REG_FIELD_THRESHOLD_mask_trg;
+        }
+
+        if(caThreshold != ST25R3911_THRESHOLD_DO_NOT_SET)
+        {
+            treMask |= ST25R3911_REG_FIELD_THRESHOLD_mask_rfe;
+        }
+
+        /* Set Detection Threshold and|or Collision Avoidance Threshold */
+        st25r3911ChangeRegisterBits( ST25R3911_REG_FIELD_THRESHOLD, treMask, (pdThreshold & ST25R3911_REG_FIELD_THRESHOLD_mask_trg) | (caThreshold & ST25R3911_REG_FIELD_THRESHOLD_mask_rfe ), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    }
+    
+    /* Set n x TRFW */
+    st25r3911ModifyRegister(ST25R3911_REG_AUX, ST25R3911_REG_AUX_mask_nfc_n, (nTRFW & ST25R3911_REG_AUX_mask_nfc_n), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    /* Enable and clear CA specific interrupts and execute command */
+    st25r3911EnableInterrupts( (ST25R3911_IRQ_MASK_CAC | ST25R3911_IRQ_MASK_CAT), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    st25r3911GetInterrupt( (ST25R3911_IRQ_MASK_CAC | ST25R3911_IRQ_MASK_CAT), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    mST25 -> executeCommand(FieldONCmd, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    irqs = st25r3911WaitForInterruptsTimed(ST25R3911_IRQ_MASK_CAC | ST25R3911_IRQ_MASK_CAT, ST25R3911_CA_TIMEOUT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    /* Clear any previous External Field events and disable CA specific interrupts */
+    st25r3911GetInterrupt( (ST25R3911_IRQ_MASK_EOF | ST25R3911_IRQ_MASK_EON), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    st25r3911DisableInterrupts((ST25R3911_IRQ_MASK_CAC | ST25R3911_IRQ_MASK_CAT), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 );
+
+
+    if(ST25R3911_IRQ_MASK_CAC & irqs)                             /* Collision occurred */
+    {
+        return ERR_RF_COLLISION;
+    }
+
+    if(ST25R3911_IRQ_MASK_CAT & irqs)                             /* No Collision detected, Field On */
+    {
+        return ERR_NONE;
+    }
+
+    /* No interrupt detected */
+    return ERR_INTERNAL;
+}
+
+ReturnCode st25r3911GetRegsDump(uint8_t* resRegDump, uint8_t* sizeRegDump, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t regIt;
+    uint8_t regDump[ST25R3911_REG_IC_IDENTITY+1];
+    
+    if(!sizeRegDump || !resRegDump)
+    {
+        return ERR_PARAM;
+    }
+    
+    for( regIt = ST25R3911_REG_IO_CONF1; regIt < SIZEOF_ARRAY(regDump); regIt++ )
+    {
+          mST25 -> readRegister(regIt, &regDump[regIt], mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    }
+    
+    *sizeRegDump = MIN(*sizeRegDump, regIt);
+    ST_MEMCPY(resRegDump, regDump, *sizeRegDump );
+
+    return ERR_NONE;
+}
+
+
+void st25r3911SetNumTxBits( uint32_t nBits, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+	mST25 -> writeRegister(ST25R3911_REG_NUM_TX_BYTES2, (uint8_t)((nBits >> 0) & 0xff), mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+	mST25 -> writeRegister(ST25R3911_REG_NUM_TX_BYTES1, (uint8_t)((nBits >> 8) & 0xff), mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+
+bool st25r3911IsCmdValid( uint8_t cmd )
+{
+    if( !((cmd >= ST25R3911_CMD_SET_DEFAULT)       && (cmd <= ST25R3911_CMD_ANALOG_PRESET))           &&
+        !((cmd >= ST25R3911_CMD_MASK_RECEIVE_DATA) && (cmd <= ST25R3911_CMD_CLEAR_RSSI))              &&
+        !((cmd >= ST25R3911_CMD_TRANSPARENT_MODE)  && (cmd <= ST25R3911_CMD_START_NO_RESPONSE_TIMER)) &&
+        !((cmd >= ST25R3911_CMD_TEST_CLEARA)       && (cmd <= ST25R3911_CMD_FUSE_PPROM))               )
+    {
+        return false;
+    }
+    return true;
+}
+
+ReturnCode st25r3911StreamConfigure(const struct st25r3911StreamConfig *config, SPI* mspiChannel, ST25R3911* mST25,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t smd = 0;
+    uint8_t mode;
+
+    if (config->useBPSK)
+    {
+        mode = ST25R3911_REG_MODE_om_bpsk_stream;
+        if (config->din<2 || config->din>4) /* not in fc/4 .. fc/16 */
+        {
+            return ERR_PARAM;
+        }
+        smd |= (4 - config->din) << ST25R3911_REG_STREAM_MODE_shift_scf;
+
+    }
+    else
+    {
+        mode = ST25R3911_REG_MODE_om_subcarrier_stream;
+        if (config->din<3 || config->din>6) /* not in fc/8 .. fc/64 */
+        {
+            return ERR_PARAM;
+        }
+        smd |= (6 - config->din) << ST25R3911_REG_STREAM_MODE_shift_scf;
+        if (config->report_period_length == 0)
+        {
+            return ERR_PARAM;
+        }
+    }
+
+    if (config->dout<1 || config->dout>7) /* not in fc/2 .. fc/128 */
+    {
+        return ERR_PARAM;
+    }
+    smd |= (7 - config->dout) << ST25R3911_REG_STREAM_MODE_shift_stx;
+
+    if (config->report_period_length > 3)
+    {
+        return ERR_PARAM;
+    }
+    smd |= config->report_period_length << ST25R3911_REG_STREAM_MODE_shift_scp;
+
+    mST25 -> writeRegister(ST25R3911_REG_STREAM_MODE, smd, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    st25r3911ChangeRegisterBits(ST25R3911_REG_MODE, ST25R3911_REG_MODE_mask_om, mode, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    return ERR_NONE;
+}
+
+bool st25r3911IrqIsWakeUpCap( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+  return ( st25r3911GetInterrupt( ST25R3911_IRQ_MASK_WCAP, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 )  ? true : false );
+}
+
+
+bool st25r3911IrqIsWakeUpPhase( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+  return ( st25r3911GetInterrupt( ST25R3911_IRQ_MASK_WPH, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 )  ? true : false );
+}
+
+
+bool st25r3911IrqIsWakeUpAmplitude( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+  return ( st25r3911GetInterrupt( ST25R3911_IRQ_MASK_WAM, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 )  ? true : false );
+}
+
+/*
+******************************************************************************
+* LOCAL FUNCTIONS
+******************************************************************************
+*/
+/*!
+ *****************************************************************************
+ *  \brief  Executes a direct command and returns the result
+ *
+ *  This function executes the direct command given by \a cmd waits for
+ *  \a sleeptime and returns the result read from register \a resreg.
+ *
+ *  \param[in] cmd: direct command to execute.
+ *  \param[in] resreg: Address of the register containing the result.
+ *  \param[in] sleeptime: time in milliseconds to wait before reading the result.
+ *  \param[out] result: 8 bit long result
+ *
+ *****************************************************************************
+ */
+static ReturnCode st25r3911ExecuteCommandAndGetResult(uint8_t cmd, uint8_t resreg, uint8_t sleeptime, uint8_t* result, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+    if (   (cmd >= ST25R3911_CMD_INITIAL_RF_COLLISION && cmd <= ST25R3911_CMD_RESPONSE_RF_COLLISION_0)
+            || (cmd == ST25R3911_CMD_MEASURE_AMPLITUDE)
+            || (cmd >= ST25R3911_CMD_ADJUST_REGULATORS && cmd <= ST25R3911_CMD_MEASURE_PHASE)
+            || (cmd >= ST25R3911_CMD_CALIBRATE_C_SENSOR && cmd <= ST25R3911_CMD_MEASURE_VDD)
+            || (cmd >= 0xFD && cmd <= 0xFE )
+       )
+    {
+        st25r3911EnableInterrupts(ST25R3911_IRQ_MASK_DCT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+        st25r3911GetInterrupt(ST25R3911_IRQ_MASK_DCT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+        mST25 -> executeCommand(cmd, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+        st25r3911WaitForInterruptsTimed(ST25R3911_IRQ_MASK_DCT, sleeptime, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+        st25r3911DisableInterrupts(ST25R3911_IRQ_MASK_DCT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    }
+    else
+    {
+        return ERR_PARAM;
+    }
+
+    /* read out the result if the pointer is not NULL */
+    if (result)
+    	      mST25 -> readRegister(resreg, result, mspiChannel,  gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    return ERR_NONE;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ST25R3911.h	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,689 @@
+
+/******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty
+  *
+  * Unless required by applicable law or agreed to in writing, software 
+  * distributed under the License is distributed on an "AS IS" BASIS, 
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+******************************************************************************/
+
+
+/*
+ *      PROJECT:   ST25R3911 firmware
+ *      $Revision: $
+ *      LANGUAGE:  ISO C99
+ */
+
+/*! \file
+ *
+ *  \author Ulrich Herrmann
+ *
+ *  \brief ST25R3911 declaration file
+ *
+ * API:
+ * - Initialize ST25R3911 driver: #st25r3911Initialize
+ * - Deinitialize ST25R3911 driver: #st25r3911Deinitialize
+ *
+ *
+ * @addtogroup RFAL
+ * @{
+ *
+ * @addtogroup RFAL-HAL
+ * @brief RFAL Hardware Abstraction Layer
+ * @{
+ *
+ * @addtogroup ST25R3911
+ * @brief RFAL ST25R3911 Driver
+ * @{
+ *
+ * @addtogroup ST25R3911_Driver
+ * @brief RFAL ST25R3911 Driver
+ * @{
+ *
+ */
+
+#ifndef ST25R3911_H
+#define ST25R3911_H
+
+/*
+******************************************************************************
+* INCLUDES
+******************************************************************************
+*/
+
+#include "st_errno.h"
+#include "mbed.h"
+#include "platform1.h"
+#include <stdint.h>
+
+
+
+
+/*
+******************************************************************************
+* LOCAL DEFINES
+******************************************************************************
+*/
+
+#define ST25R3911_OSC_STABLE_TIMEOUT           10 /*!< Timeout for Oscillator to get stable, datasheet: 700us, take 5 ms */
+#define ST25R3911_CA_TIMEOUT                   10 /*!< Timeout for Collision Avoidance command                           */
+
+#define ST25R3911_WRITE_MODE  (0)                           /*!< ST25R3911 SPI Operation Mode: Write                            */
+#define ST25R3911_READ_MODE   (1 << 6)                      /*!< ST25R3911 SPI Operation Mode: Read                             */
+#define ST25R3911_FIFO_LOAD   (2 << 6)                      /*!< ST25R3911 SPI Operation Mode: FIFO Load                        */
+#define ST25R3911_FIFO_READ   (0xbf)                        /*!< ST25R3911 SPI Operation Mode: FIFO Read                        */
+#define ST25R3911_CMD_MODE    (3 << 6)                      /*!< ST25R3911 SPI Operation Mode: Direct Command                   */
+
+#define ST25R3911_CMD_LEN     (1)                           /*!< ST25R3911 CMD length                                           */
+#define ST25R3911_BUF_LEN     (ST25R3911_CMD_LEN+ST25R3911_FIFO_DEPTH) /*!< ST25R3911 communication buffer: CMD + FIFO length   */
+
+
+class ST25R3911 {
+	public:
+//	ST25R3911();
+	/* API to comunicate with ST253911 */
+	void readRegister(uint8_t reg, uint8_t* val, SPI* mspiChannel, DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+	void writeRegister(uint8_t reg, uint8_t val, SPI* mspiChannel,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+	void readMultipleRegisters(uint8_t reg, uint8_t* values, uint8_t length, SPI* mspiChannel, ST25R3911* mST25,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+	void writeMultipleRegisters(uint8_t reg, const uint8_t* values, uint8_t length, SPI* mspiChannel, ST25R3911* mST25,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+	void executeCommand(uint8_t cmd, SPI* mspiChannel,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+	void executeCommands(uint8_t* cmds, uint8_t length, ST25R3911* mST25, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+	void writeFifo(const uint8_t* val, uint8_t length, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+	void readFifo(uint8_t* buf, uint8_t length, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+};
+
+
+
+/*
+******************************************************************************
+* GLOBAL DATATYPES
+******************************************************************************
+*/
+
+
+
+
+
+/*! Parameters how the stream mode should work */
+struct st25r3911StreamConfig {
+    uint8_t useBPSK; /*!< 0: subcarrier, 1:BPSK */
+    uint8_t din; /*!< the divider for the in subcarrier frequency: fc/2^din  */
+    uint8_t dout; /*!< the divider for the in subcarrier frequency fc/2^dout */
+    uint8_t report_period_length; /*!< the length of the reporting period 2^report_period_length*/
+};
+
+
+/*! ST25R3911 Wake-Up Period/Timer */
+typedef enum
+{
+    ST25R3911_WUM_PERIDOD_10MS      = 0x00,     /*!< Wake-Up timer 10ms                          */
+    ST25R3911_WUM_PERIDOD_20MS      = 0x01,     /*!< Wake-Up timer 20ms                          */
+    ST25R3911_WUM_PERIDOD_30MS      = 0x02,     /*!< Wake-Up timer 30ms                          */
+    ST25R3911_WUM_PERIDOD_40MS      = 0x03,     /*!< Wake-Up timer 40ms                          */
+    ST25R3911_WUM_PERIDOD_50MS      = 0x04,     /*!< Wake-Up timer 50ms                          */
+    ST25R3911_WUM_PERIDOD_60MS      = 0x05,     /*!< Wake-Up timer 60ms                          */
+    ST25R3911_WUM_PERIDOD_70MS      = 0x06,     /*!< Wake-Up timer 70ms                          */
+    ST25R3911_WUM_PERIDOD_80MS      = 0x07,     /*!< Wake-Up timer 80ms                          */
+    ST25R3911_WUM_PERIDOD_100MS     = 0x10,     /*!< Wake-Up timer 100ms                         */
+    ST25R3911_WUM_PERIDOD_200MS     = 0x11,     /*!< Wake-Up timer 200ms                         */
+    ST25R3911_WUM_PERIDOD_300MS     = 0x12,     /*!< Wake-Up timer 300ms                         */
+    ST25R3911_WUM_PERIDOD_400MS     = 0x13,     /*!< Wake-Up timer 400ms                         */
+    ST25R3911_WUM_PERIDOD_500MS     = 0x14,     /*!< Wake-Up timer 500ms                         */
+    ST25R3911_WUM_PERIDOD_600MS     = 0x15,     /*!< Wake-Up timer 600ms                         */
+    ST25R3911_WUM_PERIDOD_700MS     = 0x16,     /*!< Wake-Up timer 700ms                         */
+    ST25R3911_WUM_PERIDOD_800MS     = 0x17,     /*!< Wake-Up timer 800ms                         */
+} st25r3911WumPeriod;
+
+
+/*! ST25R3911 Wake-Up Period/Timer */
+typedef enum
+{
+    ST25R3911_WUM_AA_WEIGHT_4       = 0x00,     /*!< Wake-Up Auto Average Weight 4                */
+    ST25R3911_WUM_AA_WEIGHT_8       = 0x01,     /*!< Wake-Up Auto Average Weight 8                */
+    ST25R3911_WUM_AA_WEIGHT_16      = 0x02,     /*!< Wake-Up Auto Average Weight 16               */
+    ST25R3911_WUM_AA_WEIGHT_32      = 0x03,     /*!< Wake-Up Auto Average Weight 32               */
+} st25r3911WumAAWeight;
+
+
+/*! ST25R3911 Wake-Up Mode configuration */
+typedef struct
+{
+    st25r3911WumPeriod        period;     /*!< Wake-Up Timer period;how often measurement(s) is performed*/
+    bool                      irqTout;    /*!< IRQ at every timeout will refresh the measurement(s)      */
+
+    struct{
+        bool                  enabled;    /*!< Inductive Amplitude measurement enabled                  */
+        uint8_t               delta;      /*!< Delta between the reference and measurement to wake-up   */
+        uint8_t               reference;  /*!< Reference to be used; or ST25R3911_WUM_REFRENCE_AUTO     */
+        bool                  autoAvg;    /*!< Use the HW Auto Averaging feature                        */
+        bool                  aaInclMeas; /*!< When AutoAvg is enables, include IRQ measurement         */
+        st25r3911WumAAWeight  aaWeight;   /*!< When AutoAvg is enables, last measure weight             */
+    }indAmp;
+    struct{
+        bool                  enabled;    /*!< Inductive Phase measurement enabled                      */
+        uint8_t               delta;      /*!< Delta between the reference and measurement to wake-up   */
+        uint8_t               reference;  /*!< Reference to be used; or ST25R3911_WUM_REFRENCE_AUTO     */
+        bool                  autoAvg;    /*!< Use the HW Auto Averaging feature                        */
+        bool                  aaInclMeas; /*!< When AutoAvg is enables, include IRQ measurement         */
+        st25r3911WumAAWeight  aaWeight;   /*!< When AutoAvg is enables, last measure weight             */
+    }indPha;
+    struct{
+        bool                  enabled;    /*!< Capacitive measurement enabled                           */
+        uint8_t               delta;      /*!< Delta between the reference and measurement to wake-up   */
+        uint8_t               reference;  /*!< Reference to be used; or ST25R3911_WUM_REFRENCE_AUTO     */
+        bool                  autoAvg;    /*!< Use the HW Auto Averaging feature                        */
+        bool                  aaInclMeas; /*!< When AutoAvg is enables, include IRQ measurement         */
+        st25r3911WumAAWeight  aaWeight;   /*!< When AutoAvg is enables, last measure weight             */
+    }cap;
+} st25r3911WakeUpConfig;
+
+
+/*
+******************************************************************************
+* GLOBAL DEFINES
+******************************************************************************
+*/
+#define ST25R3911_FDT_NONE                     0x00    /*!< Value indicating not to perform FDT  */
+
+#define MS_TO_64FCS(A)               ((A) * 212)    /*!< Converts from ms to 64/fc steps      */
+#define MS_FROM_64FCS(A)             ((A) / 212)    /*!< Converts from 64/fc steps to ms      */
+
+/* ST25R3911 direct commands */
+#define ST25R3911_CMD_SET_DEFAULT              0xC1    /*!< Puts the chip in default state (same as after power-up) */
+#define ST25R3911_CMD_CLEAR_FIFO               0xC2    /*!< Stops all activities and clears FIFO */
+#define ST25R3911_CMD_TRANSMIT_WITH_CRC        0xC4    /*!< Transmit with CRC */
+#define ST25R3911_CMD_TRANSMIT_WITHOUT_CRC     0xC5    /*!< Transmit without CRC */
+#define ST25R3911_CMD_TRANSMIT_REQA            0xC6    /*!< Transmit REQA */
+#define ST25R3911_CMD_TRANSMIT_WUPA            0xC7    /*!< Transmit WUPA */
+#define ST25R3911_CMD_INITIAL_RF_COLLISION     0xC8    /*!< NFC transmit with Initial RF Collision Avoidance */
+#define ST25R3911_CMD_RESPONSE_RF_COLLISION_N  0xC9    /*!< NFC transmit with Response RF Collision Avoidance */
+#define ST25R3911_CMD_RESPONSE_RF_COLLISION_0  0xCA    /*!< NFC transmit with Response RF Collision Avoidance with n=0 */
+#define ST25R3911_CMD_NORMAL_NFC_MODE          0xCB    /*!< NFC switch to normal NFC mode */
+#define ST25R3911_CMD_ANALOG_PRESET            0xCC    /*!< Analog Preset */
+#define ST25R3911_CMD_MASK_RECEIVE_DATA        0xD0    /*!< Mask recive data */
+#define ST25R3911_CMD_UNMASK_RECEIVE_DATA      0xD1    /*!< Unmask recive data */
+#define ST25R3911_CMD_MEASURE_AMPLITUDE        0xD3    /*!< Measure singal amplitude on RFI inputs */
+#define ST25R3911_CMD_SQUELCH                  0xD4    /*!< Squelch */
+#define ST25R3911_CMD_CLEAR_SQUELCH            0xD5    /*!< Clear Squelch */
+#define ST25R3911_CMD_ADJUST_REGULATORS        0xD6    /*!< Adjust regulators */
+#define ST25R3911_CMD_CALIBRATE_MODULATION     0xD7    /*!< Calibrate modulation depth */
+#define ST25R3911_CMD_CALIBRATE_ANTENNA        0xD8    /*!< Calibrate antenna */
+#define ST25R3911_CMD_MEASURE_PHASE            0xD9    /*!< Measure phase between RFO and RFI signal */
+#define ST25R3911_CMD_CLEAR_RSSI               0xDA    /*!< clear RSSI bits and restart the measurement */
+#define ST25R3911_CMD_TRANSPARENT_MODE         0xDC    /*!< Transparent mode */
+#define ST25R3911_CMD_CALIBRATE_C_SENSOR       0xDD    /*!< Calibrate the capacitive sensor */
+#define ST25R3911_CMD_MEASURE_CAPACITANCE      0xDE    /*!< Measure capacitance */
+#define ST25R3911_CMD_MEASURE_VDD              0xDF    /*!< Measure power supply voltage */
+#define ST25R3911_CMD_START_GP_TIMER           0xE0    /*!< Start the general purpose timer */
+#define ST25R3911_CMD_START_WUP_TIMER          0xE1    /*!< Start the wake-up timer */
+#define ST25R3911_CMD_START_MASK_RECEIVE_TIMER 0xE2    /*!< Start the mask-receive timer */
+#define ST25R3911_CMD_START_NO_RESPONSE_TIMER  0xE3    /*!< Start the no-repsonse timer */
+#define ST25R3911_CMD_TEST_CLEARA              0xFA    /*!< Clear Test register */
+#define ST25R3911_CMD_TEST_CLEARB              0xFB    /*!< Clear Test register */
+#define ST25R3911_CMD_TEST_ACCESS              0xFC    /*!< Enable R/W access to the test registers */
+#define ST25R3911_CMD_LOAD_PPROM               0xFD    /*!< Load data from the poly fuses to RAM */
+#define ST25R3911_CMD_FUSE_PPROM               0xFE    /*!< Fuse poly fuses with data from the RAM */
+
+
+#define ST25R3911_FIFO_DEPTH                   96      /*!< Depth of FIFO                            */
+
+#define ST25R3911_THRESHOLD_DO_NOT_SET         0xFF    /*!< Indicates not to change this Threshold   */
+
+#define ST25R3911_BR_DO_NOT_SET                0xFF    /*!< Indicates not to change this Bit Rate    */
+#define ST25R3911_BR_106                       0x00    /*!< ST25R3911 Bit Rate 106 kbit/s (fc/128)   */
+#define ST25R3911_BR_212                       0x01    /*!< ST25R3911 Bit Rate 212 kbit/s (fc/64)    */
+#define ST25R3911_BR_424                       0x02    /*!< ST25R3911 Bit Rate 424 kbit/s (fc/32)    */
+#define ST25R3911_BR_848                       0x03    /*!< ST25R3911 Bit Rate 848 kbit/s (fc/16)    */
+#define ST25R3911_BR_1695                      0x04    /*!< ST25R3911 Bit Rate 1696 kbit/s (fc/8)    */
+#define ST25R3911_BR_3390                      0x05    /*!< ST25R3911 Bit Rate 3390 kbit/s (fc/4)    */
+#define ST25R3911_BR_6780                      0x06    /*!< ST25R3911 Bit Rate 6780 kbit/s (fc/2)    */
+
+
+#define ST25R3911_WUM_REFRENCE_AUTO            0xFF    /*!< Indicates new reference is set by the driver   */
+#define ST25R3911_WUM_WAKEMASK_INDAMP          0x01    /*!< Wake-Up mode was woken by Inductive Amplitude  */
+#define ST25R3911_WUM_WAKEMASK_INDPHA          0x02    /*!< Wake-Up mode was woken by Inductive Phase      */
+#define ST25R3911_WUM_WAKEMASK_CAP             0x04    /*!< Wake-Up mode was woken by Capacitive           */
+
+/*
+******************************************************************************
+* GLOBAL MACROS
+******************************************************************************
+*/
+
+/*! Checks if General Purpose Timer is still running by reading gpt_on flag */
+#define st25r3911IsGPTRunning( )     ( st25r3911CheckReg(ST25R3911_REG_REGULATOR_RESULT, ST25R3911_REG_REGULATOR_RESULT_gpt_on, ST25R3911_REG_REGULATOR_RESULT_gpt_on) )
+
+/*! Checks if CRC is configured to be in FIFO                               */
+#define st25r3911IsCRCinFIFO( )      ( st25r3911CheckReg(ST25R3911_REG_AUX, ST25R3911_REG_AUX_crc_2_fifo, ST25R3911_REG_AUX_crc_2_fifo) )
+
+/*! Checks if External Filed is detected by reading ST25R3911 External Field
+ * Detector output                                                          */
+#define st25r3911IsExtFieldOn()      ( st25r3911CheckReg(ST25R3911_REG_AUX_DISPLAY, ST25R3911_REG_AUX_DISPLAY_efd_o, ST25R3911_REG_AUX_DISPLAY_efd_o ) )
+
+/*! Checks if Transmitter is enabled (Field On) */
+#define st25r3911IsTxEnabled()       ( st25r3911CheckReg(ST25R3911_REG_OP_CONTROL, ST25R3911_REG_OP_CONTROL_tx_en, ST25R3911_REG_OP_CONTROL_tx_en ) )
+
+/*! Turn Off Tx (Field Off) */
+#define st25r3911TxOff()              st25r3911ClrRegisterBits(ST25R3911_REG_OP_CONTROL, ST25R3911_REG_OP_CONTROL_tx_en );
+
+/*! Checks if last FIFO byte is complete */
+#define st25r3911IsLastFIFOComplete() st25r3911CheckReg( ST25R3911_REG_FIFO_RX_STATUS2, ST25R3911_REG_FIFO_RX_STATUS2_mask_fifo_lb, 0 )
+
+/*! Checks if the Oscillator is enabled  */
+#define st25r3911IsOscOn()            st25r3911CheckReg( ST25R3911_REG_OP_CONTROL, ST25R3911_REG_OP_CONTROL_en, ST25R3911_REG_OP_CONTROL_en )
+
+/*
+******************************************************************************
+* GLOBAL FUNCTION PROTOTYPES
+******************************************************************************
+*/
+
+/*!
+ *****************************************************************************
+ *  \brief  Turn on Oscillator and Regulator
+ *
+ *  This function turn on oscillator and regulator and wait for the oscillator to
+ *  become stable.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911OscOn( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Turn On Tx and Rx
+ *
+ *  This function turns On Tx and Rx (Field On)
+ *
+ *****************************************************************************
+ */
+extern void st25r3911TxRxOn( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Turn Off Tx and Rx
+ *
+ *  This function turns Off Tx and Rx (Field Off)
+ *
+ *****************************************************************************
+ */
+extern void st25r3911TxRxOff( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Initialise ST25R3911 driver
+ *
+ *  This function initialises the ST25R3911 driver.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911Initialize( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Deinitialize ST25R3911 driver
+ *
+ *  Calling this function deinitializes the ST25R3911 driver.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911Deinitialize( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Sets the bitrate registers
+ *
+ *  This function sets the bitrate register for rx and tx
+ *
+ *  \param txRate : speed is 2^txrate * 106 kb/s
+ *                  0xff : don't set txrate
+ *  \param rxRate : speed is 2^rxrate * 106 kb/s
+ *                  0xff : don't set rxrate
+ *
+ *  \return ERR_NONE : No error, both bit rates were set
+ *  \return ERR_PARAM: At least one bit rate was invalid
+ *
+ *****************************************************************************
+ */
+extern ReturnCode st25r3911SetBitrate(uint8_t txRate, uint8_t rxRate,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Adjusts supply regulators according to the current supply voltage
+ *
+ *  This function the power level is measured in maximum load conditions and
+ *  the regulated voltage reference is set to 250mV below this level.
+ *  Execution of this function lasts arround 5ms.
+ *
+ *  \param [out] result_mV : Result of calibration in milliVolts.
+ *
+ *  \return ERR_REQUEST : Adjustment not possible since reg_s bit is set.
+ *  \return ERR_IO : Error during communication with ST25R3911.
+ *  \return ERR_NONE : No error.
+ *
+ *****************************************************************************
+ */
+extern ReturnCode st25r3911AdjustRegulators(uint16_t* result_mV, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Measure RF
+ *
+ *  This function measured the amplitude on the RFI inputs and stores the
+ *  result in parameter \a result.
+ *
+ *  \param[out] result: 8 bit long result of RF measurement.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911MeasureRF(uint8_t* result,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Measure Capacitance
+ *
+ *  This function performs the capacitance measurement and stores the
+ *  result in parameter \a result.
+ *
+ *  \param[out] result: 8 bit long result of RF measurement.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911MeasureCapacitance(uint8_t* result, SPI *mspiChannel,  DigitalOut * gpio_cs);
+
+/*!
+ *****************************************************************************
+ *  \brief  Measure Voltage
+ *
+ *  This function measures the voltage on one of VDD and VSP_*
+ *  result in parameter \a result.
+ *
+ *  \param[in] mpsv : one of ST25R3911_REG_REGULATOR_CONTROL_mpsv_vdd
+ *                           ST25R3911_REG_REGULATOR_CONTROL_mpsv_vsp_rf
+ *                           ST25R3911_REG_REGULATOR_CONTROL_mpsv_vsp_a
+ *                    or     ST25R3911_REG_REGULATOR_CONTROL_mpsv_vsp_d
+ *
+ *  \return the measured voltage in mV
+ *
+ *****************************************************************************
+ */
+extern uint16_t st25r3911MeasureVoltage(uint8_t mpsv,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Calibrate antenna
+ *
+ *  This function is used to calibrate the antenna using a special sequence.
+ *  The result is stored in the \a result parameter.
+ *
+ *  \param[out] result: 8 bit long result of antenna calibration algorithm.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911CalibrateAntenna(uint8_t* result, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Check antenna resonance
+ *
+ *  This function is used to measure the antenna LC tank resconance to determine
+ *  whether a calibration is needed.
+ *  The result is stored in the \a result parameter.
+ *
+ *  \param[out] result: 8 bit long result of the measurement.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911MeasureAntennaResonance(uint8_t* result, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Calibrate modulation depth
+ *
+ *  This function is used to calibrate the modulation depth using a special sequence.
+ *  The result is stored in the \a result parameter.
+ *
+ *  \param[out] result: 8 bit long result of antenna calibration algorithm.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911CalibrateModulationDepth(uint8_t* result, SPI *mspiChannel,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Calibrate Capacitive Sensor
+ *
+ *  This function is used to calibrates the Capacitive Sensor.
+ *  The result is stored in the \a result parameter.
+ *
+ *  \param[out] result: 8 bit long result of antenna calibration algorithm.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911CalibrateCapacitiveSensor(uint8_t* result, SPI *mspiChannel,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  set no response time
+ *
+ *  This function executes sets the no response time to the defines value
+ *
+ *  \param nrt_64fcs : no response time in 64/fc = 4.72us
+ *                    completion interrupt
+ *
+ *  \return ERR_PARAM : if time is too large
+ */
+extern ReturnCode st25r3911SetNoResponseTime_64fcs(uint32_t nrt_64fcs, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  set no response time
+ *
+ *  This function executes sets and immediately start the no response timer
+ *   to the defines value
+ *   This is used when needs to add more time before timeout whitout Tx
+ *
+ *  \param nrt_64fcs : no response time in 64/fc = 4.72us
+ *                    completion interrupt
+ *
+ *  \return ERR_PARAM : if time is too large
+ */
+extern ReturnCode st25r3911SetStartNoResponseTime_64fcs(uint32_t nrt_64fcs,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_06);
+
+/*!
+ *****************************************************************************
+ *  \brief  Perform Collision Avoidance
+ *
+ *  Performs Collision Avoidance with the given threshold and with the
+ *  n number of TRFW
+ *
+ *  \param[in] FieldONCmd  : Field ON command to be executed ST25R3911_CMD_INITIAL_RF_COLLISION
+ *                           or ST25R3911_CMD_RESPONSE_RF_COLLISION_0/N
+ *  \param[in] pdThreshold : Peer Detection Threshold  (ST25R3916_REG_FIELD_THRESHOLD_trg_xx)
+ *                           0xff : don't set Threshold (ST25R3916_THRESHOLD_DO_NOT_SET)
+ *  \param[in] caThreshold : Collision Avoidance Threshold (ST25R3916_REG_FIELD_THRESHOLD_rfe_xx)
+ *                           0xff : don't set Threshold (ST25R3916_THRESHOLD_DO_NOT_SET)
+ *  \param[in] nTRFW       : Number of TRFW
+ *
+ *  \return ERR_NONE : no collision detected
+ *  \return ERR_RF_COLLISION : collision detected
+ */
+extern ReturnCode st25r3911PerformCollisionAvoidance( uint8_t FieldONCmd, uint8_t pdThreshold, uint8_t caThreshold, uint8_t nTRFW, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Get amount of bits of the last FIFO byte if incomplete
+ *
+ *  Gets the number of bits of the last FIFO byte if incomplete
+ *
+ *  \return the number of bits of the last FIFO byte if incomplete, 0 if
+ *          the last byte is complete
+ *
+ *****************************************************************************
+ */
+extern uint8_t st25r3911GetNumFIFOLastBits( void );
+
+/*!
+ *****************************************************************************
+ *  \brief  Get NRT time
+ *
+ *  This returns the last value set on the NRT
+ *
+ *  \warning it does not reads chip register, just the sw var that contains the
+ *  last value set before
+ *
+ *  \return the value of the NRT
+ */
+extern uint32_t st25r3911GetNoResponseTime_64fcs(void);
+
+/*!
+ *****************************************************************************
+ *  \brief  set general purpose timer timeout
+ *
+ *  This function sets the proper registers but does not start the timer actually
+ *
+ *  \param gpt_8fcs : general purpose timer timeout in 8/fc = 590ns
+ *
+ */
+extern void st25r3911SetGPTime_8fcs(uint16_t gpt_8fcs,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+/*!
+ *****************************************************************************
+ *  \brief  Starts GPT with given timeout
+ *
+ *  This function starts the general purpose timer with the given timeout
+ *
+ *  \param gpt_8fcs : general purpose timer timeout in 8/fc = 590ns
+ *  \param trigger_source : no trigger, start of Rx, end of Rx, end of Tx in NFC mode
+ */
+extern void st25r3911StartGPTimer_8fcs(uint16_t gpt_8fcs, uint8_t trigger_source, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Checks if register contains a expected value
+ *
+ *  This function checks if the given reg contains a value that once masked
+ *  equals the expected value
+ *
+ *  \param reg  : the register to check the value
+ *  \param mask : the mask apply on register value
+ *  \param val  : expected value to be compared to
+ *
+ *  \return  true when reg contains the expected value | false otherwise
+ */
+bool st25r3911CheckReg( uint8_t reg, uint8_t mask, uint8_t val,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Sets the number Tx Bits
+ *
+ *  Sets ST25R3911 internal registers with correct number of complete bytes and
+ *  bits to be sent
+ *
+ *  \param nBits : the number bits to be transmitted
+ *****************************************************************************
+ */
+void st25r3911SetNumTxBits( uint32_t nBits,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Check Identity
+ *
+ *  Checks if the chip ID is as expected.
+ *
+ *  5 bit IC type code for ST25R3911: 00001
+ *  The 3 lsb contain the IC revision code
+ *
+ *
+ *  \param[out] rev  : the IC revision code
+ *
+ *  \return  true when IC type is as expected
+ *
+ *****************************************************************************
+ */
+bool st25r3911CheckChipID( uint8_t *rev,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Check if command is valid
+ *
+ *  Checks if the given command is a valid ST25R3911 command
+ *
+ *  \param[in] cmd: Command to check
+ *
+ *  \return  true if is a valid command
+ *  \return  false otherwise
+ *
+ *****************************************************************************
+ */
+bool st25r3911IsCmdValid( uint8_t cmd );
+
+/*!
+ *****************************************************************************
+ *  \brief  Configure the stream mode of ST25R3911
+ *
+ *  This function initializes the stream with the given parameters
+ *
+ *  \param[in] config : all settings for bitrates, type, etc.
+
+ *  \return ERR_NONE : No error, stream mode driver initialized.
+ *
+ *****************************************************************************
+ */
+extern ReturnCode st25r3911StreamConfigure(const struct st25r3911StreamConfig *config, SPI* mspiChannel, ST25R3911* mST25,  DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Retrieves all  internal registers from st25r3911
+ */
+extern ReturnCode st25r3911GetRegsDump(uint8_t* resRegDump, uint8_t* sizeRegDump, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Cheks if a Wakeup IRQ due to Capacitive measument has happen
+ */
+extern bool st25r3911IrqIsWakeUpCap( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Cheks if a Wakeup IRQ due to Phase measument has happen
+ */
+extern bool st25r3911IrqIsWakeUpPhase( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Cheks if a Wakeup IRQ due to Amplitude measument has happen
+ */
+extern bool st25r3911IrqIsWakeUpAmplitude( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+#endif /* ST25R3911_H */
+
+/**
+  * @}
+  *
+  * @}
+  *
+  * @}
+  *
+  * @}
+  */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/st25r3911_com.cpp	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,159 @@
+
+/******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty
+  *
+  * Unless required by applicable law or agreed to in writing, software 
+  * distributed under the License is distributed on an "AS IS" BASIS, 
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+******************************************************************************/
+
+
+/*
+ *      PROJECT:   ST25R3911 firmware
+ *      $Revision: $
+ *      LANGUAGE:  ISO C99
+ */
+
+/*! \file
+ *
+ *  \author Ulrich Herrmann
+ *
+ *  \brief Implementation of ST25R3911 communication.
+ *
+ */
+
+/*
+******************************************************************************
+* INCLUDES
+******************************************************************************
+*/
+#include "st25r3911_com.h"
+
+
+
+
+
+
+/*
+******************************************************************************
+* GLOBAL FUNCTIONS
+******************************************************************************
+*/
+
+void st25r3911ReadTestRegister(uint8_t reg, uint8_t* val, ST25R3911* mST25, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+
+//	uint8_t rx;
+  // val rx
+    mST25 -> executeCommand(ST25R3911_CMD_TEST_ACCESS, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    mST25 -> readRegister( reg, val, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+
+    return;
+}
+
+void st25r3911WriteTestRegister(uint8_t reg, uint8_t val, ST25R3911* mST25, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+
+
+    mST25 -> executeCommand(ST25R3911_CMD_TEST_ACCESS, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    mST25 -> writeRegister( reg,  val, mspiChannel,  gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 );
+
+
+    return;
+}
+
+
+void st25r3911ClrRegisterBits( uint8_t reg, uint8_t clr_mask, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t tmp;
+
+    mST25 -> readRegister( reg,  &tmp, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    tmp &= ~clr_mask;
+    mST25 -> writeRegister( reg,  tmp, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    
+    return;
+}
+
+
+void st25r3911SetRegisterBits( uint8_t reg, uint8_t set_mask, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t tmp;
+
+    mST25 -> readRegister( reg,  &tmp, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    tmp |= set_mask;
+    mST25 -> writeRegister( reg,  tmp, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    
+    return;
+}
+
+void st25r3911ChangeRegisterBits(uint8_t reg, uint8_t valueMask, uint8_t value, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911ModifyRegister(reg, valueMask, (valueMask & value), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+void st25r3911ModifyRegister(uint8_t reg, uint8_t clr_mask, uint8_t set_mask, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t tmp;
+
+    mST25 -> readRegister( reg,  &tmp, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    /* mask out the bits we don't want to change */
+    tmp &= ~clr_mask;
+    /* set the new value */
+    tmp |= set_mask;
+    mST25 -> writeRegister( reg,  tmp, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    return;
+}
+
+void st25r3911ChangeTestRegisterBits( uint8_t reg, uint8_t valueMask, uint8_t value, ST25R3911* mST25, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t    rdVal;
+    uint8_t    wrVal;
+    
+    /* Read current reg value */
+    st25r3911ReadTestRegister(reg, &rdVal, mST25, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    
+    /* Compute new value */
+    wrVal  = (rdVal & ~valueMask);
+    wrVal |= (value & valueMask);
+    
+    /* Write new reg value */
+    st25r3911WriteTestRegister(reg, wrVal, mST25, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    
+    return;
+}
+
+
+
+bool st25r3911IsRegValid( uint8_t reg )
+{
+    if( !(( (int8_t)reg >= ST25R3911_REG_IO_CONF1) && (reg <= ST25R3911_REG_CAPACITANCE_MEASURE_RESULT)) &&
+        (reg != ST25R3911_REG_IC_IDENTITY)                                                         )
+    {
+        return false;
+    }
+    return true;
+}
+
+/*
+******************************************************************************
+* LOCAL FUNCTIONS
+******************************************************************************
+*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/st25r3911_com.h	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,716 @@
+
+/******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+******************************************************************************/
+
+
+/*
+ *      PROJECT:   ST25R3911 firmware
+ *      $Revision: $
+ *      LANGUAGE:  ISO C99
+ */
+
+/*! \file
+ *
+ *  \author Ulrich Herrmann
+ *
+ *  \brief ST25R3911 communication declaration file
+ *
+ */
+/*!
+ * This driver provides basic abstraction for communication with the ST25R3911.
+ * It uses the SPI driver for interfacing with the ST25R3911.
+ *
+ * API:
+ * - Read Register: #st25r3911ReadRegister
+ * - Modify Register: #st25r3911ModifyRegister
+ * - Write Register: #mST25 -> writeRegister
+ * - Write Multiple Registers: #mST25 -> writeMultipleRegisters
+ * - Load ST25R3911 FIFO with data: #mST25 -> writeFifo
+ * - Read from ST25R3911 FIFO: #mST25 -> readFifo
+ * - Execute direct command: #mST25 -> executeCommand
+ *
+ *
+ * @addtogroup RFAL
+ * @{
+ *
+ * @addtogroup RFAL-HAL
+ * @brief RFAL Hardware Abstraction Layer
+ * @{
+ *
+ * @addtogroup ST25R3911
+ * @brief RFAL ST25R3911 Driver
+ * @{
+ *
+ * @addtogroup ST25R3911_Com
+ * @brief RFAL ST25R3911 Communication
+ * @{
+ *
+ */
+
+#ifndef ST25R3911_COM_H
+#define ST25R3911_COM_H
+
+/*
+******************************************************************************
+* INCLUDES
+******************************************************************************
+*/
+#include <stdint.h>
+#include <stdbool.h>
+#include "st_errno.h"
+#include "platform1.h"
+#include "ST25R3911.h"
+#include "utils.h"
+
+
+
+/*
+******************************************************************************
+* GLOBAL DEFINES
+******************************************************************************
+*/
+
+#define ST25R3911_FIFO_STATUS_LEN                  2           /*!< Number of FIFO Status Register */
+
+
+
+
+#define ST25R3911_REG_IO_CONF1                     0x00        /*!< RW IO Configuration Register 1 */
+#define ST25R3911_REG_IO_CONF2                     0x01        /*!< RW IO Configuration Register 2 */
+
+#define ST25R3911_REG_OP_CONTROL                   0x02        /*!< RW Operation Control Register */
+#define ST25R3911_REG_MODE                         0x03        /*!< RW Mode Definition Register */
+#define ST25R3911_REG_BIT_RATE                     0x04        /*!< RW Bit Rate Definition Register */
+
+#define ST25R3911_REG_ISO14443A_NFC                0x05        /*!< RW ISO14443A and NFC 106 kBit/s Settings Register */
+#define ST25R3911_REG_ISO14443B_1                  0x06        /*!< RW ISO14443B Settings Register 1 */
+#define ST25R3911_REG_ISO14443B_2                  0x07        /*!< RW ISO14443B Settings Register 2 */
+#define ST25R3911_REG_STREAM_MODE                  0x08        /*!< RW Stream Mode Definition Register */
+#define ST25R3911_REG_AUX                          0x09        /*!< RW Auxiliary Definition Register */
+#define ST25R3911_REG_RX_CONF1                     0x0A        /*!< RW Receiver Configuration Register 1 */
+#define ST25R3911_REG_RX_CONF2                     0x0B        /*!< RW Receiver Configuration Register 2 */
+#define ST25R3911_REG_RX_CONF3                     0x0C        /*!< RW Receiver Configuration Register 3 */
+#define ST25R3911_REG_RX_CONF4                     0x0D        /*!< RW Receiver Configuration Register 4 */
+
+#define ST25R3911_REG_MASK_RX_TIMER                0x0E        /*!< RW Mask Receive Timer Register */
+#define ST25R3911_REG_NO_RESPONSE_TIMER1           0x0F        /*!< RW No-response Timer Register 1 */
+#define ST25R3911_REG_NO_RESPONSE_TIMER2           0x10        /*!< RW No-response Timer Register 2 */
+#define ST25R3911_REG_GPT_CONTROL                  0x11        /*!< RW General Purpose Timer Control Register */
+#define ST25R3911_REG_GPT1                         0x12        /*!< RW General Purpose Timer Register 1 */
+#define ST25R3911_REG_GPT2                         0x13        /*!< RW General Purpose Timer Register 2 */
+
+#define ST25R3911_REG_IRQ_MASK_MAIN                0x14        /*!< RW Mask Main Interrupt Register */
+#define ST25R3911_REG_IRQ_MASK_TIMER_NFC           0x15        /*!< RW Mask Timer and NFC Interrupt Register */
+#define ST25R3911_REG_IRQ_MASK_ERROR_WUP           0x16        /*!< RW Mask Error and Wake-up Interrupt Register */
+#define ST25R3911_REG_IRQ_MAIN                     0x17        /*!< R  Main Interrupt Register */
+#define ST25R3911_REG_IRQ_TIMER_NFC                0x18        /*!< R  Timer and NFC Interrupt Register */
+#define ST25R3911_REG_IRQ_ERROR_WUP                0x19        /*!< R  Error and Wake-up Interrupt Register */
+#define ST25R3911_REG_FIFO_RX_STATUS1              0x1A        /*!< R  FIFO RX Status Register 1 */
+#define ST25R3911_REG_FIFO_RX_STATUS2              0x1B        /*!< R  FIFO RX Status Register 2 */
+#define ST25R3911_REG_COLLISION_STATUS             0x1C        /*!< R  Collision Display Register */
+
+#define ST25R3911_REG_NUM_TX_BYTES1                0x1D        /*!< RW Number of Transmitted Bytes Register 1 */
+#define ST25R3911_REG_NUM_TX_BYTES2                0x1E        /*!< RW Number of Transmitted Bytes Register 2 */
+
+#define ST25R3911_REG_NFCIP1_BIT_RATE              0x1F        /*!< R  NFCIP Bit Rate Detection Display Register */
+
+#define ST25R3911_REG_AD_RESULT                    0x20        /*!< R  A/D Converter Output Register */
+
+#define ST25R3911_REG_ANT_CAL_CONTROL              0x21        /*!< RW Antenna Calibration Control Register */
+#define ST25R3911_REG_ANT_CAL_TARGET               0x22        /*!< RW Antenna Calibration Target Register */
+#define ST25R3911_REG_ANT_CAL_RESULT               0x23        /*!< R  Antenna Calibration Display Register */
+
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL         0x24        /*!< RW AM Modulation Depth Control Register */
+#define ST25R3911_REG_AM_MOD_DEPTH_RESULT          0x25        /*!< R  AM Modulation Depth Display Register */
+#define ST25R3911_REG_RFO_AM_ON_LEVEL              0x26        /*!< RW RFO AM Modulation (On) Level Definition Register */
+#define ST25R3911_REG_RFO_AM_OFF_LEVEL             0x27        /*!< RW RFO Normal (AM Off) Level Definition Register */
+
+#define ST25R3911_REG_FIELD_THRESHOLD              0x29        /*!< RW External Field Detector Threshold Register */
+
+#define ST25R3911_REG_REGULATOR_CONTROL            0x2A        /*!< RW Regulated Voltage Control Register */
+#define ST25R3911_REG_REGULATOR_RESULT             0x2B        /*!< R Regulator Display Register */
+
+#define ST25R3911_REG_RSSI_RESULT                  0x2C        /*!< R RSSI Display Register*/
+#define ST25R3911_REG_GAIN_RED_STATE               0x2D        /*!< R Gain Reduction State Register*/
+
+#define ST25R3911_REG_CAP_SENSOR_CONTROL           0x2E        /*!< RW Capacitive Sensor Control Register */
+#define ST25R3911_REG_CAP_SENSOR_RESULT            0x2F        /*!< R  Capacitive Sensor Display Register */
+
+#define ST25R3911_REG_AUX_DISPLAY                  0x30        /*!< R Auxiliary Display Register */
+
+#define ST25R3911_REG_WUP_TIMER_CONTROL            0x31        /*!< RW Wake-up Timer Control Register */
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF       0x32        /*!< RW Amplitude Measurement Configuration Register */
+#define ST25R3911_REG_AMPLITUDE_MEASURE_REF        0x33        /*!< RW Amplitude Measurement Reference Register */
+#define ST25R3911_REG_AMPLITUDE_MEASURE_AA_RESULT  0x34        /*!< R  Amplitude Measurement Auto Averaging Display Register */
+#define ST25R3911_REG_AMPLITUDE_MEASURE_RESULT     0x35        /*!< R  Amplitude Measurement Display Register */
+#define ST25R3911_REG_PHASE_MEASURE_CONF           0x36        /*!< RW Phase Measurement Configuration Register */
+#define ST25R3911_REG_PHASE_MEASURE_REF            0x37        /*!< RW Phase Measurement Reference Register */
+#define ST25R3911_REG_PHASE_MEASURE_AA_RESULT      0x38        /*!< R  Phase Measurement Auto Averaging Display Register */
+#define ST25R3911_REG_PHASE_MEASURE_RESULT         0x39        /*!< R  Phase Measurement Display Register */
+#define ST25R3911_REG_CAPACITANCE_MEASURE_CONF     0x3A        /*!< RW Capacitance Measurement Configuration Register */
+#define ST25R3911_REG_CAPACITANCE_MEASURE_REF      0x3B        /*!< RW Capacitance Measurement Reference Register */
+#define ST25R3911_REG_CAPACITANCE_MEASURE_AA_RESULT 0x3C       /*!< R  Capacitance Measurement Auto Averaging Display Register */
+#define ST25R3911_REG_CAPACITANCE_MEASURE_RESULT   0x3D        /*!< R  Capacitance Measurement Display Register */
+#define ST25R3911_REG_IC_IDENTITY                  0x3F        /*!< R  Chip Id: 0 for old silicon, v2 silicon: 0x09 */
+
+
+/*! Register bit definitions  \cond DOXYGEN_SUPRESS */
+
+#define ST25R3911_REG_IO_CONF1_lf_clk_off                     (1<<0)
+#define ST25R3911_REG_IO_CONF1_out_cl0                        (1<<1)
+#define ST25R3911_REG_IO_CONF1_out_cl1                        (1<<2)
+#define ST25R3911_REG_IO_CONF1_osc                            (1<<3)
+#define ST25R3911_REG_IO_CONF1_fifo_lt                        (1<<4)
+#define ST25R3911_REG_IO_CONF1_fifo_lt_32bytes                (0<<4)
+#define ST25R3911_REG_IO_CONF1_fifo_lt_16bytes                (1<<4)
+#define ST25R3911_REG_IO_CONF1_fifo_lr                        (1<<5)
+#define ST25R3911_REG_IO_CONF1_fifo_lr_64bytes                (0<<5)
+#define ST25R3911_REG_IO_CONF1_fifo_lr_80bytes                (1<<5)
+#define ST25R3911_REG_IO_CONF1_rfo2                           (1<<6)
+#define ST25R3911_REG_IO_CONF1_single                         (1<<7)
+#define ST25R3911_REG_IO_CONF2_slow_up                        (1<<0)
+#define ST25R3911_REG_IO_CONF2_io_18                          (1<<2)
+#define ST25R3911_REG_IO_CONF2_miso_pd1                       (1<<3)
+#define ST25R3911_REG_IO_CONF2_miso_pd2                       (1<<4)
+#define ST25R3911_REG_IO_CONF2_vspd_off                       (1<<6)
+#define ST25R3911_REG_IO_CONF2_sup3V                          (1<<7)
+#define ST25R3911_REG_OP_CONTROL_wu                           (1<<2)
+#define ST25R3911_REG_OP_CONTROL_tx_en                        (1<<3)
+#define ST25R3911_REG_OP_CONTROL_rx_man                       (1<<4)
+#define ST25R3911_REG_OP_CONTROL_rx_chn                       (1<<5)
+#define ST25R3911_REG_OP_CONTROL_rx_en                        (1<<6)
+#define ST25R3911_REG_OP_CONTROL_en                           (1<<7)
+#define ST25R3911_REG_MODE_nfc_ar                             (1<<0)
+#define ST25R3911_REG_MODE_nfc_ar_on                          (1<<0)
+#define ST25R3911_REG_MODE_nfc_ar_off                         (0<<0)
+#define ST25R3911_REG_MODE_mask_om                            (0xf<<3)
+#define ST25R3911_REG_MODE_om_nfc                             (0x0<<3)
+#define ST25R3911_REG_MODE_om_iso14443a                       (0x1<<3)
+#define ST25R3911_REG_MODE_om_iso14443b                       (0x2<<3)
+#define ST25R3911_REG_MODE_om_felica                          (0x3<<3)
+#define ST25R3911_REG_MODE_om_topaz                           (0x4<<3)
+#define ST25R3911_REG_MODE_om_subcarrier_stream               (0xe<<3)
+#define ST25R3911_REG_MODE_om_bpsk_stream                     (0xf<<3)
+#define ST25R3911_REG_MODE_om_bit_rate_detection              (0x0<<3)
+#define ST25R3911_REG_MODE_om_nfcip1_normal_mode              (0x1<<3)
+#define ST25R3911_REG_MODE_targ                               (1<<7)
+#define ST25R3911_REG_MODE_targ_targ                          (1<<7)
+#define ST25R3911_REG_MODE_targ_init                          (0<<7)
+#define ST25R3911_REG_BIT_RATE_mask_txrate                    (0xf<<4)
+#define ST25R3911_REG_BIT_RATE_shift_txrate                   (4)
+#define ST25R3911_REG_BIT_RATE_txrate_106                     (0x0<<4)
+#define ST25R3911_REG_BIT_RATE_txrate_212                     (0x1<<4)
+#define ST25R3911_REG_BIT_RATE_txrate_424                     (0x2<<4)
+#define ST25R3911_REG_BIT_RATE_txrate_848                     (0x3<<4)
+#define ST25R3911_REG_BIT_RATE_txrate_1695                    (0x4<<4)
+#define ST25R3911_REG_BIT_RATE_txrate_3390                    (0x5<<4)
+#define ST25R3911_REG_BIT_RATE_txrate_6780                    (0x6<<4)
+#define ST25R3911_REG_BIT_RATE_mask_rxrate                    (0xf<<0)
+#define ST25R3911_REG_BIT_RATE_shift_rxrate                   (0)
+#define ST25R3911_REG_BIT_RATE_rxrate_106                     (0x0<<0)
+#define ST25R3911_REG_BIT_RATE_rxrate_212                     (0x1<<0)
+#define ST25R3911_REG_BIT_RATE_rxrate_424                     (0x2<<0)
+#define ST25R3911_REG_BIT_RATE_rxrate_848                     (0x3<<0)
+#define ST25R3911_REG_BIT_RATE_rxrate_1695                    (0x4<<0)
+#define ST25R3911_REG_BIT_RATE_rxrate_3390                    (0x5<<0)
+#define ST25R3911_REG_BIT_RATE_rxrate_6780                    (0x6<<0)
+#define ST25R3911_REG_ISO14443A_NFC_antcl                     (1<<0)
+#define ST25R3911_REG_ISO14443A_NFC_mask_p_len                (0xf<<1)
+#define ST25R3911_REG_ISO14443A_NFC_shift_p_len               (1)
+#define ST25R3911_REG_ISO14443A_NFC_nfc_f0                    (1<<5)
+#define ST25R3911_REG_ISO14443A_NFC_nfc_f0_off                (0<<5)
+#define ST25R3911_REG_ISO14443A_NFC_no_rx_par                 (1<<6)
+#define ST25R3911_REG_ISO14443A_NFC_no_rx_par_off             (0<<6)
+#define ST25R3911_REG_ISO14443A_NFC_no_tx_par                 (1<<7)
+#define ST25R3911_REG_ISO14443A_NFC_no_tx_par_off             (0<<7)
+#define ST25R3911_REG_ISO14443B_1_mask_eof                    (1<<2)
+#define ST25R3911_REG_ISO14443B_1_eof_10etu                   (0<<2)
+#define ST25R3911_REG_ISO14443B_1_eof_11etu                   (1<<2)
+#define ST25R3911_REG_ISO14443B_1_mask_sof                    (3<<3)
+#define ST25R3911_REG_ISO14443B_1_mask_sof_0                  (1<<4)
+#define ST25R3911_REG_ISO14443B_1_sof_0_10etu                 (0<<4)
+#define ST25R3911_REG_ISO14443B_1_sof_0_11etu                 (1<<4)
+#define ST25R3911_REG_ISO14443B_1_mask_sof_1                  (1<<3)
+#define ST25R3911_REG_ISO14443B_1_sof_1_2etu                  (0<<3)
+#define ST25R3911_REG_ISO14443B_1_sof_2_3etu                  (1<<3)
+#define ST25R3911_REG_ISO14443B_1_mask_egt                    (7<<5)
+#define ST25R3911_REG_ISO14443B_1_shift_egt                   (5)
+#define ST25R3911_REG_ISO14443B_2_eof_12                      (1<<3)
+#define ST25R3911_REG_ISO14443B_2_eof_12_10to11etu            (0<<3)
+#define ST25R3911_REG_ISO14443B_2_eof_12_10to12etu            (1<<3)
+#define ST25R3911_REG_ISO14443B_2_no_eof                      (1<<4)
+#define ST25R3911_REG_ISO14443B_2_no_sof                      (1<<5)
+#define ST25R3911_REG_ISO14443B_2_mask_tr1                    (3<<6)
+#define ST25R3911_REG_ISO14443B_2_shift_tr1                   (6)
+#define ST25R3911_REG_ISO14443B_2_tr1_0                       (1<<6)
+#define ST25R3911_REG_ISO14443B_2_tr1_1                       (1<<7)
+#define ST25R3911_REG_ISO14443B_2_tr1_80fs80fs                (0<<6)
+#define ST25R3911_REG_ISO14443B_2_tr1_64fs32fs                (1<<6)
+#define ST25R3911_REG_STREAM_MODE_mask_stx                    (7<<0)
+#define ST25R3911_REG_STREAM_MODE_shift_stx                   (0)
+#define ST25R3911_REG_STREAM_MODE_stx_106                     (0<<0)
+#define ST25R3911_REG_STREAM_MODE_stx_212                     (1<<0)
+#define ST25R3911_REG_STREAM_MODE_stx_424                     (2<<0)
+#define ST25R3911_REG_STREAM_MODE_stx_848                     (3<<0)
+#define ST25R3911_REG_STREAM_MODE_stx_1695                    (4<<0)
+#define ST25R3911_REG_STREAM_MODE_stx_3390                    (5<<0)
+#define ST25R3911_REG_STREAM_MODE_stx_6780                    (6<<0)
+#define ST25R3911_REG_STREAM_MODE_mask_scp                    (3<<3)
+#define ST25R3911_REG_STREAM_MODE_shift_scp                   (3)
+#define ST25R3911_REG_STREAM_MODE_scp_1pulse                  (0<<3)
+#define ST25R3911_REG_STREAM_MODE_scp_2pulses                 (1<<3)
+#define ST25R3911_REG_STREAM_MODE_scp_4pulses                 (2<<3)
+#define ST25R3911_REG_STREAM_MODE_scp_8pulses                 (3<<3)
+#define ST25R3911_REG_STREAM_MODE_mask_scf                    (3<<5)
+#define ST25R3911_REG_STREAM_MODE_shift_scf                   (5)
+#define ST25R3911_REG_STREAM_MODE_scf_bpsk848                 (0<<5)
+#define ST25R3911_REG_STREAM_MODE_scf_bpsk1695                (1<<5)
+#define ST25R3911_REG_STREAM_MODE_scf_bpsk3390                (2<<5)
+#define ST25R3911_REG_STREAM_MODE_scf_bpsk106                 (3<<5)
+#define ST25R3911_REG_STREAM_MODE_scf_sc212                   (0<<5)
+#define ST25R3911_REG_STREAM_MODE_scf_sc424                   (1<<5)
+#define ST25R3911_REG_STREAM_MODE_scf_sc848                   (2<<5)
+#define ST25R3911_REG_STREAM_MODE_scf_sc1695                  (3<<5)
+#define ST25R3911_REG_AUX_mask_nfc_n                          (3<<0)
+#define ST25R3911_REG_AUX_nfc_n0                              (1<<0)
+#define ST25R3911_REG_AUX_nfc_n1                              (1<<1)
+#define ST25R3911_REG_AUX_rx_tol                              (1<<2)
+#define ST25R3911_REG_AUX_ook_hr                              (1<<3)
+#define ST25R3911_REG_AUX_en_fd                               (1<<4)
+#define ST25R3911_REG_AUX_tr_am                               (1<<5)
+#define ST25R3911_REG_AUX_crc_2_fifo                          (1<<6)
+#define ST25R3911_REG_AUX_no_crc_rx                           (1<<7)
+#define ST25R3911_REG_RX_CONF1_z12k                           (1<<0)
+#define ST25R3911_REG_RX_CONF1_h80                            (1<<1)
+#define ST25R3911_REG_RX_CONF1_h200                           (1<<2)
+#define ST25R3911_REG_RX_CONF1_mask_lp                        (7<<3)
+#define ST25R3911_REG_RX_CONF1_lp_1200khz                     (0<<3)
+#define ST25R3911_REG_RX_CONF1_lp_600khz                      (1<<3)
+#define ST25R3911_REG_RX_CONF1_lp_300khz                      (2<<3)
+#define ST25R3911_REG_RX_CONF1_lp_2000khz                     (4<<3)
+#define ST25R3911_REG_RX_CONF1_lp_7000khz                     (5<<3)
+#define ST25R3911_REG_RX_CONF1_amd_sel                        (1<<6)
+#define ST25R3911_REG_RX_CONF1_ch_sel                         (1<<7)
+#define ST25R3911_REG_RX_CONF2_sqm_dyn                        (1<<1)
+#define ST25R3911_REG_RX_CONF2_agc_alg                        (1<<2)
+#define ST25R3911_REG_RX_CONF2_agc_m                          (1<<3)
+#define ST25R3911_REG_RX_CONF2_agc_en                         (1<<4)
+#define ST25R3911_REG_RX_CONF2_lf_en                          (1<<5)
+#define ST25R3911_REG_RX_CONF2_lf_op                          (1<<6)
+#define ST25R3911_REG_RX_CONF2_rx_lp                          (1<<7)
+#define ST25R3911_REG_RX_CONF3_rg_nfc                         (1<<0)
+#define ST25R3911_REG_RX_CONF3_lim                            (1<<1)
+#define ST25R3911_REG_RX_CONF3_shift_rg1_pm                   (2)
+#define ST25R3911_REG_RX_CONF3_mask_rg1_pm                    (0x7<<2)
+#define ST25R3911_REG_RX_CONF3_rg1_pm0                        (1<<2)
+#define ST25R3911_REG_RX_CONF3_rg1_pm1                        (1<<3)
+#define ST25R3911_REG_RX_CONF3_rg1_pm2                        (1<<4)
+#define ST25R3911_REG_RX_CONF3_shift_rg1_am                   (5)
+#define ST25R3911_REG_RX_CONF3_mask_rg1_am                    (0x7<<5)
+#define ST25R3911_REG_RX_CONF3_rg1_am0                        (1<<5)
+#define ST25R3911_REG_RX_CONF3_rg1_am1                        (1<<6)
+#define ST25R3911_REG_RX_CONF3_rg1_am2                        (1<<7)
+#define ST25R3911_REG_RX_CONF4_shift_rg2_pm                   (0)
+#define ST25R3911_REG_RX_CONF4_mask_rg2_pm                    (0xf<<0)
+#define ST25R3911_REG_RX_CONF4_rg2_pm0                        (1<<0)
+#define ST25R3911_REG_RX_CONF4_rg2_pm1                        (1<<1)
+#define ST25R3911_REG_RX_CONF4_rg2_pm2                        (1<<2)
+#define ST25R3911_REG_RX_CONF4_rg2_pm3                        (1<<3)
+#define ST25R3911_REG_RX_CONF4_shift_rg2_am                   (4)
+#define ST25R3911_REG_RX_CONF4_mask_rg2_am                    (0xf<<4)
+#define ST25R3911_REG_RX_CONF4_rg2_am0                        (1<<4)
+#define ST25R3911_REG_RX_CONF4_rg2_am1                        (1<<5)
+#define ST25R3911_REG_RX_CONF4_rg2_am2                        (1<<6)
+#define ST25R3911_REG_RX_CONF4_rg2_am3                        (1<<7)
+#define ST25R3911_REG_GPT_CONTROL_nrt_step                    (1<<0)
+#define ST25R3911_REG_GPT_CONTROL_nrt_emv                     (1<<1)
+#define ST25R3911_REG_GPT_CONTROL_gptc0                       (1<<5)
+#define ST25R3911_REG_GPT_CONTROL_gptc1                       (1<<6)
+#define ST25R3911_REG_GPT_CONTROL_gptc2                       (1<<7)
+#define ST25R3911_REG_GPT_CONTROL_gptc_mask                   (0x7<<5)
+#define ST25R3911_REG_GPT_CONTROL_gptc_no_trigger             (0x0<<5)
+#define ST25R3911_REG_GPT_CONTROL_gptc_erx                    (0x1<<5)
+#define ST25R3911_REG_GPT_CONTROL_gptc_srx                    (0x2<<5)
+#define ST25R3911_REG_GPT_CONTROL_gptc_etx_nfc                (0x3<<5)
+#define ST25R3911_REG_FIFO_RX_STATUS2_np_lb                   (1<<0)
+#define ST25R3911_REG_FIFO_RX_STATUS2_mask_fifo_lb            (7<<1)
+#define ST25R3911_REG_FIFO_RX_STATUS2_shift_fifo_lb           (1)
+#define ST25R3911_REG_FIFO_RX_STATUS2_fifo_lb0                (1<<1)
+#define ST25R3911_REG_FIFO_RX_STATUS2_fifo_lb1                (1<<2)
+#define ST25R3911_REG_FIFO_RX_STATUS2_fifo_lb2                (1<<3)
+#define ST25R3911_REG_FIFO_RX_STATUS2_fifo_ncp                (1<<4)
+#define ST25R3911_REG_FIFO_RX_STATUS2_fifo_ovr                (1<<5)
+#define ST25R3911_REG_FIFO_RX_STATUS2_fifo_unf                (1<<6)
+#define ST25R3911_REG_COLLISION_STATUS_c_pb                   (1<<0)
+#define ST25R3911_REG_COLLISION_STATUS_mask_c_bit             (3<<1)
+#define ST25R3911_REG_COLLISION_STATUS_shift_c_bit            (1)
+#define ST25R3911_REG_COLLISION_STATUS_mask_c_byte            (0xf<<4)
+#define ST25R3911_REG_COLLISION_STATUS_shift_c_byte           (4)
+#define ST25R3911_ST25R3911_REG_NFCIP1_BIT_RATE_nfc_rate0     (1<<4)
+#define ST25R3911_ST25R3911_REG_NFCIP1_BIT_RATE_nfc_rate1     (1<<5)
+#define ST25R3911_ST25R3911_REG_NFCIP1_BIT_RATE_nfc_rate2     (1<<6)
+#define ST25R3911_ST25R3911_REG_NFCIP1_BIT_RATE_nfc_rate3     (1<<7)
+#define ST25R3911_REG_NFCIP1_BIT_RATE_nfc_rate_mask           (0xf<<4)
+#define ST25R3911_REG_NFCIP1_BIT_RATE_nfc_rate_shift          (4)
+#define ST25R3911_REG_ANT_CAL_CONTROL_mask_tre                (0xf<<3)
+#define ST25R3911_REG_ANT_CAL_CONTROL_shift_tre               (3)
+#define ST25R3911_REG_ANT_CAL_CONTROL_tre_0                   (1<<3)
+#define ST25R3911_REG_ANT_CAL_CONTROL_tre_1                   (1<<4)
+#define ST25R3911_REG_ANT_CAL_CONTROL_tre_2                   (1<<5)
+#define ST25R3911_REG_ANT_CAL_CONTROL_tre_3                   (1<<6)
+#define ST25R3911_REG_ANT_CAL_CONTROL_trim_s                  (1<<7)
+#define ST25R3911_REG_ANT_CAL_RESULT_tri_err                  (1<<3)
+#define ST25R3911_REG_ANT_CAL_RESULT_tri_0                    (1<<4)
+#define ST25R3911_REG_ANT_CAL_RESULT_tri_1                    (1<<5)
+#define ST25R3911_REG_ANT_CAL_RESULT_tri_2                    (1<<6)
+#define ST25R3911_REG_ANT_CAL_RESULT_tri_3                    (1<<7)
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL_mask_mod           (0x3f<<1)
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL_shift_mod          (1)
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL_mod_8percent       (0xb<<1)
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL_mod_10percent      (0xe<<1)
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL_mod_14percent      (0x14<<1)
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL_mod_20percent      (0x20<<1)
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL_mod_25percent      (0x2a<<1)
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL_mod_30percent      (0x37<<1)
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL_mod_33percent      (0x3f<<1)
+#define ST25R3911_REG_AM_MOD_DEPTH_CONTROL_am_s               (1<<7)
+#define ST25R3911_REG_RFO_AM_MOD_LEVEL_dram0                  (1<<0)
+#define ST25R3911_REG_RFO_AM_MOD_LEVEL_dram1                  (1<<1)
+#define ST25R3911_REG_RFO_AM_MOD_LEVEL_dram2                  (1<<2)
+#define ST25R3911_REG_RFO_AM_MOD_LEVEL_dram3                  (1<<3)
+#define ST25R3911_REG_RFO_AM_MOD_LEVEL_dram4                  (1<<4)
+#define ST25R3911_REG_RFO_AM_MOD_LEVEL_dram5                  (1<<5)
+#define ST25R3911_REG_RFO_AM_MOD_LEVEL_dram6                  (1<<6)
+#define ST25R3911_REG_RFO_AM_MOD_LEVEL_dram7                  (1<<7)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_t0                  (1<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_t1                  (1<<1)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_t2                  (1<<2)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_t3                  (1<<3)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_l0                  (1<<4)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_l1                  (1<<5)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_l2                  (1<<6)
+#define ST25R3911_REG_FIELD_THRESHOLD_mask_trg                (0x07<<4)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_75mV                (0x00<<4)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_105mV               (0x01<<4)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_150mV               (0x02<<4)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_205mV               (0x03<<4)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_290mV               (0x04<<4)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_400mV               (0x05<<4)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_560mV               (0x06<<4)
+#define ST25R3911_REG_FIELD_THRESHOLD_trg_800mV               (0x07<<4)
+#define ST25R3911_REG_FIELD_THRESHOLD_mask_rfe                (0x0F<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_75mV                (0x00<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_105mV               (0x01<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_150mV               (0x02<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_205mV               (0x03<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_290mV               (0x04<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_400mV               (0x05<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_560mV               (0x06<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_800mV               (0x07<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_25mV                (0x08<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_33mV                (0x09<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_47mV                (0x0A<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_64mV                (0x0B<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_90mV                (0x0C<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_125mV               (0x0D<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_175mV               (0x0E<<0)
+#define ST25R3911_REG_FIELD_THRESHOLD_rfe_250mV               (0x0F<<0)
+#define ST25R3911_REG_REGULATOR_CONTROL_shift_mpsv            (1)
+#define ST25R3911_REG_REGULATOR_CONTROL_mask_mpsv             (3<<1)
+#define ST25R3911_REG_REGULATOR_CONTROL_mpsv_vdd              (0<<1)
+#define ST25R3911_REG_REGULATOR_CONTROL_mpsv_vsp_a            (1<<1)
+#define ST25R3911_REG_REGULATOR_CONTROL_mpsv_vsp_d            (2<<1)
+#define ST25R3911_REG_REGULATOR_CONTROL_mpsv_vsp_rf           (3<<1)
+#define ST25R3911_REG_REGULATOR_CONTROL_mask_rege             (0xf<<3)
+#define ST25R3911_REG_REGULATOR_CONTROL_shift_rege            (3)
+#define ST25R3911_REG_REGULATOR_CONTROL_reg_s                 (1<<7)
+#define ST25R3911_REG_REGULATOR_RESULT_mrt_on                 (1<<0)
+#define ST25R3911_REG_REGULATOR_RESULT_nrt_on                 (1<<1)
+#define ST25R3911_REG_REGULATOR_RESULT_gpt_on                 (1<<2)
+#define ST25R3911_REG_REGULATOR_RESULT_mask_reg               (0xf<<4)
+#define ST25R3911_REG_REGULATOR_RESULT_shift_reg              (4)
+#define ST25R3911_REG_REGULATOR_RESULT_reg_0                  (1<<4)
+#define ST25R3911_REG_REGULATOR_RESULT_reg_1                  (1<<5)
+#define ST25R3911_REG_REGULATOR_RESULT_reg_2                  (1<<6)
+#define ST25R3911_REG_REGULATOR_RESULT_reg_3                  (1<<7)
+#define ST25R3911_REG_RSSI_RESULT_rssi_pm0                    (1<<0)
+#define ST25R3911_REG_RSSI_RESULT_rssi_pm1                    (1<<1)
+#define ST25R3911_REG_RSSI_RESULT_rssi_pm2                    (1<<2)
+#define ST25R3911_REG_RSSI_RESULT_rssi_pm3                    (1<<3)
+#define ST25R3911_REG_RSSI_RESULT_rssi_am_0                   (1<<4)
+#define ST25R3911_REG_RSSI_RESULT_rssi_am_1                   (1<<5)
+#define ST25R3911_REG_RSSI_RESULT_rssi_am_2                   (1<<6)
+#define ST25R3911_REG_RSSI_RESULT_rssi_am_3                   (1<<7)
+#define ST25R3911_REG_GAIN_RED_STATE_gs_pm_0                  (1<<0)
+#define ST25R3911_REG_GAIN_RED_STATE_gs_pm_1                  (1<<1)
+#define ST25R3911_REG_GAIN_RED_STATE_gs_pm_2                  (1<<2)
+#define ST25R3911_REG_GAIN_RED_STATE_gs_pm_3                  (1<<3)
+#define ST25R3911_REG_GAIN_RED_STATE_gs_am_0                  (1<<4)
+#define ST25R3911_REG_GAIN_RED_STATE_gs_am_1                  (1<<5)
+#define ST25R3911_REG_GAIN_RED_STATE_gs_am_2                  (1<<6)
+#define ST25R3911_REG_GAIN_RED_STATE_gs_am_3                  (1<<7)
+#define ST25R3911_REG_CAP_SENSOR_CONTROL_cs_g0                (1<<0)
+#define ST25R3911_REG_CAP_SENSOR_CONTROL_cs_g1                (1<<1)
+#define ST25R3911_REG_CAP_SENSOR_CONTROL_cs_g2                (1<<2)
+#define ST25R3911_REG_CAP_SENSOR_CONTROL_cs_mcal0             (1<<3)
+#define ST25R3911_REG_CAP_SENSOR_CONTROL_cs_mcal1             (1<<4)
+#define ST25R3911_REG_CAP_SENSOR_CONTROL_cs_mcal2             (1<<5)
+#define ST25R3911_REG_CAP_SENSOR_CONTROL_cs_mcal3             (1<<6)
+#define ST25R3911_REG_CAP_SENSOR_CONTROL_cs_mcal4             (1<<7)
+#define ST25R3911_REG_CAP_SENSOR_RESULT_cs_cal_err            (1<<1)
+#define ST25R3911_REG_CAP_SENSOR_RESULT_cs_cal_end            (1<<2)
+#define ST25R3911_REG_CAP_SENSOR_RESULT_cs_cal0               (1<<3)
+#define ST25R3911_REG_CAP_SENSOR_RESULT_cs_cal1               (1<<4)
+#define ST25R3911_REG_CAP_SENSOR_RESULT_cs_cal2               (1<<5)
+#define ST25R3911_REG_CAP_SENSOR_RESULT_cs_cal3               (1<<6)
+#define ST25R3911_REG_CAP_SENSOR_RESULT_cs_cal4               (1<<7)
+#define ST25R3911_REG_AUX_DISPLAY_mrt_on                      (1<<0)
+#define ST25R3911_REG_AUX_DISPLAY_nrt_on                      (1<<1)
+#define ST25R3911_REG_AUX_DISPLAY_gpt_on                      (1<<2)
+#define ST25R3911_REG_AUX_DISPLAY_rx_on                       (1<<3)
+#define ST25R3911_REG_AUX_DISPLAY_osc_ok                      (1<<4)
+#define ST25R3911_REG_AUX_DISPLAY_tx_on                       (1<<5)
+#define ST25R3911_REG_AUX_DISPLAY_efd_o                       (1<<6)
+#define ST25R3911_REG_AUX_DISPLAY_a_cha                       (1<<7)
+#define ST25R3911_REG_WUP_TIMER_CONTROL_wcap                  (1<<0)
+#define ST25R3911_REG_WUP_TIMER_CONTROL_wph                   (1<<1)
+#define ST25R3911_REG_WUP_TIMER_CONTROL_wam                   (1<<2)
+#define ST25R3911_REG_WUP_TIMER_CONTROL_wto                   (1<<3)
+#define ST25R3911_REG_WUP_TIMER_CONTROL_wut0                  (1<<4)
+#define ST25R3911_REG_WUP_TIMER_CONTROL_wut1                  (1<<5)
+#define ST25R3911_REG_WUP_TIMER_CONTROL_wut2                  (1<<6)
+#define ST25R3911_REG_WUP_TIMER_CONTROL_shift_wut             (4)
+#define ST25R3911_REG_WUP_TIMER_CONTROL_wur                   (1<<7)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_am_ae            (1<<0)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_am_aew0          (1<<1)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_am_aew1          (1<<2)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_shift_am_aew     (1)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_mask_am_aew      (3<<1)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_am_aam           (1<<3)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_am_d0            (1<<4)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_am_d1            (1<<5)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_am_d2            (1<<6)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_am_d3            (1<<7)
+#define ST25R3911_REG_AMPLITUDE_MEASURE_CONF_shift_am_d       (4)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_pm_ae                (1<<0)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_pm_aew0              (1<<1)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_pm_aew1              (1<<2)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_shift_pm_aew         (1)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_mask_pm_aew          (3<<1)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_pm_aam               (1<<3)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_pm_d0                (1<<4)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_pm_d1                (1<<5)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_pm_d2                (1<<6)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_pm_d3                (1<<7)
+#define ST25R3911_REG_PHASE_MEASURE_CONF_shift_pm_d           (4)
+#define ST25R3911_REG_CAPACITANCE_MEASURE_CONF_cm_ae          (1<<0)
+#define ST25R3911_REG_CAPACITANCE_MEASURE_CONF_cm_aew0        (1<<1)
+#define ST25R3911_REG_CAPACITANCE_MEASURE_CONF_cm_aew1        (1<<2)
+#define ST25R3911_REG_CAPACITANCE_MEASURE_CONF_cm_aam         (1<<3)
+#define ST25R3911_REG_CAPACITANCE_MEASURE_CONF_cm_d0          (1<<4)
+#define ST25R3911_REG_CAPACITANCE_MEASURE_CONF_cm_d1          (1<<5)
+#define ST25R3911_REG_CAPACITANCE_MEASURE_CONF_cm_d2          (1<<6)
+#define ST25R3911_REG_CAPACITANCE_MEASURE_CONF_cm_d3          (1<<7)
+#define ST25R3911_REG_IC_IDENTITY_v2                          (0x09)
+#define ST25R3911_REG_IC_IDENTITY_ic_type                     (1<<3)
+#define ST25R3911_REG_IC_IDENTITY_mask_ic_type                (0x1F<<3)
+#define ST25R3911_REG_IC_IDENTITY_shift_ic_type               (3)
+#define ST25R3911_REG_IC_IDENTITY_mask_ic_rev                 (7)
+
+/*! \endcond DOXYGEN_SUPRESS */
+
+/*
+******************************************************************************
+* GLOBAL FUNCTION PROTOTYPES
+******************************************************************************
+*/
+/*!
+ *****************************************************************************
+ *  \brief  Returns the content of a register within the ST25R3911
+ *
+ *  This function is used to read out the content of ST25R3911 registers.
+ *
+ *  \param[in]  reg: Address of register to read.
+ *  \param[out] val: Returned value.
+ *
+ *****************************************************************************
+ */
+//extern void st25r3911ReadRegister(uint8_t reg, uint8_t* val);
+
+/*!
+ *****************************************************************************
+ *  \brief  Writes a given value to a register within the ST25R3911
+ *
+ *  This function is used to write \a val to address \a reg within the ST25R3911.
+ *
+ *  \param[in]  reg: Address of the register to write.
+ *  \param[in]  val: Value to be written.
+ *
+ *****************************************************************************
+ */
+//extern void st25r3911WriteRegister(uint8_t reg, uint8_t val);
+
+/*!
+ *****************************************************************************
+ *  \brief  Cleart bits on Register
+ *
+ *  This function clears the given bitmask on the register
+ *
+ *  \warning This method does not guarantee consistency of register content
+ *           when called from multiple contexts (task, ISR, thread)
+ *
+ *  \param[in]  reg: Address of the register clear
+ *  \param[in]  clr_mask: Bitmask of bit to be cleared
+ *
+ *****************************************************************************
+ */
+extern void st25r3911ClrRegisterBits( uint8_t reg, uint8_t clr_mask, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Set bits on Register
+ *
+ *  This function sets the given bitmask on the register
+ *
+ *  \warning This method does not guarantee consistency of register content
+ *           when called from multiple contexts (task, ISR, thread)
+ *
+ *  \param[in]  reg: Address of the register clear
+ *  \param[in]  set_mask: Bitmask of bit to be cleared
+ *
+ *****************************************************************************
+ */
+extern void st25r3911SetRegisterBits( uint8_t reg, uint8_t set_mask, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Changes the given bits on a ST25R3911 register
+ *
+ *  This function is used if only a particular bits should be changed within
+ *  an ST25R3911 register.
+ *
+ *  \warning This method does not guarantee consistency of register content
+ *           when called from multiple contexts (task, ISR, thread)
+ *
+ *  \param[in]  reg: Address of the register to write.
+ *  \param[in]  valueMask: bitmask of bits to be changed
+ *  \param[in]  value: the bits to be written on the enabled valueMask bits
+ *
+ *****************************************************************************
+ */
+extern void st25r3911ChangeRegisterBits(uint8_t reg, uint8_t valueMask, uint8_t value, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Read a test register within the ST25R3911
+ *
+ *  This function is used to read the content of test address \a reg within the ST25R3911.
+ *
+ *  \param[in]   reg: Address of the register to read.
+ *  \param[out]  val: Returned read.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911ReadTestRegister(uint8_t reg, uint8_t* val, ST25R3911* mST25, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Writes a given value to a test register within the ST25R3911
+ *
+ *  This function is used to write \a val to test address \a reg within the ST25R3911.
+ *
+ *  \param[in]  reg: Address of the register to write.
+ *  \param[in]  val: Value to be written.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911WriteTestRegister(uint8_t reg, uint8_t val, ST25R3911* mST25, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Modifies a value within a ST25R3911 register
+ *
+ *  This function is used if only a particular bits should be changed within
+ *  an ST25R3911 register.
+ *
+ *  \warning This method does not guarantee consistency of register content
+ *           when called from multiple contexts (task, ISR, thread)
+ *
+ *  \param[in]  reg: Address of the register to write.
+ *  \param[in]  clr_mask: bitmask of bits to be cleared to 0.
+ *  \param[in]  set_mask: bitmask of bits to be set to 1.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911ModifyRegister(uint8_t reg, uint8_t clr_mask, uint8_t set_mask, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Changes the given bits on a ST25R3911 Test register
+ *
+ *  This function is used if only a particular bits should be changed within
+ *  an ST25R3916 register.
+ *
+ *  \param[in]  reg: Address of the Test register to change.
+ *  \param[in]  valueMask: bitmask of bits to be changed
+ *  \param[in]  value: the bits to be written on the enabled valueMask bits
+ *
+ *  \warning This method does not guarantee consistency of register content
+ *           when called from multiple contexts (task, ISR, thread)
+
+ *  \return ERR_NONE  : Operation successful
+ *  \return ERR_PARAM : Invalid parameter
+ *  \return ERR_SEND  : Transmission error or acknowledge not received
+ *****************************************************************************
+ */
+extern void st25r3911ChangeTestRegisterBits( uint8_t reg, uint8_t valueMask, uint8_t value, ST25R3911* mST25, SPI* mspiChannel, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Check if register ID is valid
+ *
+ *  Checks if the given register ID a valid ST25R3911 register
+ *
+ *  \param[in]  reg: Address of register to check
+ *
+ *  \return  true if is a valid register ID
+ *  \return  false otherwise
+ *
+ *****************************************************************************
+ */
+extern bool st25r3911IsRegValid( uint8_t reg );
+
+#endif /* ST25R3911_COM_H */
+
+/**
+  * @}
+  *
+  * @}
+  *
+  * @}
+  *
+  * @}
+  */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/st25r3911_interrupt.cpp	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,236 @@
+
+/******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty
+  *
+  * Unless required by applicable law or agreed to in writing, software 
+  * distributed under the License is distributed on an "AS IS" BASIS, 
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+******************************************************************************/
+
+
+/*
+ *      PROJECT:   ST25R3911 firmware
+ *      $Revision: $
+ *      LANGUAGE:  ISO C99
+ */
+
+/*! \file
+ *
+ *  \author Ulrich Herrmann
+ *
+ *  \brief ST25R3911 Interrupt handling
+ *
+ */
+
+/*
+******************************************************************************
+* INCLUDES
+******************************************************************************
+*/
+#include "st25r3911_interrupt.h"
+#include "st25r3911_com.h"
+#include "ST25R3911.h"
+#include "st_errno.h"
+#include "utils.h"
+#include "rfal_rf.h"
+
+
+/*
+******************************************************************************
+* GLOBAL DEFINES
+******************************************************************************
+*/
+
+/*! Length of the interrupt registers       */
+#define ST25R3911_INT_REGS_LEN          ( (ST25R3911_REG_IRQ_ERROR_WUP - ST25R3911_REG_IRQ_MAIN) + 1 )
+
+/*
+ ******************************************************************************
+ * LOCAL DATA TYPES
+ ******************************************************************************
+ */
+
+/*! Holds current and previous interrupt callback pointer as well as current Interrupt status and mask */
+typedef struct s_st25r3911Interrupt
+{
+    void      (*prevCallback)(); /*!< call back function for 3911 interrupt               */
+    void      (*callback)();     /*!< call back function for 3911 interrupt               */
+    uint32_t  status;            /*!< latest interrupt status                             */
+    uint32_t  mask;              /*!< Interrupt mask. Negative mask = ST25R3911 mask regs */
+}t_st25r3911Interrupt;
+
+/*
+******************************************************************************
+* GLOBAL VARIABLES
+******************************************************************************
+*/
+
+volatile t_st25r3911Interrupt st25r3911interrupt; /*!< Instance of ST25R3911 interrupt*/
+
+extern volatile bool wakeupFlag;
+/*
+******************************************************************************
+* GLOBAL FUNCTIONS
+******************************************************************************
+*/
+void st25r3911InitInterrupts( DigitalOut* fieldLED_06 )
+{
+
+    
+    st25r3911interrupt.callback     = NULL;
+    st25r3911interrupt.prevCallback = NULL;
+    st25r3911interrupt.status       = 0;
+    st25r3911interrupt.mask         = 0;
+    
+   fieldLED_06 -> write(0);
+
+}
+
+void st25r3911Isr( SPI * mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911CheckForReceivedInterrupts(mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    if (NULL != st25r3911interrupt.callback)
+        st25r3911interrupt.callback;
+}
+
+void st25r3911CheckForReceivedInterrupts( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t  iregs[ST25R3911_INT_REGS_LEN];
+    uint32_t irqStatus;
+
+    ST_MEMSET( iregs, (uint8_t)ST25R3911_IRQ_MASK_ALL, ST25R3911_INT_REGS_LEN );
+        
+
+
+       mST25 -> readMultipleRegisters(ST25R3911_REG_IRQ_MAIN, iregs, sizeof(iregs), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+       if (iregs[0] & ST25R3911_IRQ_MASK_TXE)
+       {
+    	   fieldLED_06 -> write(1);
+       }
+
+
+
+       irqStatus  = (uint32_t)iregs[0];
+       irqStatus |= (uint32_t)iregs[1]<<8;
+       irqStatus |= (uint32_t)iregs[2]<<16;
+       /* forward all interrupts, even masked ones to application. */
+       st25r3911interrupt.status |= irqStatus;
+
+}
+
+
+void st25r3911ModifyInterrupts(uint32_t clr_mask, uint32_t set_mask,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    int i;
+    uint32_t old_mask;
+    uint32_t new_mask;
+
+    old_mask = st25r3911interrupt.mask;
+    new_mask = (~old_mask & set_mask) | (old_mask & clr_mask);
+    st25r3911interrupt.mask &= ~clr_mask;
+    st25r3911interrupt.mask |= set_mask;
+    for (i=0; i<3 ; i++)
+    { 
+        if (! ((new_mask >> (8*i)) & 0xff)) continue;
+        mST25 -> writeRegister(ST25R3911_REG_IRQ_MASK_MAIN + i, (st25r3911interrupt.mask>>(8*i))&0xff, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+    }
+    return;
+}
+
+
+uint32_t st25r3911WaitForInterruptsTimed(uint32_t mask, uint16_t tmo, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint32_t tmr;
+    uint32_t status;
+   
+    tmr = platformTimerCreate(tmo);
+    do 
+    {
+    	st25r3911Isr(mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+        status = st25r3911interrupt.status & mask;
+    } while ((!status) && !platformTimerIsExpired(tmr));
+
+    status = st25r3911interrupt.status & mask;
+    
+    st25r3911interrupt.status &= ~status;
+
+    
+    return status;
+}
+
+
+uint32_t st25r3911GetInterrupt(uint32_t mask, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+	st25r3911Isr(mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    mask &= st25r3911interrupt.status;
+
+    if (mask)
+    {
+        st25r3911interrupt.status &= ~mask;
+
+    }
+    return mask;
+}
+
+void st25r3911EnableInterrupts(uint32_t mask,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911ModifyInterrupts(mask,0, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+void st25r3911DisableInterrupts(uint32_t mask,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    st25r3911ModifyInterrupts(0,mask, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+}
+
+void st25r3911ClearInterrupts( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
+{
+    uint8_t iregs[3];
+
+    mST25 -> readMultipleRegisters(ST25R3911_REG_IRQ_MAIN, iregs, 3, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
+
+    st25r3911interrupt.status = 0;
+
+
+    return;
+}
+
+void st25r3911IRQCallbackSet( void (*cb)() )
+{
+    st25r3911interrupt.prevCallback = st25r3911interrupt.callback;
+    st25r3911interrupt.callback     = cb;
+}
+
+void st25r3911IRQCallbackRestore( void )
+{
+    st25r3911interrupt.callback     = st25r3911interrupt.prevCallback;
+    st25r3911interrupt.prevCallback = NULL;
+}
+
+uint8_t st25r3911ChipHasWoke( void )
+{
+	uint8_t flagWake = 0;
+
+	 if( (st25r3911interrupt.status & 0x0001) == 1 )
+	 {
+		flagWake = 1;
+	 }
+	 return flagWake;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/st25r3911_interrupt.h	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,267 @@
+
+/******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+******************************************************************************/
+
+
+/*
+ *      PROJECT:   ST25R3911 firmware
+ *      $Revision: $
+ *      LANGUAGE:  ISO C99
+ */
+
+/*! \file
+ *
+ *  \author Ulrich Herrmann
+ *
+ *  \brief ST25R3911 Interrupt header file
+ *
+ *
+ * @addtogroup RFAL
+ * @{
+ *
+ * @addtogroup RFAL-HAL
+ * @brief RFAL Hardware Abstraction Layer
+ * @{
+ *
+ * @addtogroup ST25R3911
+ * @brief RFAL ST25R3911 Driver
+ * @{
+ *
+ * @addtogroup ST25R3911_Interrupt
+ * @brief RFAL ST25R3911 Interrupt
+ * @{
+ *
+ */
+
+#ifndef ST25R3911_INTERRUPT_H
+#define ST25R3911_INTERRUPT_H
+
+/*
+******************************************************************************
+* INCLUDES
+******************************************************************************
+*/
+#include "platform1.h"
+#include "ST25R3911.h"
+
+
+/*
+******************************************************************************
+* GLOBAL DEFINES
+******************************************************************************
+*/
+
+/* Main interrupt register. */
+#define ST25R3911_IRQ_MASK_ALL             (uint32_t)(0xFFFFFF) /*!< All ST25R3911 interrupt sources. */
+#define ST25R3911_IRQ_MASK_NONE            (uint32_t)(0)        /*!< No ST25R3911 interrupt source. */
+#define ST25R3911_IRQ_MASK_OSC             (uint32_t)(0x80)     /*!< ST25R3911 oscillator stable interrupt. */
+#define ST25R3911_IRQ_MASK_FWL             (uint32_t)(0x40)     /*!< ST25R3911 FIFO water level interrupt. */
+#define ST25R3911_IRQ_MASK_RXS             (uint32_t)(0x20)     /*!< ST25R3911 start of receive interrupt. */
+#define ST25R3911_IRQ_MASK_RXE             (uint32_t)(0x10)     /*!< ST25R3911 end of receive interrupt. */
+#define ST25R3911_IRQ_MASK_TXE             (uint32_t)(0x08)     /*!< ST25R3911 end of transmission interrupt. */
+#define ST25R3911_IRQ_MASK_COL             (uint32_t)(0x04)     /*!< ST25R3911 bit collision interrupt. */
+
+/* Timer and NFC interrupt register. */
+#define ST25R3911_IRQ_MASK_DCT             (uint32_t)(0x8000)   /*!< ST25R3911 termination of direct command interrupt. */
+#define ST25R3911_IRQ_MASK_NRE             (uint32_t)(0x4000)   /*!< ST25R3911 no-response timer expired interrupt. */
+#define ST25R3911_IRQ_MASK_GPE             (uint32_t)(0x2000)   /*!< ST25R3911 general purpose timer expired interrupt. */
+#define ST25R3911_IRQ_MASK_EON             (uint32_t)(0x1000)   /*!< ST25R3911 external field on interrupt. */
+#define ST25R3911_IRQ_MASK_EOF             (uint32_t)(0x0800)   /*!< ST25R3911 external field off interrupt. */
+#define ST25R3911_IRQ_MASK_CAC             (uint32_t)(0x0400)   /*!< ST25R3911 collision during RF collision avoidance interrupt. */
+#define ST25R3911_IRQ_MASK_CAT             (uint32_t)(0x0200)   /*!< ST25R3911 minimum guard time expired interrupt. */
+#define ST25R3911_IRQ_MASK_NFCT            (uint32_t)(0x0100)   /*!< ST25R3911 initiator bit rate recognized interrupt. */
+
+/* Error and wake-up interrupt register. */
+#define ST25R3911_IRQ_MASK_CRC             (uint32_t)(0x800000) /*!< ST25R3911 CRC error interrupt. */
+#define ST25R3911_IRQ_MASK_PAR             (uint32_t)(0x400000) /*!< ST25R3911 parity error interrupt. */
+#define ST25R3911_IRQ_MASK_ERR2            (uint32_t)(0x200000) /*!< ST25R3911 soft framing error interrupt. */
+#define ST25R3911_IRQ_MASK_ERR1            (uint32_t)(0x100000) /*!< ST25R3911 hard framing error interrupt. */
+#define ST25R3911_IRQ_MASK_WT              (uint32_t)(0x080000) /*!< ST25R3911 wake-up interrupt. */
+#define ST25R3911_IRQ_MASK_WAM             (uint32_t)(0x040000) /*!< ST25R3911 wake-up due to amplitude interrupt. */
+#define ST25R3911_IRQ_MASK_WPH             (uint32_t)(0x020000) /*!< ST25R3911 wake-up due to phase interrupt. */
+#define ST25R3911_IRQ_MASK_WCAP            (uint32_t)(0x010000) /*!< ST25R3911 wake-up due to capacitance measurement. */
+
+
+#define ST25R3911_IRQ_MASK_TIM             (0x02)               /*!< additional interrupts in ST25R3911_REG_IRQ_TIMER_NFC */
+#define ST25R3911_IRQ_MASK_ERR             (0x01)               /*!< additional interrupts in ST25R3911_REG_IRQ_ERROR_WUP */
+
+
+/*
+******************************************************************************
+* GLOBAL FUNCTION PROTOTYPES
+******************************************************************************
+*/
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Wait until an ST25R3911 interrupt occurs
+ *
+ *  This function is used to access the ST25R3911 interrupt flags. Use this
+ *  to wait for max. \a tmo milliseconds for the \b first interrupt indicated
+ *  with mask \a mask to occur.
+ *
+ *  \param[in] mask : mask indicating the interrupts to wait for.
+ *  \param[in] tmo : time in milliseconds until timeout occurs. If set to 0
+ *                   the functions waits forever.
+ *
+ *  \return : 0 if timeout occured otherwise a mask indicating the cleared
+ *              interrupts.
+ *
+ *****************************************************************************
+ */
+extern uint32_t st25r3911WaitForInterruptsTimed(uint32_t mask, uint16_t tmo, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Get status for the given interrupt
+ *
+ *  This function is used to check whether the interrupt given by \a mask
+ *  has occured. If yes the interrupt gets cleared. This function returns
+ *  only status bits which are inside \a mask.
+ *
+ *  \param[in] mask : mask indicating the interrupt to check for.
+ *
+ *  \return the mask of the interrupts occurred
+ *
+ *****************************************************************************
+ */
+extern uint32_t st25r3911GetInterrupt(uint32_t mask, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Checks if there is an interrupt
+ *
+ *  This function is used to check whether the interrupt given by \a mask
+ *  has occured.
+ *
+ *****************************************************************************
+ */
+//extern void st25r3911CheckForReceivedInterrupts( SPI* mspiChannel );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Init the 3911 interrupt
+ *
+ *  This function is used to check whether the interrupt given by \a mask
+ *  has occured.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911InitInterrupts( DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  Modifies the Interrupt
+ *
+ *  This function modifies the interrupt
+ *
+ *  \param[in] clr_mask : bit mask to be cleared on the interrupt mask
+ *  \param[in] set_mask : bit mask to be set on the interrupt mask
+ *****************************************************************************
+ */
+extern void st25r3911ModifyInterrupts(uint32_t clr_mask, uint32_t set_mask,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief Checks received interrupts
+ *
+ *  Checks received interrupts and saves the result into global params
+ *****************************************************************************
+ */
+extern void st25r3911CheckForReceivedInterrupts( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+
+/*!
+ *****************************************************************************
+ *  \brief  ISR Service routine
+ *
+ *  This function modifies the interrupt
+ *****************************************************************************
+ */
+extern void  st25r3911Isr( SPI * mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Enable a given ST25R3911 Interrupt source
+ *
+ *  This function enables all interrupts given by \a mask,
+ *  ST25R3911_IRQ_MASK_ALL enables all interrupts.
+ *
+ *  \param[in] mask: mask indicating the interrupts to be enabled
+ *
+ *****************************************************************************
+ */
+extern void st25r3911EnableInterrupts(uint32_t mask, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Disable one or more a given ST25R3911 Interrupt sources
+ *
+ *  This function disables all interrupts given by \a mask. 0xff disables all.
+ *
+ *  \param[in] mask: mask indicating the interrupts to be disabled.
+ *
+ *****************************************************************************
+ */
+extern void st25r3911DisableInterrupts( uint32_t mask,SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Clear all st25r3911 irq flags
+ *
+ *****************************************************************************
+ */
+extern void st25r3911ClearInterrupts( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
+
+/*!
+ *****************************************************************************
+ *  \brief  Sets IRQ callback for the ST25R3911 interrupt
+ *
+ *****************************************************************************
+ */
+extern void st25r3911IRQCallbackSet(void (*cb)());
+
+/*!
+ *****************************************************************************
+ *  \brief  Sets IRQ callback for the ST25R3911 interrupt
+ *
+ *****************************************************************************
+ */
+extern void st25r3911IRQCallbackRestore(void);
+
+extern uint8_t st25r3911ChipHasWoke( void );
+
+#endif /* ST25R3911_ISR_H */
+
+/**
+  * @}
+  *
+  * @}
+  *
+  * @}
+  *
+  * @}
+  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/st_errno.h	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,164 @@
+
+/******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+******************************************************************************/
+
+
+/*
+ *      PROJECT:   STxxxx firmware
+ *      LANGUAGE:  ISO C99
+ */
+
+/*! \file st_errno.h
+ *
+ *  \author
+ *
+ *  \brief Main error codes
+ *
+ */
+
+#ifndef ST_ERRNO_H
+#define ST_ERRNO_H
+
+/*
+******************************************************************************
+* INCLUDES
+******************************************************************************
+*/
+
+#include "mbed.h"
+
+/*
+******************************************************************************
+* GLOBAL DATA TYPES
+******************************************************************************
+*/
+
+typedef uint16_t      ReturnCode; /*!< Standard Return Code type from function. */
+
+/*
+******************************************************************************
+* DEFINES
+******************************************************************************
+*/
+
+
+/*
+ * Error codes to be used within the application.
+ * They are represented by an uint8_t
+ */
+enum {
+    ERR_NONE                              =  0, /*!< no error occurred */
+    ERR_NOMEM                             =  1, /*!< not enough memory to perform the requested operation */
+    ERR_BUSY                              =  2, /*!< device or resource busy */
+    ERR_IO                                =  3, /*!< generic IO error */
+    ERR_TIMEOUT                           =  4, /*!< error due to timeout */
+    ERR_REQUEST                           =  5, /*!< invalid request or requested function can't be executed at the moment */
+    ERR_NOMSG                             =  6, /*!< No message of desired type */
+    ERR_PARAM                             =  7, /*!< Parameter error */
+    ERR_SYSTEM                            =  8, /*!< System error */
+    ERR_FRAMING                           =  9, /*!< Framing error */
+    ERR_OVERRUN                           = 10, /*!< lost one or more received bytes */
+    ERR_PROTO                             = 11, /*!< protocol error */
+    ERR_INTERNAL                          = 12, /*!< Internal Error */
+    ERR_AGAIN                             = 13, /*!< Call again */
+    ERR_MEM_CORRUPT                       = 14, /*!< memory corruption */
+    ERR_NOT_IMPLEMENTED                   = 15, /*!< not implemented */
+    ERR_PC_CORRUPT                        = 16, /*!< Program Counter has been manipulated or spike/noise trigger illegal operation */
+    ERR_SEND                              = 17, /*!< error sending*/
+    ERR_IGNORE                            = 18, /*!< indicates error detected but to be ignored */
+    ERR_SEMANTIC                          = 19, /*!< indicates error in state machine (unexpected cmd) */
+    ERR_SYNTAX                            = 20, /*!< indicates error in state machine (unknown cmd) */
+    ERR_CRC                               = 21, /*!< crc error */
+    ERR_NOTFOUND                          = 22, /*!< transponder not found */
+    ERR_NOTUNIQUE                         = 23, /*!< transponder not unique - more than one transponder in field */
+    ERR_NOTSUPP                           = 24, /*!< requested operation not supported */
+    ERR_WRITE                             = 25, /*!< write error */
+    ERR_FIFO                              = 26, /*!< fifo over or underflow error */
+    ERR_PAR                               = 27, /*!< parity error */
+    ERR_DONE                              = 28, /*!< transfer has already finished */
+    ERR_RF_COLLISION                      = 29, /*!< collision error (Bit Collision or during RF Collision avoidance ) */
+    ERR_HW_OVERRUN                        = 30, /*!< lost one or more received bytes */
+    ERR_RELEASE_REQ                       = 31, /*!< device requested release */
+    ERR_SLEEP_REQ                         = 32, /*!< device requested sleep */
+    ERR_WRONG_STATE                       = 33, /*!< incorrent state for requested operation */
+    ERR_MAX_RERUNS                        = 34, /*!< blocking procedure reached maximum runs */
+    ERR_DISABLED                          = 35, /*!< operation aborted due to disabled configuration */
+    ERR_HW_MISMATCH                       = 36, /*!< expected hw do not match  */
+    ERR_LINK_LOSS                         = 37, /*!< Other device's field didn't behave as expected: turned off by Initiator in Passive mode, or AP2P did not turn on field */
+    ERR_INVALID_HANDLE                    = 38, /*!< invalid or not initalized device handle */
+
+    ERR_INCOMPLETE_BYTE                   = 40, /*!< Incomplete byte rcvd         */
+    ERR_INCOMPLETE_BYTE_01                = 41, /*!< Incomplete byte rcvd - 1 bit */
+    ERR_INCOMPLETE_BYTE_02                = 42, /*!< Incomplete byte rcvd - 2 bit */
+    ERR_INCOMPLETE_BYTE_03                = 43, /*!< Incomplete byte rcvd - 3 bit */
+    ERR_INCOMPLETE_BYTE_04                = 44, /*!< Incomplete byte rcvd - 4 bit */
+    ERR_INCOMPLETE_BYTE_05                = 45, /*!< Incomplete byte rcvd - 5 bit */
+    ERR_INCOMPLETE_BYTE_06                = 46, /*!< Incomplete byte rcvd - 6 bit */
+    ERR_INCOMPLETE_BYTE_07                = 47  /*!< Incomplete byte rcvd - 7 bit */
+};
+
+
+/* General Sub-category number */
+#define ERR_GENERIC_GRP                     (0x0000)  /*!< Reserved value for generic error no */
+#define ERR_WARN_GRP                        (0x0100)  /*!< Errors which are not expected in normal operation */
+#define ERR_PROCESS_GRP                     (0x0200)  /*!< Processes management errors */
+#define ERR_SIO_GRP                         (0x0800)  /*!< SIO errors due to logging */
+#define ERR_RINGBUF_GRP                     (0x0900)  /*!< Ring Buffer errors */
+#define ERR_MQ_GRP                          (0x0A00)  /*!< MQ errors */
+#define ERR_TIMER_GRP                       (0x0B00)  /*!< Timer errors */
+#define ERR_RFAL_GRP                        (0x0C00)  /*!< RFAL errors */
+#define ERR_UART_GRP                        (0x0D00)  /*!< UART errors */
+#define ERR_SPI_GRP                         (0x0E00)  /*!< SPI errors */
+#define ERR_I2C_GRP                         (0x0F00)  /*!< I2c errors */
+
+
+#define ERR_INSERT_SIO_GRP(x)               (ERR_SIO_GRP     | x)  /*!< Insert the SIO grp */
+#define ERR_INSERT_RINGBUF_GRP(x)           (ERR_RINGBUF_GRP | x)  /*!< Insert the Ring Buffer grp */
+#define ERR_INSERT_RFAL_GRP(x)              (ERR_RFAL_GRP  | x)    /*!< Insert the RFAL grp */
+#define ERR_INSERT_SPI_GRP(x)               (ERR_SPI_GRP     | x)  /*!< Insert the spi grp */
+#define ERR_INSERT_I2C_GRP(x)               (ERR_I2C_GRP     | x)  /*!< Insert the i2c grp */
+#define ERR_INSERT_UART_GRP(x)              (ERR_UART_GRP    | x)  /*!< Insert the uart grp */
+#define ERR_INSERT_TIMER_GRP(x)             (ERR_TIMER_GRP   | x)  /*!< Insert the timer grp */
+#define ERR_INSERT_MQ_GRP(x)                (ERR_MQ_GRP      | x)  /*!< Insert the mq grp */
+#define ERR_INSERT_PROCESS_GRP(x)           (ERR_PROCESS_GRP | x)  /*!< Insert the process grp */
+#define ERR_INSERT_WARN_GRP(x)              (ERR_WARN_GRP    | x)  /*!< Insert the i2c grp */
+#define ERR_INSERT_GENERIC_GRP(x)           (ERR_GENERIC_GRP | x)  /*!< Insert the generic grp */
+
+
+/*
+******************************************************************************
+* GLOBAL MACROS
+******************************************************************************
+*/
+
+#define ERR_NO_MASK(x)                      (x & 0x00FF)    /*!< Mask the error number */
+
+
+
+/*! Common code to exit a function with the error if function f return error */
+#define EXIT_ON_ERR(r, f)     \
+    if (ERR_NONE != (r = f))  \
+    {                         \
+        return r;             \
+    }
+
+#endif /* ST_ERRNO_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/timer1.cpp	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,116 @@
+/******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty
+  *
+  * Unless required by applicable law or agreed to in writing, software 
+  * distributed under the License is distributed on an "AS IS" BASIS, 
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+******************************************************************************/
+/*
+ *      PROJECT:   ST25R391x firmware
+ *      $Revision: $
+ *      LANGUAGE:  ANSI C
+ */
+
+/*! \file timer.c
+ *
+ *  \brief SW Timer implementation
+ *
+ *  \author Gustavo Patricio
+ *
+ *   This module makes use of a System Tick in millisconds and provides
+ *   an abstraction for SW timers
+ *
+ */
+
+/*
+******************************************************************************
+* INCLUDES
+******************************************************************************
+*/
+#include "timer1.h"
+
+
+/*
+******************************************************************************
+* LOCAL DEFINES
+******************************************************************************
+*/
+
+/*
+******************************************************************************
+* LOCAL VARIABLES
+******************************************************************************
+*/
+
+static uint32_t timerStopwatchTick;
+
+/*
+******************************************************************************
+* GLOBAL FUNCTIONS
+******************************************************************************
+*/
+
+
+/*******************************************************************************/
+uint32_t timerCalculateTimer( uint16_t time )
+{  
+  return (platformGetSysTick() + time);
+}
+
+
+/*******************************************************************************/
+bool timerIsExpired( uint32_t timer )
+{
+  uint32_t uDiff;
+  int32_t sDiff;
+  
+  uDiff = (timer - platformGetSysTick());   /* Calculate the diff between the timers */
+  sDiff = uDiff;                            /* Convert the diff to a signed var      */
+  
+  /* Check if the given timer has expired already */
+  if( sDiff < 0 )
+  {
+    return true;
+  }
+  
+  return false;
+}
+
+
+/*******************************************************************************/
+void timerDelay( uint16_t tOut )
+{
+  uint32_t t;
+  
+  /* Calculate the timer and wait blocking until is running */
+  t = timerCalculateTimer( tOut );
+  while( timerIsRunning(t) );
+}
+
+
+/*******************************************************************************/
+void timerStopwatchStart( void )
+{
+  timerStopwatchTick = platformGetSysTick();
+}
+
+
+/*******************************************************************************/
+uint32_t timerStopwatchMeasure( void )
+{
+  return (uint32_t)(platformGetSysTick() - timerStopwatchTick);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/timer1.h	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,128 @@
+/******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+******************************************************************************/
+/*
+ *      PROJECT:   ST25R391x firmware
+ *      $Revision: $
+ *      LANGUAGE:  ANSI C
+ */
+
+/*! \file timer.h
+ *
+ *  \brief SW Timer implementation header file
+ *
+ *   This module makes use of a System Tick in millisconds and provides
+ *   an abstraction for SW timers
+ *
+ */
+
+
+ /*
+******************************************************************************
+* INCLUDES
+******************************************************************************
+*/
+#include "platform1.h"
+
+/*
+******************************************************************************
+* GLOBAL MACROS
+******************************************************************************
+*/
+#define timerIsRunning(t)            (!timerIsExpired(t))
+
+/*
+******************************************************************************
+* GLOBAL DEFINES
+******************************************************************************
+*/
+
+ /*!
+ *****************************************************************************
+ * \brief  Calculate Timer
+ *
+ * This method calculates when the timer will be expired given the amount
+ * time in milliseconds /a tOut.
+ * Once the timer has been calculated it will then be used to check when
+ * it expires.
+ *
+ * \see timersIsExpired
+ *
+ * \param[in]  time : time/duration in Milliseconds for the timer
+ *
+ * \return u32 : The new timer calculated based on the given time
+ *****************************************************************************
+ */
+uint32_t timerCalculateTimer( uint16_t time );
+
+
+/*!
+ *****************************************************************************
+ * \brief  Checks if a Timer is Expired
+ *
+ * This method checks if a timer has already expired.
+ * Based on the given timer previously calculated it checks if this timer
+ * has already elapsed
+ *
+ * \see timersCalculateTimer
+ *
+ * \param[in]  timer : the timer to check
+ *
+ * \return true  : timer has already expired
+ * \return false : timer is still running
+ *****************************************************************************
+ */
+bool timerIsExpired( uint32_t timer );
+
+
+ /*!
+ *****************************************************************************
+ * \brief  Performs a Delay
+ *
+ * This method performs a delay for the given amount of time in Milliseconds
+ *
+ * \param[in]  time : time/duration in Milliseconds of the delay
+ *
+ *****************************************************************************
+ */
+void timerDelay( uint16_t time );
+
+
+/*!
+ *****************************************************************************
+ * \brief  Stopwatch start
+ *
+ * This method initiates the stopwatch to later measure the time in ms
+ *
+ *****************************************************************************
+ */
+void timerStopwatchStart( void );
+
+
+/*!
+ *****************************************************************************
+ * \brief  Stopwatch Measure
+ *
+ * This method returns the elapsed time in ms since the stopwatch was initiated
+ *
+ * \return The time in ms since the stopwatch was started
+ *****************************************************************************
+ */
+uint32_t timerStopwatchMeasure( void );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils.h	Thu Nov 14 14:36:52 2019 +0000
@@ -0,0 +1,102 @@
+
+/******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
+  *
+  * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
+  * You may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *        http://www.st.com/myliberty
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+  * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  *
+******************************************************************************/
+
+
+/*
+ *      PROJECT:   NFCC firmware
+ *      $Revision: $
+ *      LANGUAGE:  ISO C99
+ */
+
+/*! \file
+ *
+ *  \author Ulrich Herrmann
+ *
+ *  \brief Common and helpful macros
+ *
+ */
+
+#ifndef UTILS_H
+#define UTILS_H
+
+/*
+******************************************************************************
+* INCLUDES
+******************************************************************************
+*/
+#include <string.h>
+
+/*
+******************************************************************************
+* GLOBAL MACROS
+******************************************************************************
+*/
+/*!
+ * this macro evaluates an error variable \a ERR against an error code \a EC.
+ * in case it is not equal it jumps to the given label \a LABEL.
+ */
+#define EVAL_ERR_NE_GOTO(EC, ERR, LABEL)                                   \
+    if (EC != ERR) goto LABEL;
+
+/*!
+ * this macro evaluates an error variable \a ERR against an error code \a EC.
+ * in case it is equal it jumps to the given label \a LABEL.
+ */
+#define EVAL_ERR_EQ_GOTO(EC, ERR, LABEL)                                   \
+    if (EC == ERR) goto LABEL;
+
+#define SIZEOF_ARRAY(a)     (sizeof(a) / sizeof(a[0]))    /*!< Compute the size of an array           */
+#define MAX(a, b)           (((a) > (b)) ? (a) : (b))    /*!< Return the maximum of the 2 values     */
+#define MIN(a, b)           (((a) < (b)) ? (a) : (b))    /*!< Return the minimum of the 2 values     */
+#define BITMASK_1           (0x01)                        /*!< Bit mask for lsb bit                   */
+#define BITMASK_2           (0x03)                        /*!< Bit mask for two lsb bits              */
+#define BITMASK_3           (0x07)                        /*!< Bit mask for three lsb bits            */
+#define BITMASK_4           (0x0F)                        /*!< Bit mask for four lsb bits             */
+#define U16TOU8(a)          ((a) & 0x00FF)                /*!< Cast 16-bit unsigned to 8-bit unsigned */
+#define GETU16(a)           (uint16_t)((a[0] << 8) | a[1])/*!< Cast two Big Endian 8-bits byte array to 16-bits unsigned */
+
+
+#define REVERSE_BYTES(pData, nDataSize) \
+  unsigned char swap, *lo = pData, *hi = pData + nDataSize - 1; \
+  while (lo < hi) { swap = *lo; *lo++ = *hi; *hi-- = swap; }
+
+
+#define ST_MEMMOVE          memmove     /*!< map memmove to string library code */
+#define ST_MEMCPY           memcpy      /*!< map memcpy to string library code  */
+#define ST_MEMSET           memset      /*!< map memset to string library code  */
+#define ST_BYTECMP          memcmp      /*!< map bytecmp to string library code */
+
+#define NO_WARNING(v)      ((void) (v)) /*!< Macro to suppress compiler warning */
+
+
+#ifndef NULL
+  #define NULL (void*)0                 /*!< represents a NULL pointer */
+#endif /* !NULL */
+
+/*
+******************************************************************************
+* GLOBAL FUNCTION PROTOTYPES
+******************************************************************************
+*/
+
+#endif /* UTILS_H */
+