ST25R3911 library for the STMicroelectronics X-NUCLEO-NFC05A1
ST25R3911.h@0:98fcd1266df0, 2019-11-14 (annotated)
- Committer:
- DiegoOstuni
- Date:
- Thu Nov 14 14:36:52 2019 +0000
- Revision:
- 0:98fcd1266df0
Fork of the GitHub
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DiegoOstuni | 0:98fcd1266df0 | 1 | |
DiegoOstuni | 0:98fcd1266df0 | 2 | /****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 3 | * @attention |
DiegoOstuni | 0:98fcd1266df0 | 4 | * |
DiegoOstuni | 0:98fcd1266df0 | 5 | * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2> |
DiegoOstuni | 0:98fcd1266df0 | 6 | * |
DiegoOstuni | 0:98fcd1266df0 | 7 | * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License"); |
DiegoOstuni | 0:98fcd1266df0 | 8 | * You may not use this file except in compliance with the License. |
DiegoOstuni | 0:98fcd1266df0 | 9 | * You may obtain a copy of the License at: |
DiegoOstuni | 0:98fcd1266df0 | 10 | * |
DiegoOstuni | 0:98fcd1266df0 | 11 | * http://www.st.com/myliberty |
DiegoOstuni | 0:98fcd1266df0 | 12 | * |
DiegoOstuni | 0:98fcd1266df0 | 13 | * Unless required by applicable law or agreed to in writing, software |
DiegoOstuni | 0:98fcd1266df0 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
DiegoOstuni | 0:98fcd1266df0 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, |
DiegoOstuni | 0:98fcd1266df0 | 16 | * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY, |
DiegoOstuni | 0:98fcd1266df0 | 17 | * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
DiegoOstuni | 0:98fcd1266df0 | 18 | * See the License for the specific language governing permissions and |
DiegoOstuni | 0:98fcd1266df0 | 19 | * limitations under the License. |
DiegoOstuni | 0:98fcd1266df0 | 20 | * |
DiegoOstuni | 0:98fcd1266df0 | 21 | ******************************************************************************/ |
DiegoOstuni | 0:98fcd1266df0 | 22 | |
DiegoOstuni | 0:98fcd1266df0 | 23 | |
DiegoOstuni | 0:98fcd1266df0 | 24 | /* |
DiegoOstuni | 0:98fcd1266df0 | 25 | * PROJECT: ST25R3911 firmware |
DiegoOstuni | 0:98fcd1266df0 | 26 | * $Revision: $ |
DiegoOstuni | 0:98fcd1266df0 | 27 | * LANGUAGE: ISO C99 |
DiegoOstuni | 0:98fcd1266df0 | 28 | */ |
DiegoOstuni | 0:98fcd1266df0 | 29 | |
DiegoOstuni | 0:98fcd1266df0 | 30 | /*! \file |
DiegoOstuni | 0:98fcd1266df0 | 31 | * |
DiegoOstuni | 0:98fcd1266df0 | 32 | * \author Ulrich Herrmann |
DiegoOstuni | 0:98fcd1266df0 | 33 | * |
DiegoOstuni | 0:98fcd1266df0 | 34 | * \brief ST25R3911 declaration file |
DiegoOstuni | 0:98fcd1266df0 | 35 | * |
DiegoOstuni | 0:98fcd1266df0 | 36 | * API: |
DiegoOstuni | 0:98fcd1266df0 | 37 | * - Initialize ST25R3911 driver: #st25r3911Initialize |
DiegoOstuni | 0:98fcd1266df0 | 38 | * - Deinitialize ST25R3911 driver: #st25r3911Deinitialize |
DiegoOstuni | 0:98fcd1266df0 | 39 | * |
DiegoOstuni | 0:98fcd1266df0 | 40 | * |
DiegoOstuni | 0:98fcd1266df0 | 41 | * @addtogroup RFAL |
DiegoOstuni | 0:98fcd1266df0 | 42 | * @{ |
DiegoOstuni | 0:98fcd1266df0 | 43 | * |
DiegoOstuni | 0:98fcd1266df0 | 44 | * @addtogroup RFAL-HAL |
DiegoOstuni | 0:98fcd1266df0 | 45 | * @brief RFAL Hardware Abstraction Layer |
DiegoOstuni | 0:98fcd1266df0 | 46 | * @{ |
DiegoOstuni | 0:98fcd1266df0 | 47 | * |
DiegoOstuni | 0:98fcd1266df0 | 48 | * @addtogroup ST25R3911 |
DiegoOstuni | 0:98fcd1266df0 | 49 | * @brief RFAL ST25R3911 Driver |
DiegoOstuni | 0:98fcd1266df0 | 50 | * @{ |
DiegoOstuni | 0:98fcd1266df0 | 51 | * |
DiegoOstuni | 0:98fcd1266df0 | 52 | * @addtogroup ST25R3911_Driver |
DiegoOstuni | 0:98fcd1266df0 | 53 | * @brief RFAL ST25R3911 Driver |
DiegoOstuni | 0:98fcd1266df0 | 54 | * @{ |
DiegoOstuni | 0:98fcd1266df0 | 55 | * |
DiegoOstuni | 0:98fcd1266df0 | 56 | */ |
DiegoOstuni | 0:98fcd1266df0 | 57 | |
DiegoOstuni | 0:98fcd1266df0 | 58 | #ifndef ST25R3911_H |
DiegoOstuni | 0:98fcd1266df0 | 59 | #define ST25R3911_H |
DiegoOstuni | 0:98fcd1266df0 | 60 | |
DiegoOstuni | 0:98fcd1266df0 | 61 | /* |
DiegoOstuni | 0:98fcd1266df0 | 62 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 63 | * INCLUDES |
DiegoOstuni | 0:98fcd1266df0 | 64 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 65 | */ |
DiegoOstuni | 0:98fcd1266df0 | 66 | |
DiegoOstuni | 0:98fcd1266df0 | 67 | #include "st_errno.h" |
DiegoOstuni | 0:98fcd1266df0 | 68 | #include "mbed.h" |
DiegoOstuni | 0:98fcd1266df0 | 69 | #include "platform1.h" |
DiegoOstuni | 0:98fcd1266df0 | 70 | #include <stdint.h> |
DiegoOstuni | 0:98fcd1266df0 | 71 | |
DiegoOstuni | 0:98fcd1266df0 | 72 | |
DiegoOstuni | 0:98fcd1266df0 | 73 | |
DiegoOstuni | 0:98fcd1266df0 | 74 | |
DiegoOstuni | 0:98fcd1266df0 | 75 | /* |
DiegoOstuni | 0:98fcd1266df0 | 76 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 77 | * LOCAL DEFINES |
DiegoOstuni | 0:98fcd1266df0 | 78 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 79 | */ |
DiegoOstuni | 0:98fcd1266df0 | 80 | |
DiegoOstuni | 0:98fcd1266df0 | 81 | #define ST25R3911_OSC_STABLE_TIMEOUT 10 /*!< Timeout for Oscillator to get stable, datasheet: 700us, take 5 ms */ |
DiegoOstuni | 0:98fcd1266df0 | 82 | #define ST25R3911_CA_TIMEOUT 10 /*!< Timeout for Collision Avoidance command */ |
DiegoOstuni | 0:98fcd1266df0 | 83 | |
DiegoOstuni | 0:98fcd1266df0 | 84 | #define ST25R3911_WRITE_MODE (0) /*!< ST25R3911 SPI Operation Mode: Write */ |
DiegoOstuni | 0:98fcd1266df0 | 85 | #define ST25R3911_READ_MODE (1 << 6) /*!< ST25R3911 SPI Operation Mode: Read */ |
DiegoOstuni | 0:98fcd1266df0 | 86 | #define ST25R3911_FIFO_LOAD (2 << 6) /*!< ST25R3911 SPI Operation Mode: FIFO Load */ |
DiegoOstuni | 0:98fcd1266df0 | 87 | #define ST25R3911_FIFO_READ (0xbf) /*!< ST25R3911 SPI Operation Mode: FIFO Read */ |
DiegoOstuni | 0:98fcd1266df0 | 88 | #define ST25R3911_CMD_MODE (3 << 6) /*!< ST25R3911 SPI Operation Mode: Direct Command */ |
DiegoOstuni | 0:98fcd1266df0 | 89 | |
DiegoOstuni | 0:98fcd1266df0 | 90 | #define ST25R3911_CMD_LEN (1) /*!< ST25R3911 CMD length */ |
DiegoOstuni | 0:98fcd1266df0 | 91 | #define ST25R3911_BUF_LEN (ST25R3911_CMD_LEN+ST25R3911_FIFO_DEPTH) /*!< ST25R3911 communication buffer: CMD + FIFO length */ |
DiegoOstuni | 0:98fcd1266df0 | 92 | |
DiegoOstuni | 0:98fcd1266df0 | 93 | |
DiegoOstuni | 0:98fcd1266df0 | 94 | class ST25R3911 { |
DiegoOstuni | 0:98fcd1266df0 | 95 | public: |
DiegoOstuni | 0:98fcd1266df0 | 96 | // ST25R3911(); |
DiegoOstuni | 0:98fcd1266df0 | 97 | /* API to comunicate with ST253911 */ |
DiegoOstuni | 0:98fcd1266df0 | 98 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 99 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 100 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 101 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 102 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 103 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 104 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 105 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 106 | |
DiegoOstuni | 0:98fcd1266df0 | 107 | }; |
DiegoOstuni | 0:98fcd1266df0 | 108 | |
DiegoOstuni | 0:98fcd1266df0 | 109 | |
DiegoOstuni | 0:98fcd1266df0 | 110 | |
DiegoOstuni | 0:98fcd1266df0 | 111 | /* |
DiegoOstuni | 0:98fcd1266df0 | 112 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 113 | * GLOBAL DATATYPES |
DiegoOstuni | 0:98fcd1266df0 | 114 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 115 | */ |
DiegoOstuni | 0:98fcd1266df0 | 116 | |
DiegoOstuni | 0:98fcd1266df0 | 117 | |
DiegoOstuni | 0:98fcd1266df0 | 118 | |
DiegoOstuni | 0:98fcd1266df0 | 119 | |
DiegoOstuni | 0:98fcd1266df0 | 120 | |
DiegoOstuni | 0:98fcd1266df0 | 121 | /*! Parameters how the stream mode should work */ |
DiegoOstuni | 0:98fcd1266df0 | 122 | struct st25r3911StreamConfig { |
DiegoOstuni | 0:98fcd1266df0 | 123 | uint8_t useBPSK; /*!< 0: subcarrier, 1:BPSK */ |
DiegoOstuni | 0:98fcd1266df0 | 124 | uint8_t din; /*!< the divider for the in subcarrier frequency: fc/2^din */ |
DiegoOstuni | 0:98fcd1266df0 | 125 | uint8_t dout; /*!< the divider for the in subcarrier frequency fc/2^dout */ |
DiegoOstuni | 0:98fcd1266df0 | 126 | uint8_t report_period_length; /*!< the length of the reporting period 2^report_period_length*/ |
DiegoOstuni | 0:98fcd1266df0 | 127 | }; |
DiegoOstuni | 0:98fcd1266df0 | 128 | |
DiegoOstuni | 0:98fcd1266df0 | 129 | |
DiegoOstuni | 0:98fcd1266df0 | 130 | /*! ST25R3911 Wake-Up Period/Timer */ |
DiegoOstuni | 0:98fcd1266df0 | 131 | typedef enum |
DiegoOstuni | 0:98fcd1266df0 | 132 | { |
DiegoOstuni | 0:98fcd1266df0 | 133 | ST25R3911_WUM_PERIDOD_10MS = 0x00, /*!< Wake-Up timer 10ms */ |
DiegoOstuni | 0:98fcd1266df0 | 134 | ST25R3911_WUM_PERIDOD_20MS = 0x01, /*!< Wake-Up timer 20ms */ |
DiegoOstuni | 0:98fcd1266df0 | 135 | ST25R3911_WUM_PERIDOD_30MS = 0x02, /*!< Wake-Up timer 30ms */ |
DiegoOstuni | 0:98fcd1266df0 | 136 | ST25R3911_WUM_PERIDOD_40MS = 0x03, /*!< Wake-Up timer 40ms */ |
DiegoOstuni | 0:98fcd1266df0 | 137 | ST25R3911_WUM_PERIDOD_50MS = 0x04, /*!< Wake-Up timer 50ms */ |
DiegoOstuni | 0:98fcd1266df0 | 138 | ST25R3911_WUM_PERIDOD_60MS = 0x05, /*!< Wake-Up timer 60ms */ |
DiegoOstuni | 0:98fcd1266df0 | 139 | ST25R3911_WUM_PERIDOD_70MS = 0x06, /*!< Wake-Up timer 70ms */ |
DiegoOstuni | 0:98fcd1266df0 | 140 | ST25R3911_WUM_PERIDOD_80MS = 0x07, /*!< Wake-Up timer 80ms */ |
DiegoOstuni | 0:98fcd1266df0 | 141 | ST25R3911_WUM_PERIDOD_100MS = 0x10, /*!< Wake-Up timer 100ms */ |
DiegoOstuni | 0:98fcd1266df0 | 142 | ST25R3911_WUM_PERIDOD_200MS = 0x11, /*!< Wake-Up timer 200ms */ |
DiegoOstuni | 0:98fcd1266df0 | 143 | ST25R3911_WUM_PERIDOD_300MS = 0x12, /*!< Wake-Up timer 300ms */ |
DiegoOstuni | 0:98fcd1266df0 | 144 | ST25R3911_WUM_PERIDOD_400MS = 0x13, /*!< Wake-Up timer 400ms */ |
DiegoOstuni | 0:98fcd1266df0 | 145 | ST25R3911_WUM_PERIDOD_500MS = 0x14, /*!< Wake-Up timer 500ms */ |
DiegoOstuni | 0:98fcd1266df0 | 146 | ST25R3911_WUM_PERIDOD_600MS = 0x15, /*!< Wake-Up timer 600ms */ |
DiegoOstuni | 0:98fcd1266df0 | 147 | ST25R3911_WUM_PERIDOD_700MS = 0x16, /*!< Wake-Up timer 700ms */ |
DiegoOstuni | 0:98fcd1266df0 | 148 | ST25R3911_WUM_PERIDOD_800MS = 0x17, /*!< Wake-Up timer 800ms */ |
DiegoOstuni | 0:98fcd1266df0 | 149 | } st25r3911WumPeriod; |
DiegoOstuni | 0:98fcd1266df0 | 150 | |
DiegoOstuni | 0:98fcd1266df0 | 151 | |
DiegoOstuni | 0:98fcd1266df0 | 152 | /*! ST25R3911 Wake-Up Period/Timer */ |
DiegoOstuni | 0:98fcd1266df0 | 153 | typedef enum |
DiegoOstuni | 0:98fcd1266df0 | 154 | { |
DiegoOstuni | 0:98fcd1266df0 | 155 | ST25R3911_WUM_AA_WEIGHT_4 = 0x00, /*!< Wake-Up Auto Average Weight 4 */ |
DiegoOstuni | 0:98fcd1266df0 | 156 | ST25R3911_WUM_AA_WEIGHT_8 = 0x01, /*!< Wake-Up Auto Average Weight 8 */ |
DiegoOstuni | 0:98fcd1266df0 | 157 | ST25R3911_WUM_AA_WEIGHT_16 = 0x02, /*!< Wake-Up Auto Average Weight 16 */ |
DiegoOstuni | 0:98fcd1266df0 | 158 | ST25R3911_WUM_AA_WEIGHT_32 = 0x03, /*!< Wake-Up Auto Average Weight 32 */ |
DiegoOstuni | 0:98fcd1266df0 | 159 | } st25r3911WumAAWeight; |
DiegoOstuni | 0:98fcd1266df0 | 160 | |
DiegoOstuni | 0:98fcd1266df0 | 161 | |
DiegoOstuni | 0:98fcd1266df0 | 162 | /*! ST25R3911 Wake-Up Mode configuration */ |
DiegoOstuni | 0:98fcd1266df0 | 163 | typedef struct |
DiegoOstuni | 0:98fcd1266df0 | 164 | { |
DiegoOstuni | 0:98fcd1266df0 | 165 | st25r3911WumPeriod period; /*!< Wake-Up Timer period;how often measurement(s) is performed*/ |
DiegoOstuni | 0:98fcd1266df0 | 166 | bool irqTout; /*!< IRQ at every timeout will refresh the measurement(s) */ |
DiegoOstuni | 0:98fcd1266df0 | 167 | |
DiegoOstuni | 0:98fcd1266df0 | 168 | struct{ |
DiegoOstuni | 0:98fcd1266df0 | 169 | bool enabled; /*!< Inductive Amplitude measurement enabled */ |
DiegoOstuni | 0:98fcd1266df0 | 170 | uint8_t delta; /*!< Delta between the reference and measurement to wake-up */ |
DiegoOstuni | 0:98fcd1266df0 | 171 | uint8_t reference; /*!< Reference to be used; or ST25R3911_WUM_REFRENCE_AUTO */ |
DiegoOstuni | 0:98fcd1266df0 | 172 | bool autoAvg; /*!< Use the HW Auto Averaging feature */ |
DiegoOstuni | 0:98fcd1266df0 | 173 | bool aaInclMeas; /*!< When AutoAvg is enables, include IRQ measurement */ |
DiegoOstuni | 0:98fcd1266df0 | 174 | st25r3911WumAAWeight aaWeight; /*!< When AutoAvg is enables, last measure weight */ |
DiegoOstuni | 0:98fcd1266df0 | 175 | }indAmp; |
DiegoOstuni | 0:98fcd1266df0 | 176 | struct{ |
DiegoOstuni | 0:98fcd1266df0 | 177 | bool enabled; /*!< Inductive Phase measurement enabled */ |
DiegoOstuni | 0:98fcd1266df0 | 178 | uint8_t delta; /*!< Delta between the reference and measurement to wake-up */ |
DiegoOstuni | 0:98fcd1266df0 | 179 | uint8_t reference; /*!< Reference to be used; or ST25R3911_WUM_REFRENCE_AUTO */ |
DiegoOstuni | 0:98fcd1266df0 | 180 | bool autoAvg; /*!< Use the HW Auto Averaging feature */ |
DiegoOstuni | 0:98fcd1266df0 | 181 | bool aaInclMeas; /*!< When AutoAvg is enables, include IRQ measurement */ |
DiegoOstuni | 0:98fcd1266df0 | 182 | st25r3911WumAAWeight aaWeight; /*!< When AutoAvg is enables, last measure weight */ |
DiegoOstuni | 0:98fcd1266df0 | 183 | }indPha; |
DiegoOstuni | 0:98fcd1266df0 | 184 | struct{ |
DiegoOstuni | 0:98fcd1266df0 | 185 | bool enabled; /*!< Capacitive measurement enabled */ |
DiegoOstuni | 0:98fcd1266df0 | 186 | uint8_t delta; /*!< Delta between the reference and measurement to wake-up */ |
DiegoOstuni | 0:98fcd1266df0 | 187 | uint8_t reference; /*!< Reference to be used; or ST25R3911_WUM_REFRENCE_AUTO */ |
DiegoOstuni | 0:98fcd1266df0 | 188 | bool autoAvg; /*!< Use the HW Auto Averaging feature */ |
DiegoOstuni | 0:98fcd1266df0 | 189 | bool aaInclMeas; /*!< When AutoAvg is enables, include IRQ measurement */ |
DiegoOstuni | 0:98fcd1266df0 | 190 | st25r3911WumAAWeight aaWeight; /*!< When AutoAvg is enables, last measure weight */ |
DiegoOstuni | 0:98fcd1266df0 | 191 | }cap; |
DiegoOstuni | 0:98fcd1266df0 | 192 | } st25r3911WakeUpConfig; |
DiegoOstuni | 0:98fcd1266df0 | 193 | |
DiegoOstuni | 0:98fcd1266df0 | 194 | |
DiegoOstuni | 0:98fcd1266df0 | 195 | /* |
DiegoOstuni | 0:98fcd1266df0 | 196 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 197 | * GLOBAL DEFINES |
DiegoOstuni | 0:98fcd1266df0 | 198 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 199 | */ |
DiegoOstuni | 0:98fcd1266df0 | 200 | #define ST25R3911_FDT_NONE 0x00 /*!< Value indicating not to perform FDT */ |
DiegoOstuni | 0:98fcd1266df0 | 201 | |
DiegoOstuni | 0:98fcd1266df0 | 202 | #define MS_TO_64FCS(A) ((A) * 212) /*!< Converts from ms to 64/fc steps */ |
DiegoOstuni | 0:98fcd1266df0 | 203 | #define MS_FROM_64FCS(A) ((A) / 212) /*!< Converts from 64/fc steps to ms */ |
DiegoOstuni | 0:98fcd1266df0 | 204 | |
DiegoOstuni | 0:98fcd1266df0 | 205 | /* ST25R3911 direct commands */ |
DiegoOstuni | 0:98fcd1266df0 | 206 | #define ST25R3911_CMD_SET_DEFAULT 0xC1 /*!< Puts the chip in default state (same as after power-up) */ |
DiegoOstuni | 0:98fcd1266df0 | 207 | #define ST25R3911_CMD_CLEAR_FIFO 0xC2 /*!< Stops all activities and clears FIFO */ |
DiegoOstuni | 0:98fcd1266df0 | 208 | #define ST25R3911_CMD_TRANSMIT_WITH_CRC 0xC4 /*!< Transmit with CRC */ |
DiegoOstuni | 0:98fcd1266df0 | 209 | #define ST25R3911_CMD_TRANSMIT_WITHOUT_CRC 0xC5 /*!< Transmit without CRC */ |
DiegoOstuni | 0:98fcd1266df0 | 210 | #define ST25R3911_CMD_TRANSMIT_REQA 0xC6 /*!< Transmit REQA */ |
DiegoOstuni | 0:98fcd1266df0 | 211 | #define ST25R3911_CMD_TRANSMIT_WUPA 0xC7 /*!< Transmit WUPA */ |
DiegoOstuni | 0:98fcd1266df0 | 212 | #define ST25R3911_CMD_INITIAL_RF_COLLISION 0xC8 /*!< NFC transmit with Initial RF Collision Avoidance */ |
DiegoOstuni | 0:98fcd1266df0 | 213 | #define ST25R3911_CMD_RESPONSE_RF_COLLISION_N 0xC9 /*!< NFC transmit with Response RF Collision Avoidance */ |
DiegoOstuni | 0:98fcd1266df0 | 214 | #define ST25R3911_CMD_RESPONSE_RF_COLLISION_0 0xCA /*!< NFC transmit with Response RF Collision Avoidance with n=0 */ |
DiegoOstuni | 0:98fcd1266df0 | 215 | #define ST25R3911_CMD_NORMAL_NFC_MODE 0xCB /*!< NFC switch to normal NFC mode */ |
DiegoOstuni | 0:98fcd1266df0 | 216 | #define ST25R3911_CMD_ANALOG_PRESET 0xCC /*!< Analog Preset */ |
DiegoOstuni | 0:98fcd1266df0 | 217 | #define ST25R3911_CMD_MASK_RECEIVE_DATA 0xD0 /*!< Mask recive data */ |
DiegoOstuni | 0:98fcd1266df0 | 218 | #define ST25R3911_CMD_UNMASK_RECEIVE_DATA 0xD1 /*!< Unmask recive data */ |
DiegoOstuni | 0:98fcd1266df0 | 219 | #define ST25R3911_CMD_MEASURE_AMPLITUDE 0xD3 /*!< Measure singal amplitude on RFI inputs */ |
DiegoOstuni | 0:98fcd1266df0 | 220 | #define ST25R3911_CMD_SQUELCH 0xD4 /*!< Squelch */ |
DiegoOstuni | 0:98fcd1266df0 | 221 | #define ST25R3911_CMD_CLEAR_SQUELCH 0xD5 /*!< Clear Squelch */ |
DiegoOstuni | 0:98fcd1266df0 | 222 | #define ST25R3911_CMD_ADJUST_REGULATORS 0xD6 /*!< Adjust regulators */ |
DiegoOstuni | 0:98fcd1266df0 | 223 | #define ST25R3911_CMD_CALIBRATE_MODULATION 0xD7 /*!< Calibrate modulation depth */ |
DiegoOstuni | 0:98fcd1266df0 | 224 | #define ST25R3911_CMD_CALIBRATE_ANTENNA 0xD8 /*!< Calibrate antenna */ |
DiegoOstuni | 0:98fcd1266df0 | 225 | #define ST25R3911_CMD_MEASURE_PHASE 0xD9 /*!< Measure phase between RFO and RFI signal */ |
DiegoOstuni | 0:98fcd1266df0 | 226 | #define ST25R3911_CMD_CLEAR_RSSI 0xDA /*!< clear RSSI bits and restart the measurement */ |
DiegoOstuni | 0:98fcd1266df0 | 227 | #define ST25R3911_CMD_TRANSPARENT_MODE 0xDC /*!< Transparent mode */ |
DiegoOstuni | 0:98fcd1266df0 | 228 | #define ST25R3911_CMD_CALIBRATE_C_SENSOR 0xDD /*!< Calibrate the capacitive sensor */ |
DiegoOstuni | 0:98fcd1266df0 | 229 | #define ST25R3911_CMD_MEASURE_CAPACITANCE 0xDE /*!< Measure capacitance */ |
DiegoOstuni | 0:98fcd1266df0 | 230 | #define ST25R3911_CMD_MEASURE_VDD 0xDF /*!< Measure power supply voltage */ |
DiegoOstuni | 0:98fcd1266df0 | 231 | #define ST25R3911_CMD_START_GP_TIMER 0xE0 /*!< Start the general purpose timer */ |
DiegoOstuni | 0:98fcd1266df0 | 232 | #define ST25R3911_CMD_START_WUP_TIMER 0xE1 /*!< Start the wake-up timer */ |
DiegoOstuni | 0:98fcd1266df0 | 233 | #define ST25R3911_CMD_START_MASK_RECEIVE_TIMER 0xE2 /*!< Start the mask-receive timer */ |
DiegoOstuni | 0:98fcd1266df0 | 234 | #define ST25R3911_CMD_START_NO_RESPONSE_TIMER 0xE3 /*!< Start the no-repsonse timer */ |
DiegoOstuni | 0:98fcd1266df0 | 235 | #define ST25R3911_CMD_TEST_CLEARA 0xFA /*!< Clear Test register */ |
DiegoOstuni | 0:98fcd1266df0 | 236 | #define ST25R3911_CMD_TEST_CLEARB 0xFB /*!< Clear Test register */ |
DiegoOstuni | 0:98fcd1266df0 | 237 | #define ST25R3911_CMD_TEST_ACCESS 0xFC /*!< Enable R/W access to the test registers */ |
DiegoOstuni | 0:98fcd1266df0 | 238 | #define ST25R3911_CMD_LOAD_PPROM 0xFD /*!< Load data from the poly fuses to RAM */ |
DiegoOstuni | 0:98fcd1266df0 | 239 | #define ST25R3911_CMD_FUSE_PPROM 0xFE /*!< Fuse poly fuses with data from the RAM */ |
DiegoOstuni | 0:98fcd1266df0 | 240 | |
DiegoOstuni | 0:98fcd1266df0 | 241 | |
DiegoOstuni | 0:98fcd1266df0 | 242 | #define ST25R3911_FIFO_DEPTH 96 /*!< Depth of FIFO */ |
DiegoOstuni | 0:98fcd1266df0 | 243 | |
DiegoOstuni | 0:98fcd1266df0 | 244 | #define ST25R3911_THRESHOLD_DO_NOT_SET 0xFF /*!< Indicates not to change this Threshold */ |
DiegoOstuni | 0:98fcd1266df0 | 245 | |
DiegoOstuni | 0:98fcd1266df0 | 246 | #define ST25R3911_BR_DO_NOT_SET 0xFF /*!< Indicates not to change this Bit Rate */ |
DiegoOstuni | 0:98fcd1266df0 | 247 | #define ST25R3911_BR_106 0x00 /*!< ST25R3911 Bit Rate 106 kbit/s (fc/128) */ |
DiegoOstuni | 0:98fcd1266df0 | 248 | #define ST25R3911_BR_212 0x01 /*!< ST25R3911 Bit Rate 212 kbit/s (fc/64) */ |
DiegoOstuni | 0:98fcd1266df0 | 249 | #define ST25R3911_BR_424 0x02 /*!< ST25R3911 Bit Rate 424 kbit/s (fc/32) */ |
DiegoOstuni | 0:98fcd1266df0 | 250 | #define ST25R3911_BR_848 0x03 /*!< ST25R3911 Bit Rate 848 kbit/s (fc/16) */ |
DiegoOstuni | 0:98fcd1266df0 | 251 | #define ST25R3911_BR_1695 0x04 /*!< ST25R3911 Bit Rate 1696 kbit/s (fc/8) */ |
DiegoOstuni | 0:98fcd1266df0 | 252 | #define ST25R3911_BR_3390 0x05 /*!< ST25R3911 Bit Rate 3390 kbit/s (fc/4) */ |
DiegoOstuni | 0:98fcd1266df0 | 253 | #define ST25R3911_BR_6780 0x06 /*!< ST25R3911 Bit Rate 6780 kbit/s (fc/2) */ |
DiegoOstuni | 0:98fcd1266df0 | 254 | |
DiegoOstuni | 0:98fcd1266df0 | 255 | |
DiegoOstuni | 0:98fcd1266df0 | 256 | #define ST25R3911_WUM_REFRENCE_AUTO 0xFF /*!< Indicates new reference is set by the driver */ |
DiegoOstuni | 0:98fcd1266df0 | 257 | #define ST25R3911_WUM_WAKEMASK_INDAMP 0x01 /*!< Wake-Up mode was woken by Inductive Amplitude */ |
DiegoOstuni | 0:98fcd1266df0 | 258 | #define ST25R3911_WUM_WAKEMASK_INDPHA 0x02 /*!< Wake-Up mode was woken by Inductive Phase */ |
DiegoOstuni | 0:98fcd1266df0 | 259 | #define ST25R3911_WUM_WAKEMASK_CAP 0x04 /*!< Wake-Up mode was woken by Capacitive */ |
DiegoOstuni | 0:98fcd1266df0 | 260 | |
DiegoOstuni | 0:98fcd1266df0 | 261 | /* |
DiegoOstuni | 0:98fcd1266df0 | 262 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 263 | * GLOBAL MACROS |
DiegoOstuni | 0:98fcd1266df0 | 264 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 265 | */ |
DiegoOstuni | 0:98fcd1266df0 | 266 | |
DiegoOstuni | 0:98fcd1266df0 | 267 | /*! Checks if General Purpose Timer is still running by reading gpt_on flag */ |
DiegoOstuni | 0:98fcd1266df0 | 268 | #define st25r3911IsGPTRunning( ) ( st25r3911CheckReg(ST25R3911_REG_REGULATOR_RESULT, ST25R3911_REG_REGULATOR_RESULT_gpt_on, ST25R3911_REG_REGULATOR_RESULT_gpt_on) ) |
DiegoOstuni | 0:98fcd1266df0 | 269 | |
DiegoOstuni | 0:98fcd1266df0 | 270 | /*! Checks if CRC is configured to be in FIFO */ |
DiegoOstuni | 0:98fcd1266df0 | 271 | #define st25r3911IsCRCinFIFO( ) ( st25r3911CheckReg(ST25R3911_REG_AUX, ST25R3911_REG_AUX_crc_2_fifo, ST25R3911_REG_AUX_crc_2_fifo) ) |
DiegoOstuni | 0:98fcd1266df0 | 272 | |
DiegoOstuni | 0:98fcd1266df0 | 273 | /*! Checks if External Filed is detected by reading ST25R3911 External Field |
DiegoOstuni | 0:98fcd1266df0 | 274 | * Detector output */ |
DiegoOstuni | 0:98fcd1266df0 | 275 | #define st25r3911IsExtFieldOn() ( st25r3911CheckReg(ST25R3911_REG_AUX_DISPLAY, ST25R3911_REG_AUX_DISPLAY_efd_o, ST25R3911_REG_AUX_DISPLAY_efd_o ) ) |
DiegoOstuni | 0:98fcd1266df0 | 276 | |
DiegoOstuni | 0:98fcd1266df0 | 277 | /*! Checks if Transmitter is enabled (Field On) */ |
DiegoOstuni | 0:98fcd1266df0 | 278 | #define st25r3911IsTxEnabled() ( st25r3911CheckReg(ST25R3911_REG_OP_CONTROL, ST25R3911_REG_OP_CONTROL_tx_en, ST25R3911_REG_OP_CONTROL_tx_en ) ) |
DiegoOstuni | 0:98fcd1266df0 | 279 | |
DiegoOstuni | 0:98fcd1266df0 | 280 | /*! Turn Off Tx (Field Off) */ |
DiegoOstuni | 0:98fcd1266df0 | 281 | #define st25r3911TxOff() st25r3911ClrRegisterBits(ST25R3911_REG_OP_CONTROL, ST25R3911_REG_OP_CONTROL_tx_en ); |
DiegoOstuni | 0:98fcd1266df0 | 282 | |
DiegoOstuni | 0:98fcd1266df0 | 283 | /*! Checks if last FIFO byte is complete */ |
DiegoOstuni | 0:98fcd1266df0 | 284 | #define st25r3911IsLastFIFOComplete() st25r3911CheckReg( ST25R3911_REG_FIFO_RX_STATUS2, ST25R3911_REG_FIFO_RX_STATUS2_mask_fifo_lb, 0 ) |
DiegoOstuni | 0:98fcd1266df0 | 285 | |
DiegoOstuni | 0:98fcd1266df0 | 286 | /*! Checks if the Oscillator is enabled */ |
DiegoOstuni | 0:98fcd1266df0 | 287 | #define st25r3911IsOscOn() st25r3911CheckReg( ST25R3911_REG_OP_CONTROL, ST25R3911_REG_OP_CONTROL_en, ST25R3911_REG_OP_CONTROL_en ) |
DiegoOstuni | 0:98fcd1266df0 | 288 | |
DiegoOstuni | 0:98fcd1266df0 | 289 | /* |
DiegoOstuni | 0:98fcd1266df0 | 290 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 291 | * GLOBAL FUNCTION PROTOTYPES |
DiegoOstuni | 0:98fcd1266df0 | 292 | ****************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 293 | */ |
DiegoOstuni | 0:98fcd1266df0 | 294 | |
DiegoOstuni | 0:98fcd1266df0 | 295 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 296 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 297 | * \brief Turn on Oscillator and Regulator |
DiegoOstuni | 0:98fcd1266df0 | 298 | * |
DiegoOstuni | 0:98fcd1266df0 | 299 | * This function turn on oscillator and regulator and wait for the oscillator to |
DiegoOstuni | 0:98fcd1266df0 | 300 | * become stable. |
DiegoOstuni | 0:98fcd1266df0 | 301 | * |
DiegoOstuni | 0:98fcd1266df0 | 302 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 303 | */ |
DiegoOstuni | 0:98fcd1266df0 | 304 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 305 | |
DiegoOstuni | 0:98fcd1266df0 | 306 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 307 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 308 | * \brief Turn On Tx and Rx |
DiegoOstuni | 0:98fcd1266df0 | 309 | * |
DiegoOstuni | 0:98fcd1266df0 | 310 | * This function turns On Tx and Rx (Field On) |
DiegoOstuni | 0:98fcd1266df0 | 311 | * |
DiegoOstuni | 0:98fcd1266df0 | 312 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 313 | */ |
DiegoOstuni | 0:98fcd1266df0 | 314 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 315 | |
DiegoOstuni | 0:98fcd1266df0 | 316 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 317 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 318 | * \brief Turn Off Tx and Rx |
DiegoOstuni | 0:98fcd1266df0 | 319 | * |
DiegoOstuni | 0:98fcd1266df0 | 320 | * This function turns Off Tx and Rx (Field Off) |
DiegoOstuni | 0:98fcd1266df0 | 321 | * |
DiegoOstuni | 0:98fcd1266df0 | 322 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 323 | */ |
DiegoOstuni | 0:98fcd1266df0 | 324 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 325 | |
DiegoOstuni | 0:98fcd1266df0 | 326 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 327 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 328 | * \brief Initialise ST25R3911 driver |
DiegoOstuni | 0:98fcd1266df0 | 329 | * |
DiegoOstuni | 0:98fcd1266df0 | 330 | * This function initialises the ST25R3911 driver. |
DiegoOstuni | 0:98fcd1266df0 | 331 | * |
DiegoOstuni | 0:98fcd1266df0 | 332 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 333 | */ |
DiegoOstuni | 0:98fcd1266df0 | 334 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 335 | |
DiegoOstuni | 0:98fcd1266df0 | 336 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 337 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 338 | * \brief Deinitialize ST25R3911 driver |
DiegoOstuni | 0:98fcd1266df0 | 339 | * |
DiegoOstuni | 0:98fcd1266df0 | 340 | * Calling this function deinitializes the ST25R3911 driver. |
DiegoOstuni | 0:98fcd1266df0 | 341 | * |
DiegoOstuni | 0:98fcd1266df0 | 342 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 343 | */ |
DiegoOstuni | 0:98fcd1266df0 | 344 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 345 | |
DiegoOstuni | 0:98fcd1266df0 | 346 | |
DiegoOstuni | 0:98fcd1266df0 | 347 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 348 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 349 | * \brief Sets the bitrate registers |
DiegoOstuni | 0:98fcd1266df0 | 350 | * |
DiegoOstuni | 0:98fcd1266df0 | 351 | * This function sets the bitrate register for rx and tx |
DiegoOstuni | 0:98fcd1266df0 | 352 | * |
DiegoOstuni | 0:98fcd1266df0 | 353 | * \param txRate : speed is 2^txrate * 106 kb/s |
DiegoOstuni | 0:98fcd1266df0 | 354 | * 0xff : don't set txrate |
DiegoOstuni | 0:98fcd1266df0 | 355 | * \param rxRate : speed is 2^rxrate * 106 kb/s |
DiegoOstuni | 0:98fcd1266df0 | 356 | * 0xff : don't set rxrate |
DiegoOstuni | 0:98fcd1266df0 | 357 | * |
DiegoOstuni | 0:98fcd1266df0 | 358 | * \return ERR_NONE : No error, both bit rates were set |
DiegoOstuni | 0:98fcd1266df0 | 359 | * \return ERR_PARAM: At least one bit rate was invalid |
DiegoOstuni | 0:98fcd1266df0 | 360 | * |
DiegoOstuni | 0:98fcd1266df0 | 361 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 362 | */ |
DiegoOstuni | 0:98fcd1266df0 | 363 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 364 | |
DiegoOstuni | 0:98fcd1266df0 | 365 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 366 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 367 | * \brief Adjusts supply regulators according to the current supply voltage |
DiegoOstuni | 0:98fcd1266df0 | 368 | * |
DiegoOstuni | 0:98fcd1266df0 | 369 | * This function the power level is measured in maximum load conditions and |
DiegoOstuni | 0:98fcd1266df0 | 370 | * the regulated voltage reference is set to 250mV below this level. |
DiegoOstuni | 0:98fcd1266df0 | 371 | * Execution of this function lasts arround 5ms. |
DiegoOstuni | 0:98fcd1266df0 | 372 | * |
DiegoOstuni | 0:98fcd1266df0 | 373 | * \param [out] result_mV : Result of calibration in milliVolts. |
DiegoOstuni | 0:98fcd1266df0 | 374 | * |
DiegoOstuni | 0:98fcd1266df0 | 375 | * \return ERR_REQUEST : Adjustment not possible since reg_s bit is set. |
DiegoOstuni | 0:98fcd1266df0 | 376 | * \return ERR_IO : Error during communication with ST25R3911. |
DiegoOstuni | 0:98fcd1266df0 | 377 | * \return ERR_NONE : No error. |
DiegoOstuni | 0:98fcd1266df0 | 378 | * |
DiegoOstuni | 0:98fcd1266df0 | 379 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 380 | */ |
DiegoOstuni | 0:98fcd1266df0 | 381 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 382 | |
DiegoOstuni | 0:98fcd1266df0 | 383 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 384 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 385 | * \brief Measure RF |
DiegoOstuni | 0:98fcd1266df0 | 386 | * |
DiegoOstuni | 0:98fcd1266df0 | 387 | * This function measured the amplitude on the RFI inputs and stores the |
DiegoOstuni | 0:98fcd1266df0 | 388 | * result in parameter \a result. |
DiegoOstuni | 0:98fcd1266df0 | 389 | * |
DiegoOstuni | 0:98fcd1266df0 | 390 | * \param[out] result: 8 bit long result of RF measurement. |
DiegoOstuni | 0:98fcd1266df0 | 391 | * |
DiegoOstuni | 0:98fcd1266df0 | 392 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 393 | */ |
DiegoOstuni | 0:98fcd1266df0 | 394 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 395 | |
DiegoOstuni | 0:98fcd1266df0 | 396 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 397 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 398 | * \brief Measure Capacitance |
DiegoOstuni | 0:98fcd1266df0 | 399 | * |
DiegoOstuni | 0:98fcd1266df0 | 400 | * This function performs the capacitance measurement and stores the |
DiegoOstuni | 0:98fcd1266df0 | 401 | * result in parameter \a result. |
DiegoOstuni | 0:98fcd1266df0 | 402 | * |
DiegoOstuni | 0:98fcd1266df0 | 403 | * \param[out] result: 8 bit long result of RF measurement. |
DiegoOstuni | 0:98fcd1266df0 | 404 | * |
DiegoOstuni | 0:98fcd1266df0 | 405 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 406 | */ |
DiegoOstuni | 0:98fcd1266df0 | 407 | extern void st25r3911MeasureCapacitance(uint8_t* result, SPI *mspiChannel, DigitalOut * gpio_cs); |
DiegoOstuni | 0:98fcd1266df0 | 408 | |
DiegoOstuni | 0:98fcd1266df0 | 409 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 410 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 411 | * \brief Measure Voltage |
DiegoOstuni | 0:98fcd1266df0 | 412 | * |
DiegoOstuni | 0:98fcd1266df0 | 413 | * This function measures the voltage on one of VDD and VSP_* |
DiegoOstuni | 0:98fcd1266df0 | 414 | * result in parameter \a result. |
DiegoOstuni | 0:98fcd1266df0 | 415 | * |
DiegoOstuni | 0:98fcd1266df0 | 416 | * \param[in] mpsv : one of ST25R3911_REG_REGULATOR_CONTROL_mpsv_vdd |
DiegoOstuni | 0:98fcd1266df0 | 417 | * ST25R3911_REG_REGULATOR_CONTROL_mpsv_vsp_rf |
DiegoOstuni | 0:98fcd1266df0 | 418 | * ST25R3911_REG_REGULATOR_CONTROL_mpsv_vsp_a |
DiegoOstuni | 0:98fcd1266df0 | 419 | * or ST25R3911_REG_REGULATOR_CONTROL_mpsv_vsp_d |
DiegoOstuni | 0:98fcd1266df0 | 420 | * |
DiegoOstuni | 0:98fcd1266df0 | 421 | * \return the measured voltage in mV |
DiegoOstuni | 0:98fcd1266df0 | 422 | * |
DiegoOstuni | 0:98fcd1266df0 | 423 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 424 | */ |
DiegoOstuni | 0:98fcd1266df0 | 425 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 426 | |
DiegoOstuni | 0:98fcd1266df0 | 427 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 428 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 429 | * \brief Calibrate antenna |
DiegoOstuni | 0:98fcd1266df0 | 430 | * |
DiegoOstuni | 0:98fcd1266df0 | 431 | * This function is used to calibrate the antenna using a special sequence. |
DiegoOstuni | 0:98fcd1266df0 | 432 | * The result is stored in the \a result parameter. |
DiegoOstuni | 0:98fcd1266df0 | 433 | * |
DiegoOstuni | 0:98fcd1266df0 | 434 | * \param[out] result: 8 bit long result of antenna calibration algorithm. |
DiegoOstuni | 0:98fcd1266df0 | 435 | * |
DiegoOstuni | 0:98fcd1266df0 | 436 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 437 | */ |
DiegoOstuni | 0:98fcd1266df0 | 438 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 439 | |
DiegoOstuni | 0:98fcd1266df0 | 440 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 441 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 442 | * \brief Check antenna resonance |
DiegoOstuni | 0:98fcd1266df0 | 443 | * |
DiegoOstuni | 0:98fcd1266df0 | 444 | * This function is used to measure the antenna LC tank resconance to determine |
DiegoOstuni | 0:98fcd1266df0 | 445 | * whether a calibration is needed. |
DiegoOstuni | 0:98fcd1266df0 | 446 | * The result is stored in the \a result parameter. |
DiegoOstuni | 0:98fcd1266df0 | 447 | * |
DiegoOstuni | 0:98fcd1266df0 | 448 | * \param[out] result: 8 bit long result of the measurement. |
DiegoOstuni | 0:98fcd1266df0 | 449 | * |
DiegoOstuni | 0:98fcd1266df0 | 450 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 451 | */ |
DiegoOstuni | 0:98fcd1266df0 | 452 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 453 | |
DiegoOstuni | 0:98fcd1266df0 | 454 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 455 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 456 | * \brief Calibrate modulation depth |
DiegoOstuni | 0:98fcd1266df0 | 457 | * |
DiegoOstuni | 0:98fcd1266df0 | 458 | * This function is used to calibrate the modulation depth using a special sequence. |
DiegoOstuni | 0:98fcd1266df0 | 459 | * The result is stored in the \a result parameter. |
DiegoOstuni | 0:98fcd1266df0 | 460 | * |
DiegoOstuni | 0:98fcd1266df0 | 461 | * \param[out] result: 8 bit long result of antenna calibration algorithm. |
DiegoOstuni | 0:98fcd1266df0 | 462 | * |
DiegoOstuni | 0:98fcd1266df0 | 463 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 464 | */ |
DiegoOstuni | 0:98fcd1266df0 | 465 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 466 | |
DiegoOstuni | 0:98fcd1266df0 | 467 | |
DiegoOstuni | 0:98fcd1266df0 | 468 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 469 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 470 | * \brief Calibrate Capacitive Sensor |
DiegoOstuni | 0:98fcd1266df0 | 471 | * |
DiegoOstuni | 0:98fcd1266df0 | 472 | * This function is used to calibrates the Capacitive Sensor. |
DiegoOstuni | 0:98fcd1266df0 | 473 | * The result is stored in the \a result parameter. |
DiegoOstuni | 0:98fcd1266df0 | 474 | * |
DiegoOstuni | 0:98fcd1266df0 | 475 | * \param[out] result: 8 bit long result of antenna calibration algorithm. |
DiegoOstuni | 0:98fcd1266df0 | 476 | * |
DiegoOstuni | 0:98fcd1266df0 | 477 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 478 | */ |
DiegoOstuni | 0:98fcd1266df0 | 479 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 480 | |
DiegoOstuni | 0:98fcd1266df0 | 481 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 482 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 483 | * \brief set no response time |
DiegoOstuni | 0:98fcd1266df0 | 484 | * |
DiegoOstuni | 0:98fcd1266df0 | 485 | * This function executes sets the no response time to the defines value |
DiegoOstuni | 0:98fcd1266df0 | 486 | * |
DiegoOstuni | 0:98fcd1266df0 | 487 | * \param nrt_64fcs : no response time in 64/fc = 4.72us |
DiegoOstuni | 0:98fcd1266df0 | 488 | * completion interrupt |
DiegoOstuni | 0:98fcd1266df0 | 489 | * |
DiegoOstuni | 0:98fcd1266df0 | 490 | * \return ERR_PARAM : if time is too large |
DiegoOstuni | 0:98fcd1266df0 | 491 | */ |
DiegoOstuni | 0:98fcd1266df0 | 492 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 493 | |
DiegoOstuni | 0:98fcd1266df0 | 494 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 495 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 496 | * \brief set no response time |
DiegoOstuni | 0:98fcd1266df0 | 497 | * |
DiegoOstuni | 0:98fcd1266df0 | 498 | * This function executes sets and immediately start the no response timer |
DiegoOstuni | 0:98fcd1266df0 | 499 | * to the defines value |
DiegoOstuni | 0:98fcd1266df0 | 500 | * This is used when needs to add more time before timeout whitout Tx |
DiegoOstuni | 0:98fcd1266df0 | 501 | * |
DiegoOstuni | 0:98fcd1266df0 | 502 | * \param nrt_64fcs : no response time in 64/fc = 4.72us |
DiegoOstuni | 0:98fcd1266df0 | 503 | * completion interrupt |
DiegoOstuni | 0:98fcd1266df0 | 504 | * |
DiegoOstuni | 0:98fcd1266df0 | 505 | * \return ERR_PARAM : if time is too large |
DiegoOstuni | 0:98fcd1266df0 | 506 | */ |
DiegoOstuni | 0:98fcd1266df0 | 507 | extern ReturnCode st25r3911SetStartNoResponseTime_64fcs(uint32_t nrt_64fcs, DigitalOut * gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_06); |
DiegoOstuni | 0:98fcd1266df0 | 508 | |
DiegoOstuni | 0:98fcd1266df0 | 509 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 510 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 511 | * \brief Perform Collision Avoidance |
DiegoOstuni | 0:98fcd1266df0 | 512 | * |
DiegoOstuni | 0:98fcd1266df0 | 513 | * Performs Collision Avoidance with the given threshold and with the |
DiegoOstuni | 0:98fcd1266df0 | 514 | * n number of TRFW |
DiegoOstuni | 0:98fcd1266df0 | 515 | * |
DiegoOstuni | 0:98fcd1266df0 | 516 | * \param[in] FieldONCmd : Field ON command to be executed ST25R3911_CMD_INITIAL_RF_COLLISION |
DiegoOstuni | 0:98fcd1266df0 | 517 | * or ST25R3911_CMD_RESPONSE_RF_COLLISION_0/N |
DiegoOstuni | 0:98fcd1266df0 | 518 | * \param[in] pdThreshold : Peer Detection Threshold (ST25R3916_REG_FIELD_THRESHOLD_trg_xx) |
DiegoOstuni | 0:98fcd1266df0 | 519 | * 0xff : don't set Threshold (ST25R3916_THRESHOLD_DO_NOT_SET) |
DiegoOstuni | 0:98fcd1266df0 | 520 | * \param[in] caThreshold : Collision Avoidance Threshold (ST25R3916_REG_FIELD_THRESHOLD_rfe_xx) |
DiegoOstuni | 0:98fcd1266df0 | 521 | * 0xff : don't set Threshold (ST25R3916_THRESHOLD_DO_NOT_SET) |
DiegoOstuni | 0:98fcd1266df0 | 522 | * \param[in] nTRFW : Number of TRFW |
DiegoOstuni | 0:98fcd1266df0 | 523 | * |
DiegoOstuni | 0:98fcd1266df0 | 524 | * \return ERR_NONE : no collision detected |
DiegoOstuni | 0:98fcd1266df0 | 525 | * \return ERR_RF_COLLISION : collision detected |
DiegoOstuni | 0:98fcd1266df0 | 526 | */ |
DiegoOstuni | 0:98fcd1266df0 | 527 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 528 | |
DiegoOstuni | 0:98fcd1266df0 | 529 | |
DiegoOstuni | 0:98fcd1266df0 | 530 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 531 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 532 | * \brief Get amount of bits of the last FIFO byte if incomplete |
DiegoOstuni | 0:98fcd1266df0 | 533 | * |
DiegoOstuni | 0:98fcd1266df0 | 534 | * Gets the number of bits of the last FIFO byte if incomplete |
DiegoOstuni | 0:98fcd1266df0 | 535 | * |
DiegoOstuni | 0:98fcd1266df0 | 536 | * \return the number of bits of the last FIFO byte if incomplete, 0 if |
DiegoOstuni | 0:98fcd1266df0 | 537 | * the last byte is complete |
DiegoOstuni | 0:98fcd1266df0 | 538 | * |
DiegoOstuni | 0:98fcd1266df0 | 539 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 540 | */ |
DiegoOstuni | 0:98fcd1266df0 | 541 | extern uint8_t st25r3911GetNumFIFOLastBits( void ); |
DiegoOstuni | 0:98fcd1266df0 | 542 | |
DiegoOstuni | 0:98fcd1266df0 | 543 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 544 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 545 | * \brief Get NRT time |
DiegoOstuni | 0:98fcd1266df0 | 546 | * |
DiegoOstuni | 0:98fcd1266df0 | 547 | * This returns the last value set on the NRT |
DiegoOstuni | 0:98fcd1266df0 | 548 | * |
DiegoOstuni | 0:98fcd1266df0 | 549 | * \warning it does not reads chip register, just the sw var that contains the |
DiegoOstuni | 0:98fcd1266df0 | 550 | * last value set before |
DiegoOstuni | 0:98fcd1266df0 | 551 | * |
DiegoOstuni | 0:98fcd1266df0 | 552 | * \return the value of the NRT |
DiegoOstuni | 0:98fcd1266df0 | 553 | */ |
DiegoOstuni | 0:98fcd1266df0 | 554 | extern uint32_t st25r3911GetNoResponseTime_64fcs(void); |
DiegoOstuni | 0:98fcd1266df0 | 555 | |
DiegoOstuni | 0:98fcd1266df0 | 556 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 557 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 558 | * \brief set general purpose timer timeout |
DiegoOstuni | 0:98fcd1266df0 | 559 | * |
DiegoOstuni | 0:98fcd1266df0 | 560 | * This function sets the proper registers but does not start the timer actually |
DiegoOstuni | 0:98fcd1266df0 | 561 | * |
DiegoOstuni | 0:98fcd1266df0 | 562 | * \param gpt_8fcs : general purpose timer timeout in 8/fc = 590ns |
DiegoOstuni | 0:98fcd1266df0 | 563 | * |
DiegoOstuni | 0:98fcd1266df0 | 564 | */ |
DiegoOstuni | 0:98fcd1266df0 | 565 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 566 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 567 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 568 | * \brief Starts GPT with given timeout |
DiegoOstuni | 0:98fcd1266df0 | 569 | * |
DiegoOstuni | 0:98fcd1266df0 | 570 | * This function starts the general purpose timer with the given timeout |
DiegoOstuni | 0:98fcd1266df0 | 571 | * |
DiegoOstuni | 0:98fcd1266df0 | 572 | * \param gpt_8fcs : general purpose timer timeout in 8/fc = 590ns |
DiegoOstuni | 0:98fcd1266df0 | 573 | * \param trigger_source : no trigger, start of Rx, end of Rx, end of Tx in NFC mode |
DiegoOstuni | 0:98fcd1266df0 | 574 | */ |
DiegoOstuni | 0:98fcd1266df0 | 575 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 576 | |
DiegoOstuni | 0:98fcd1266df0 | 577 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 578 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 579 | * \brief Checks if register contains a expected value |
DiegoOstuni | 0:98fcd1266df0 | 580 | * |
DiegoOstuni | 0:98fcd1266df0 | 581 | * This function checks if the given reg contains a value that once masked |
DiegoOstuni | 0:98fcd1266df0 | 582 | * equals the expected value |
DiegoOstuni | 0:98fcd1266df0 | 583 | * |
DiegoOstuni | 0:98fcd1266df0 | 584 | * \param reg : the register to check the value |
DiegoOstuni | 0:98fcd1266df0 | 585 | * \param mask : the mask apply on register value |
DiegoOstuni | 0:98fcd1266df0 | 586 | * \param val : expected value to be compared to |
DiegoOstuni | 0:98fcd1266df0 | 587 | * |
DiegoOstuni | 0:98fcd1266df0 | 588 | * \return true when reg contains the expected value | false otherwise |
DiegoOstuni | 0:98fcd1266df0 | 589 | */ |
DiegoOstuni | 0:98fcd1266df0 | 590 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 591 | |
DiegoOstuni | 0:98fcd1266df0 | 592 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 593 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 594 | * \brief Sets the number Tx Bits |
DiegoOstuni | 0:98fcd1266df0 | 595 | * |
DiegoOstuni | 0:98fcd1266df0 | 596 | * Sets ST25R3911 internal registers with correct number of complete bytes and |
DiegoOstuni | 0:98fcd1266df0 | 597 | * bits to be sent |
DiegoOstuni | 0:98fcd1266df0 | 598 | * |
DiegoOstuni | 0:98fcd1266df0 | 599 | * \param nBits : the number bits to be transmitted |
DiegoOstuni | 0:98fcd1266df0 | 600 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 601 | */ |
DiegoOstuni | 0:98fcd1266df0 | 602 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 603 | |
DiegoOstuni | 0:98fcd1266df0 | 604 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 605 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 606 | * \brief Check Identity |
DiegoOstuni | 0:98fcd1266df0 | 607 | * |
DiegoOstuni | 0:98fcd1266df0 | 608 | * Checks if the chip ID is as expected. |
DiegoOstuni | 0:98fcd1266df0 | 609 | * |
DiegoOstuni | 0:98fcd1266df0 | 610 | * 5 bit IC type code for ST25R3911: 00001 |
DiegoOstuni | 0:98fcd1266df0 | 611 | * The 3 lsb contain the IC revision code |
DiegoOstuni | 0:98fcd1266df0 | 612 | * |
DiegoOstuni | 0:98fcd1266df0 | 613 | * |
DiegoOstuni | 0:98fcd1266df0 | 614 | * \param[out] rev : the IC revision code |
DiegoOstuni | 0:98fcd1266df0 | 615 | * |
DiegoOstuni | 0:98fcd1266df0 | 616 | * \return true when IC type is as expected |
DiegoOstuni | 0:98fcd1266df0 | 617 | * |
DiegoOstuni | 0:98fcd1266df0 | 618 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 619 | */ |
DiegoOstuni | 0:98fcd1266df0 | 620 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 621 | |
DiegoOstuni | 0:98fcd1266df0 | 622 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 623 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 624 | * \brief Check if command is valid |
DiegoOstuni | 0:98fcd1266df0 | 625 | * |
DiegoOstuni | 0:98fcd1266df0 | 626 | * Checks if the given command is a valid ST25R3911 command |
DiegoOstuni | 0:98fcd1266df0 | 627 | * |
DiegoOstuni | 0:98fcd1266df0 | 628 | * \param[in] cmd: Command to check |
DiegoOstuni | 0:98fcd1266df0 | 629 | * |
DiegoOstuni | 0:98fcd1266df0 | 630 | * \return true if is a valid command |
DiegoOstuni | 0:98fcd1266df0 | 631 | * \return false otherwise |
DiegoOstuni | 0:98fcd1266df0 | 632 | * |
DiegoOstuni | 0:98fcd1266df0 | 633 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 634 | */ |
DiegoOstuni | 0:98fcd1266df0 | 635 | bool st25r3911IsCmdValid( uint8_t cmd ); |
DiegoOstuni | 0:98fcd1266df0 | 636 | |
DiegoOstuni | 0:98fcd1266df0 | 637 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 638 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 639 | * \brief Configure the stream mode of ST25R3911 |
DiegoOstuni | 0:98fcd1266df0 | 640 | * |
DiegoOstuni | 0:98fcd1266df0 | 641 | * This function initializes the stream with the given parameters |
DiegoOstuni | 0:98fcd1266df0 | 642 | * |
DiegoOstuni | 0:98fcd1266df0 | 643 | * \param[in] config : all settings for bitrates, type, etc. |
DiegoOstuni | 0:98fcd1266df0 | 644 | |
DiegoOstuni | 0:98fcd1266df0 | 645 | * \return ERR_NONE : No error, stream mode driver initialized. |
DiegoOstuni | 0:98fcd1266df0 | 646 | * |
DiegoOstuni | 0:98fcd1266df0 | 647 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 648 | */ |
DiegoOstuni | 0:98fcd1266df0 | 649 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 650 | |
DiegoOstuni | 0:98fcd1266df0 | 651 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 652 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 653 | * \brief Retrieves all internal registers from st25r3911 |
DiegoOstuni | 0:98fcd1266df0 | 654 | */ |
DiegoOstuni | 0:98fcd1266df0 | 655 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 656 | |
DiegoOstuni | 0:98fcd1266df0 | 657 | |
DiegoOstuni | 0:98fcd1266df0 | 658 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 659 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 660 | * \brief Cheks if a Wakeup IRQ due to Capacitive measument has happen |
DiegoOstuni | 0:98fcd1266df0 | 661 | */ |
DiegoOstuni | 0:98fcd1266df0 | 662 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 663 | |
DiegoOstuni | 0:98fcd1266df0 | 664 | |
DiegoOstuni | 0:98fcd1266df0 | 665 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 666 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 667 | * \brief Cheks if a Wakeup IRQ due to Phase measument has happen |
DiegoOstuni | 0:98fcd1266df0 | 668 | */ |
DiegoOstuni | 0:98fcd1266df0 | 669 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 670 | |
DiegoOstuni | 0:98fcd1266df0 | 671 | |
DiegoOstuni | 0:98fcd1266df0 | 672 | /*! |
DiegoOstuni | 0:98fcd1266df0 | 673 | ***************************************************************************** |
DiegoOstuni | 0:98fcd1266df0 | 674 | * \brief Cheks if a Wakeup IRQ due to Amplitude measument has happen |
DiegoOstuni | 0:98fcd1266df0 | 675 | */ |
DiegoOstuni | 0:98fcd1266df0 | 676 | 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 ); |
DiegoOstuni | 0:98fcd1266df0 | 677 | |
DiegoOstuni | 0:98fcd1266df0 | 678 | #endif /* ST25R3911_H */ |
DiegoOstuni | 0:98fcd1266df0 | 679 | |
DiegoOstuni | 0:98fcd1266df0 | 680 | /** |
DiegoOstuni | 0:98fcd1266df0 | 681 | * @} |
DiegoOstuni | 0:98fcd1266df0 | 682 | * |
DiegoOstuni | 0:98fcd1266df0 | 683 | * @} |
DiegoOstuni | 0:98fcd1266df0 | 684 | * |
DiegoOstuni | 0:98fcd1266df0 | 685 | * @} |
DiegoOstuni | 0:98fcd1266df0 | 686 | * |
DiegoOstuni | 0:98fcd1266df0 | 687 | * @} |
DiegoOstuni | 0:98fcd1266df0 | 688 | */ |
DiegoOstuni | 0:98fcd1266df0 | 689 |