Fork of the GitHub
rfal_AnalogConfig.h@0:75fc82583a41, 2019-11-14 (annotated)
- Committer:
- DiegoOstuni
- Date:
- Thu Nov 14 14:34:50 2019 +0000
- Revision:
- 0:75fc82583a41
Add files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DiegoOstuni | 0:75fc82583a41 | 1 | /****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 2 | * @attention |
DiegoOstuni | 0:75fc82583a41 | 3 | * |
DiegoOstuni | 0:75fc82583a41 | 4 | * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2> |
DiegoOstuni | 0:75fc82583a41 | 5 | * |
DiegoOstuni | 0:75fc82583a41 | 6 | * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License"); |
DiegoOstuni | 0:75fc82583a41 | 7 | * You may not use this file except in compliance with the License. |
DiegoOstuni | 0:75fc82583a41 | 8 | * You may obtain a copy of the License at: |
DiegoOstuni | 0:75fc82583a41 | 9 | * |
DiegoOstuni | 0:75fc82583a41 | 10 | * http://www.st.com/myliberty |
DiegoOstuni | 0:75fc82583a41 | 11 | * |
DiegoOstuni | 0:75fc82583a41 | 12 | * Unless required by applicable law or agreed to in writing, software |
DiegoOstuni | 0:75fc82583a41 | 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
DiegoOstuni | 0:75fc82583a41 | 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, |
DiegoOstuni | 0:75fc82583a41 | 15 | * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY, |
DiegoOstuni | 0:75fc82583a41 | 16 | * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
DiegoOstuni | 0:75fc82583a41 | 17 | * See the License for the specific language governing permissions and |
DiegoOstuni | 0:75fc82583a41 | 18 | * limitations under the License. |
DiegoOstuni | 0:75fc82583a41 | 19 | * |
DiegoOstuni | 0:75fc82583a41 | 20 | ******************************************************************************/ |
DiegoOstuni | 0:75fc82583a41 | 21 | |
DiegoOstuni | 0:75fc82583a41 | 22 | /* |
DiegoOstuni | 0:75fc82583a41 | 23 | * PROJECT: ST25R391x firmware |
DiegoOstuni | 0:75fc82583a41 | 24 | * $Revision: $ |
DiegoOstuni | 0:75fc82583a41 | 25 | * LANGUAGE: ISO C99 |
DiegoOstuni | 0:75fc82583a41 | 26 | */ |
DiegoOstuni | 0:75fc82583a41 | 27 | |
DiegoOstuni | 0:75fc82583a41 | 28 | /*! \file rfal_AnalogConfig.h |
DiegoOstuni | 0:75fc82583a41 | 29 | * |
DiegoOstuni | 0:75fc82583a41 | 30 | * \author bkam |
DiegoOstuni | 0:75fc82583a41 | 31 | * |
DiegoOstuni | 0:75fc82583a41 | 32 | * \brief RF Chip Analog Configuration Settings |
DiegoOstuni | 0:75fc82583a41 | 33 | * |
DiegoOstuni | 0:75fc82583a41 | 34 | * |
DiegoOstuni | 0:75fc82583a41 | 35 | * @addtogroup RFAL |
DiegoOstuni | 0:75fc82583a41 | 36 | * @{ |
DiegoOstuni | 0:75fc82583a41 | 37 | * |
DiegoOstuni | 0:75fc82583a41 | 38 | * @addtogroup RFAL-HAL |
DiegoOstuni | 0:75fc82583a41 | 39 | * @brief RFAL Hardware Abstraction Layer |
DiegoOstuni | 0:75fc82583a41 | 40 | * @{ |
DiegoOstuni | 0:75fc82583a41 | 41 | * |
DiegoOstuni | 0:75fc82583a41 | 42 | * @addtogroup AnalogConfig |
DiegoOstuni | 0:75fc82583a41 | 43 | * @brief RFAL Analog Config Module |
DiegoOstuni | 0:75fc82583a41 | 44 | * @{ |
DiegoOstuni | 0:75fc82583a41 | 45 | * |
DiegoOstuni | 0:75fc82583a41 | 46 | */ |
DiegoOstuni | 0:75fc82583a41 | 47 | |
DiegoOstuni | 0:75fc82583a41 | 48 | #ifndef RFAL_ANALOG_CONFIG_H |
DiegoOstuni | 0:75fc82583a41 | 49 | #define RFAL_ANALOG_CONFIG_H |
DiegoOstuni | 0:75fc82583a41 | 50 | |
DiegoOstuni | 0:75fc82583a41 | 51 | /* |
DiegoOstuni | 0:75fc82583a41 | 52 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 53 | * INCLUDES |
DiegoOstuni | 0:75fc82583a41 | 54 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 55 | */ |
DiegoOstuni | 0:75fc82583a41 | 56 | #include "platform1.h" |
DiegoOstuni | 0:75fc82583a41 | 57 | #include "st_errno.h" |
DiegoOstuni | 0:75fc82583a41 | 58 | #include "ST25R3911.h" |
DiegoOstuni | 0:75fc82583a41 | 59 | |
DiegoOstuni | 0:75fc82583a41 | 60 | /* |
DiegoOstuni | 0:75fc82583a41 | 61 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 62 | * DEFINES |
DiegoOstuni | 0:75fc82583a41 | 63 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 64 | */ |
DiegoOstuni | 0:75fc82583a41 | 65 | |
DiegoOstuni | 0:75fc82583a41 | 66 | #define RFAL_ANALOG_CONFIG_LUT_SIZE (87) /*!< Maximum number of Configuration IDs in the Loop Up Table */ |
DiegoOstuni | 0:75fc82583a41 | 67 | #define RFAL_ANALOG_CONFIG_LUT_NOT_FOUND (0xFF) /*!< Index value indicating no Configuration IDs found */ |
DiegoOstuni | 0:75fc82583a41 | 68 | |
DiegoOstuni | 0:75fc82583a41 | 69 | #define RFAL_ANALOG_CONFIG_TBL_SIZE (1024) /*!< Maximum number of Register-Mask-Value in the Setting List */ |
DiegoOstuni | 0:75fc82583a41 | 70 | |
DiegoOstuni | 0:75fc82583a41 | 71 | |
DiegoOstuni | 0:75fc82583a41 | 72 | #define RFAL_ANALOG_CONFIG_POLL_LISTEN_MODE_MASK (0x8000) /*!< Mask bit of Poll Mode in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 73 | #define RFAL_ANALOG_CONFIG_TECH_MASK (0x7F00) /*!< Mask bits for Technology in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 74 | #define RFAL_ANALOG_CONFIG_BITRATE_MASK (0x00F0) /*!< Mask bits for Bit rate in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 75 | #define RFAL_ANALOG_CONFIG_DIRECTION_MASK (0x0003) /*!< Mask bits for Direction in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 76 | |
DiegoOstuni | 0:75fc82583a41 | 77 | #define RFAL_ANALOG_CONFIG_POLL_LISTEN_MODE_SHIFT (15) /*!< Shift value of Poll Mode in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 78 | #define RFAL_ANALOG_CONFIG_TECH_SHIFT (8) /*!< Shift value for Technology in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 79 | #define RFAL_ANALOG_CONFIG_BITRATE_SHIFT (4) /*!< Shift value for Technology in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 80 | #define RFAL_ANALOG_CONFIG_DIRECTION_SHIFT (0) /*!< Shift value for Direction in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 81 | |
DiegoOstuni | 0:75fc82583a41 | 82 | #define RFAL_ANALOG_CONFIG_POLL (0x0000) /*!< Poll Mode bit setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 83 | #define RFAL_ANALOG_CONFIG_LISTEN (0x8000) /*!< Listen Mode bit setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 84 | |
DiegoOstuni | 0:75fc82583a41 | 85 | #define RFAL_ANALOG_CONFIG_TECH_CHIP (0x0000) /*!< Chip-Specific bit setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 86 | #define RFAL_ANALOG_CONFIG_TECH_NFCA (0x0100) /*!< NFC-A Technology bits setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 87 | #define RFAL_ANALOG_CONFIG_TECH_NFCB (0x0200) /*!< NFC-B Technology bits setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 88 | #define RFAL_ANALOG_CONFIG_TECH_NFCF (0x0400) /*!< NFC-F Technology bits setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 89 | #define RFAL_ANALOG_CONFIG_TECH_AP2P (0x0800) /*!< AP2P Technology bits setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 90 | #define RFAL_ANALOG_CONFIG_TECH_NFCV (0x1000) /*!< NFC-V Technology bits setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 91 | #define RFAL_ANALOG_CONFIG_TECH_RFU (0x2000) /*!< RFU for Technology bits */ |
DiegoOstuni | 0:75fc82583a41 | 92 | |
DiegoOstuni | 0:75fc82583a41 | 93 | #define RFAL_ANALOG_CONFIG_BITRATE_COMMON (0x0000) /*!< Common settings for all bit rates in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 94 | #define RFAL_ANALOG_CONFIG_BITRATE_106 (0x0010) /*!< 106kbits/s settings in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 95 | #define RFAL_ANALOG_CONFIG_BITRATE_212 (0x0020) /*!< 212kbits/s settings in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 96 | #define RFAL_ANALOG_CONFIG_BITRATE_424 (0x0030) /*!< 424kbits/s settings in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 97 | #define RFAL_ANALOG_CONFIG_BITRATE_848 (0x0040) /*!< 848kbits/s settings in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 98 | #define RFAL_ANALOG_CONFIG_BITRATE_1695 (0x0050) /*!< 1695kbits/s settings in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 99 | #define RFAL_ANALOG_CONFIG_BITRATE_3390 (0x0060) /*!< 3390kbits/s settings in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 100 | #define RFAL_ANALOG_CONFIG_BITRATE_6780 (0x0070) /*!< 6780kbits/s settings in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 101 | #define RFAL_ANALOG_CONFIG_BITRATE_1OF4 (0x00C0) /*!< 1 out of 4 for NFC-V setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 102 | #define RFAL_ANALOG_CONFIG_BITRATE_1OF256 (0x00D0) /*!< 1 out of 256 for NFC-V setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 103 | |
DiegoOstuni | 0:75fc82583a41 | 104 | #define RFAL_ANALOG_CONFIG_NO_DIRECTION (0x0000) /*!< No direction setting in Analog Conf ID (Chip Specific only) */ |
DiegoOstuni | 0:75fc82583a41 | 105 | #define RFAL_ANALOG_CONFIG_TX (0x0001) /*!< Transmission bit setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 106 | #define RFAL_ANALOG_CONFIG_RX (0x0002) /*!< Reception bit setting in Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 107 | |
DiegoOstuni | 0:75fc82583a41 | 108 | #define RFAL_ANALOG_CONFIG_UPDATE_LAST (0x00) /*!< Value indicating Last configuration set during update */ |
DiegoOstuni | 0:75fc82583a41 | 109 | #define RFAL_ANALOG_CONFIG_UPDATE_MORE (0x01) /*!< Value indicating More configuration set coming during update */ |
DiegoOstuni | 0:75fc82583a41 | 110 | |
DiegoOstuni | 0:75fc82583a41 | 111 | /* |
DiegoOstuni | 0:75fc82583a41 | 112 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 113 | * GLOBAL MACROS |
DiegoOstuni | 0:75fc82583a41 | 114 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 115 | */ |
DiegoOstuni | 0:75fc82583a41 | 116 | |
DiegoOstuni | 0:75fc82583a41 | 117 | #define RFAL_ANALOG_CONFIG_ID_GET_POLL_LISTEN(id) (RFAL_ANALOG_CONFIG_POLL_LISTEN_MODE_MASK & id) /*!< Check if id indicates Listen mode */ |
DiegoOstuni | 0:75fc82583a41 | 118 | |
DiegoOstuni | 0:75fc82583a41 | 119 | #define RFAL_ANALOG_CONFIG_ID_GET_TECH(id) (RFAL_ANALOG_CONFIG_TECH_MASK & id) /*!< Get the technology of Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 120 | #define RFAL_ANALOG_CONFIG_ID_IS_CHIP(id) (RFAL_ANALOG_CONFIG_TECH_MASK & id) /*!< Check if ID indicates Chip-specific */ |
DiegoOstuni | 0:75fc82583a41 | 121 | #define RFAL_ANALOG_CONFIG_ID_IS_NFCA(id) (RFAL_ANALOG_CONFIG_TECH_NFCA & id) /*!< Check if ID indicates NFC-A */ |
DiegoOstuni | 0:75fc82583a41 | 122 | #define RFAL_ANALOG_CONFIG_ID_IS_NFCB(id) (RFAL_ANALOG_CONFIG_TECH_NFCB & id) /*!< Check if ID indicates NFC-B */ |
DiegoOstuni | 0:75fc82583a41 | 123 | #define RFAL_ANALOG_CONFIG_ID_IS_NFCF(id) (RFAL_ANALOG_CONFIG_TECH_NFCF & id) /*!< Check if ID indicates NFC-F */ |
DiegoOstuni | 0:75fc82583a41 | 124 | #define RFAL_ANALOG_CONFIG_ID_IS_AP2P(id) (RFAL_ANALOG_CONFIG_TECH_AP2P & id) /*!< Check if ID indicates AP2P */ |
DiegoOstuni | 0:75fc82583a41 | 125 | #define RFAL_ANALOG_CONFIG_ID_IS_NFCV(id) (RFAL_ANALOG_CONFIG_TECH_NFCV & id) /*!< Check if ID indicates NFC-V */ |
DiegoOstuni | 0:75fc82583a41 | 126 | |
DiegoOstuni | 0:75fc82583a41 | 127 | #define RFAL_ANALOG_CONFIG_ID_GET_BITRATE(id) (RFAL_ANALOG_CONFIG_BITRATE_MASK & id) /*!< Get Bitrate of Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 128 | #define RFAL_ANALOG_CONFIG_ID_IS_COMMON(id) (RFAL_ANALOG_CONFIG_BITRATE_MASK & id) /*!< Check if ID indicates common bitrate */ |
DiegoOstuni | 0:75fc82583a41 | 129 | #define RFAL_ANALOG_CONFIG_ID_IS_106(id) (RFAL_ANALOG_CONFIG_BITRATE_106 & id) /*!< Check if ID indicates 106kbits/s */ |
DiegoOstuni | 0:75fc82583a41 | 130 | #define RFAL_ANALOG_CONFIG_ID_IS_212(id) (RFAL_ANALOG_CONFIG_BITRATE_212 & id) /*!< Check if ID indicates 212kbits/s */ |
DiegoOstuni | 0:75fc82583a41 | 131 | #define RFAL_ANALOG_CONFIG_ID_IS_424(id) (RFAL_ANALOG_CONFIG_BITRATE_424 & id) /*!< Check if ID indicates 424kbits/s */ |
DiegoOstuni | 0:75fc82583a41 | 132 | #define RFAL_ANALOG_CONFIG_ID_IS_848(id) (RFAL_ANALOG_CONFIG_BITRATE_848 & id) /*!< Check if ID indicates 848kbits/s */ |
DiegoOstuni | 0:75fc82583a41 | 133 | #define RFAL_ANALOG_CONFIG_ID_IS_1695(id) (RFAL_ANALOG_CONFIG_BITRATE_1695 & id) /*!< Check if ID indicates 1695kbits/s */ |
DiegoOstuni | 0:75fc82583a41 | 134 | #define RFAL_ANALOG_CONFIG_ID_IS_3390(id) (RFAL_ANALOG_CONFIG_BITRATE_3390 & id) /*!< Check if ID indicates 3390kbits/s */ |
DiegoOstuni | 0:75fc82583a41 | 135 | #define RFAL_ANALOG_CONFIG_ID_IS_6780(id) (RFAL_ANALOG_CONFIG_BITRATE_6780 & id) /*!< Check if ID indicates 6780kbits/s */ |
DiegoOstuni | 0:75fc82583a41 | 136 | #define RFAL_ANALOG_CONFIG_ID_IS_1OF4(id) (RFAL_ANALOG_CONFIG_BITRATE_1OF4 & id) /*!< Check if ID indicates 1 out of 4 bitrate */ |
DiegoOstuni | 0:75fc82583a41 | 137 | #define RFAL_ANALOG_CONFIG_ID_IS_1OF256(id) (RFAL_ANALOG_CONFIG_BITRATE_1OF256 & id) /*!< Check if ID indicates 1 out of 256 bitrate */ |
DiegoOstuni | 0:75fc82583a41 | 138 | |
DiegoOstuni | 0:75fc82583a41 | 139 | #define RFAL_ANALOG_CONFIG_ID_GET_DIRECTION(id) (RFAL_ANALOG_CONFIG_DIRECTION_MASK & id) /*!< Get Direction of Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 140 | #define RFAL_ANALOG_CONFIG_ID_IS_TX(id) (RFAL_ANALOG_CONFIG_TX & id) /*!< Check if id indicates TX */ |
DiegoOstuni | 0:75fc82583a41 | 141 | #define RFAL_ANALOG_CONFIG_ID_IS_RX(id) (RFAL_ANALOG_CONFIG_RX & id) /*!< Check if id indicates RX */ |
DiegoOstuni | 0:75fc82583a41 | 142 | |
DiegoOstuni | 0:75fc82583a41 | 143 | #define RFAL_ANALOG_CONFIG_CONFIG_NUM(x) (sizeof(x)/sizeof(x[0])) /*!< Get Analog Config number */ |
DiegoOstuni | 0:75fc82583a41 | 144 | |
DiegoOstuni | 0:75fc82583a41 | 145 | /*! Set Analog Config ID value by: Mode, Technology, Bitrate and Direction */ |
DiegoOstuni | 0:75fc82583a41 | 146 | #define RFAL_ANALOG_CONFIG_ID_SET(mode, tech, br, direction) \ |
DiegoOstuni | 0:75fc82583a41 | 147 | ( RFAL_ANALOG_CONFIG_ID_GET_POLL_LISTEN(mode) \ |
DiegoOstuni | 0:75fc82583a41 | 148 | | RFAL_ANALOG_CONFIG_ID_GET_TECH(tech) \ |
DiegoOstuni | 0:75fc82583a41 | 149 | | RFAL_ANALOG_CONFIG_ID_GET_BITRATE(br) \ |
DiegoOstuni | 0:75fc82583a41 | 150 | | RFAL_ANALOG_CONFIG_ID_GET_DIRECTION(direction) \ |
DiegoOstuni | 0:75fc82583a41 | 151 | ) |
DiegoOstuni | 0:75fc82583a41 | 152 | |
DiegoOstuni | 0:75fc82583a41 | 153 | /* |
DiegoOstuni | 0:75fc82583a41 | 154 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 155 | * GLOBAL DATA TYPES |
DiegoOstuni | 0:75fc82583a41 | 156 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 157 | */ |
DiegoOstuni | 0:75fc82583a41 | 158 | |
DiegoOstuni | 0:75fc82583a41 | 159 | typedef uint8_t rfalAnalogConfigMode; /*!< Polling or Listening Mode of Configuration */ |
DiegoOstuni | 0:75fc82583a41 | 160 | typedef uint8_t rfalAnalogConfigTech; /*!< Technology of Configuration */ |
DiegoOstuni | 0:75fc82583a41 | 161 | typedef uint8_t rfalAnalogConfigBitrate; /*!< Bitrate of Configuration */ |
DiegoOstuni | 0:75fc82583a41 | 162 | typedef uint8_t rfalAnalogConfigDirection; /*!< Transmit/Receive direction of Configuration */ |
DiegoOstuni | 0:75fc82583a41 | 163 | |
DiegoOstuni | 0:75fc82583a41 | 164 | typedef uint8_t rfalAnalogConfigRegAddr[2]; /*!< Register Address to ST Chip */ |
DiegoOstuni | 0:75fc82583a41 | 165 | typedef uint8_t rfalAnalogConfigRegMask; /*!< Register Mask Value */ |
DiegoOstuni | 0:75fc82583a41 | 166 | typedef uint8_t rfalAnalogConfigRegVal; /*!< Register Value */ |
DiegoOstuni | 0:75fc82583a41 | 167 | |
DiegoOstuni | 0:75fc82583a41 | 168 | typedef uint16_t rfalAnalogConfigId; /*!< Analog Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 169 | typedef uint16_t rfalAnalogConfigOffset; /*!< Analog Configuration offset address in the table */ |
DiegoOstuni | 0:75fc82583a41 | 170 | typedef uint8_t rfalAnalogConfigNum; /*!< Number of Analog settings for the respective Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 171 | |
DiegoOstuni | 0:75fc82583a41 | 172 | |
DiegoOstuni | 0:75fc82583a41 | 173 | /*! Struct that contain the Register-Mask-Value set. Make sure that the whole structure size is even and unaligned! */ |
DiegoOstuni | 0:75fc82583a41 | 174 | typedef struct { |
DiegoOstuni | 0:75fc82583a41 | 175 | rfalAnalogConfigRegAddr addr; /*!< Register Address */ |
DiegoOstuni | 0:75fc82583a41 | 176 | rfalAnalogConfigRegMask mask; /*!< Register Mask Value */ |
DiegoOstuni | 0:75fc82583a41 | 177 | rfalAnalogConfigRegVal val; /*!< Register Value */ |
DiegoOstuni | 0:75fc82583a41 | 178 | } rfalAnalogConfigRegAddrMaskVal; |
DiegoOstuni | 0:75fc82583a41 | 179 | |
DiegoOstuni | 0:75fc82583a41 | 180 | |
DiegoOstuni | 0:75fc82583a41 | 181 | /*! Struct that represents the Analog Configs */ |
DiegoOstuni | 0:75fc82583a41 | 182 | typedef struct { |
DiegoOstuni | 0:75fc82583a41 | 183 | uint8_t id[sizeof(rfalAnalogConfigId)]; /*!< Configuration ID */ |
DiegoOstuni | 0:75fc82583a41 | 184 | rfalAnalogConfigNum num; /*!< Number of Config Sets to follow */ |
DiegoOstuni | 0:75fc82583a41 | 185 | rfalAnalogConfigRegAddrMaskVal regSet[]; /*!< Register-Mask-Value sets */ |
DiegoOstuni | 0:75fc82583a41 | 186 | } rfalAnalogConfig; |
DiegoOstuni | 0:75fc82583a41 | 187 | |
DiegoOstuni | 0:75fc82583a41 | 188 | |
DiegoOstuni | 0:75fc82583a41 | 189 | /* |
DiegoOstuni | 0:75fc82583a41 | 190 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 191 | * GLOBAL FUNCTION PROTOTYPES |
DiegoOstuni | 0:75fc82583a41 | 192 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 193 | */ |
DiegoOstuni | 0:75fc82583a41 | 194 | |
DiegoOstuni | 0:75fc82583a41 | 195 | /*! |
DiegoOstuni | 0:75fc82583a41 | 196 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 197 | * \brief Initialize the Analog Configuration |
DiegoOstuni | 0:75fc82583a41 | 198 | * |
DiegoOstuni | 0:75fc82583a41 | 199 | * Reset the Analog Configuration LUT pointer to reference to default settings. |
DiegoOstuni | 0:75fc82583a41 | 200 | * |
DiegoOstuni | 0:75fc82583a41 | 201 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 202 | */ |
DiegoOstuni | 0:75fc82583a41 | 203 | void rfalAnalogConfigInitialize( void ); |
DiegoOstuni | 0:75fc82583a41 | 204 | |
DiegoOstuni | 0:75fc82583a41 | 205 | |
DiegoOstuni | 0:75fc82583a41 | 206 | /*! |
DiegoOstuni | 0:75fc82583a41 | 207 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 208 | * \brief Indicate if the current Analog Configuration Table is complete and ready to be used. |
DiegoOstuni | 0:75fc82583a41 | 209 | * |
DiegoOstuni | 0:75fc82583a41 | 210 | * \return true if current Analog Configuration Table is complete and ready to be used. |
DiegoOstuni | 0:75fc82583a41 | 211 | * \return false if current Analog Configuration Table is incomplete |
DiegoOstuni | 0:75fc82583a41 | 212 | * |
DiegoOstuni | 0:75fc82583a41 | 213 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 214 | */ |
DiegoOstuni | 0:75fc82583a41 | 215 | bool rfalAnalogConfigIsReady( void ); |
DiegoOstuni | 0:75fc82583a41 | 216 | |
DiegoOstuni | 0:75fc82583a41 | 217 | /*! |
DiegoOstuni | 0:75fc82583a41 | 218 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 219 | * \brief Write the whole Analog Configuration table in raw format |
DiegoOstuni | 0:75fc82583a41 | 220 | * |
DiegoOstuni | 0:75fc82583a41 | 221 | * Writes the Analog Configuration and Look Up Table with the given raw table |
DiegoOstuni | 0:75fc82583a41 | 222 | * |
DiegoOstuni | 0:75fc82583a41 | 223 | * NOTE: Function does not check the validity of the given Table contents |
DiegoOstuni | 0:75fc82583a41 | 224 | * |
DiegoOstuni | 0:75fc82583a41 | 225 | * \param[in] configTbl: location of config Table to be loaded |
DiegoOstuni | 0:75fc82583a41 | 226 | * \param[in] configTblSize: size of the config Table to be loaded |
DiegoOstuni | 0:75fc82583a41 | 227 | * |
DiegoOstuni | 0:75fc82583a41 | 228 | * \return ERR_NONE : if setting is updated |
DiegoOstuni | 0:75fc82583a41 | 229 | * \return ERR_PARAM : if configTbl is invalid |
DiegoOstuni | 0:75fc82583a41 | 230 | * \return ERR_NOMEM : if the given Table is bigger exceeds the max size |
DiegoOstuni | 0:75fc82583a41 | 231 | * \return ERR_REQUEST : if the update Configuration Id is disabled |
DiegoOstuni | 0:75fc82583a41 | 232 | * |
DiegoOstuni | 0:75fc82583a41 | 233 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 234 | */ |
DiegoOstuni | 0:75fc82583a41 | 235 | ReturnCode rfalAnalogConfigListWriteRaw( const uint8_t *configTbl, uint16_t configTblSize ); |
DiegoOstuni | 0:75fc82583a41 | 236 | |
DiegoOstuni | 0:75fc82583a41 | 237 | /*! |
DiegoOstuni | 0:75fc82583a41 | 238 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 239 | * \brief Write the Analog Configuration table with new analog settings. |
DiegoOstuni | 0:75fc82583a41 | 240 | * |
DiegoOstuni | 0:75fc82583a41 | 241 | * Writes the Analog Configuration and Look Up Table with the new list of register-mask-value |
DiegoOstuni | 0:75fc82583a41 | 242 | * and Configuration ID respectively. |
DiegoOstuni | 0:75fc82583a41 | 243 | * |
DiegoOstuni | 0:75fc82583a41 | 244 | * NOTE: Function does not check for the validity of the Register Address. |
DiegoOstuni | 0:75fc82583a41 | 245 | * |
DiegoOstuni | 0:75fc82583a41 | 246 | * \param[in] more: 0x00 indicates it is last Configuration ID settings; |
DiegoOstuni | 0:75fc82583a41 | 247 | * 0x01 indicates more Configuration ID setting(s) are coming. |
DiegoOstuni | 0:75fc82583a41 | 248 | * \param[in] *config: reference to the configuration list of current Configuraiton ID. |
DiegoOstuni | 0:75fc82583a41 | 249 | * |
DiegoOstuni | 0:75fc82583a41 | 250 | * \return ERR_PARAM : if Configuration ID or parameter is invalid |
DiegoOstuni | 0:75fc82583a41 | 251 | * \return ERR_NOMEM : if LUT is full |
DiegoOstuni | 0:75fc82583a41 | 252 | * \return ERR_REQUEST : if the update Configuration Id is disabled |
DiegoOstuni | 0:75fc82583a41 | 253 | * \return ERR_NONE : if setting is updated |
DiegoOstuni | 0:75fc82583a41 | 254 | * |
DiegoOstuni | 0:75fc82583a41 | 255 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 256 | */ |
DiegoOstuni | 0:75fc82583a41 | 257 | ReturnCode rfalAnalogConfigListWrite( uint8_t more, rfalAnalogConfig *config ); |
DiegoOstuni | 0:75fc82583a41 | 258 | |
DiegoOstuni | 0:75fc82583a41 | 259 | /*! |
DiegoOstuni | 0:75fc82583a41 | 260 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 261 | * \brief Read the whole Analog Configuration table in raw format |
DiegoOstuni | 0:75fc82583a41 | 262 | * |
DiegoOstuni | 0:75fc82583a41 | 263 | * Reads the whole Analog Configuration Table in raw format |
DiegoOstuni | 0:75fc82583a41 | 264 | * |
DiegoOstuni | 0:75fc82583a41 | 265 | * \param[out] tblBuf: location to the buffer to place the Config Table |
DiegoOstuni | 0:75fc82583a41 | 266 | * \param[in] tblBufLen: length of the buffer to place the Config Table |
DiegoOstuni | 0:75fc82583a41 | 267 | * \param[out] configTblSize: Config Table size |
DiegoOstuni | 0:75fc82583a41 | 268 | * |
DiegoOstuni | 0:75fc82583a41 | 269 | * \return ERR_PARAM : if configTbl or configTblSize is invalid |
DiegoOstuni | 0:75fc82583a41 | 270 | * \return ERR_NOMEM : if configTblSize is not enough for the whole table |
DiegoOstuni | 0:75fc82583a41 | 271 | * \return ERR_NONE : if read is successful |
DiegoOstuni | 0:75fc82583a41 | 272 | * |
DiegoOstuni | 0:75fc82583a41 | 273 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 274 | */ |
DiegoOstuni | 0:75fc82583a41 | 275 | ReturnCode rfalAnalogConfigListReadRaw( uint8_t *tblBuf, uint16_t tblBufLen, uint16_t *configTblSize ); |
DiegoOstuni | 0:75fc82583a41 | 276 | |
DiegoOstuni | 0:75fc82583a41 | 277 | /*! |
DiegoOstuni | 0:75fc82583a41 | 278 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 279 | * \brief Read the Analog Configuration table. |
DiegoOstuni | 0:75fc82583a41 | 280 | * |
DiegoOstuni | 0:75fc82583a41 | 281 | * Read the Analog Configuration Table |
DiegoOstuni | 0:75fc82583a41 | 282 | * |
DiegoOstuni | 0:75fc82583a41 | 283 | * \param[in] configOffset: offset to the next Configuration ID in the List Table to be read. |
DiegoOstuni | 0:75fc82583a41 | 284 | * \param[out] more: 0x00 indicates it is last Configuration ID settings; |
DiegoOstuni | 0:75fc82583a41 | 285 | * 0x01 indicates more Configuration ID setting(s) are coming. |
DiegoOstuni | 0:75fc82583a41 | 286 | * \param[out] config: configuration id, number of configuration sets and register-mask-value sets |
DiegoOstuni | 0:75fc82583a41 | 287 | * \param[in] numConfig: the remaining configuration settings space available; |
DiegoOstuni | 0:75fc82583a41 | 288 | * |
DiegoOstuni | 0:75fc82583a41 | 289 | * \return ERR_NOMEM : if number of Configuration for respective Configuration ID is greater the the remaining configuration setting space available |
DiegoOstuni | 0:75fc82583a41 | 290 | * \return ERR_NONE : if read is successful |
DiegoOstuni | 0:75fc82583a41 | 291 | * |
DiegoOstuni | 0:75fc82583a41 | 292 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 293 | */ |
DiegoOstuni | 0:75fc82583a41 | 294 | ReturnCode rfalAnalogConfigListRead( rfalAnalogConfigOffset *configOffset, uint8_t *more, rfalAnalogConfig *config, rfalAnalogConfigNum numConfig ); |
DiegoOstuni | 0:75fc82583a41 | 295 | |
DiegoOstuni | 0:75fc82583a41 | 296 | /*! |
DiegoOstuni | 0:75fc82583a41 | 297 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 298 | * \brief Set the Analog settings of indicated Configuration ID. |
DiegoOstuni | 0:75fc82583a41 | 299 | * |
DiegoOstuni | 0:75fc82583a41 | 300 | * Update the chip with indicated analog settings of indicated Configuration ID. |
DiegoOstuni | 0:75fc82583a41 | 301 | * |
DiegoOstuni | 0:75fc82583a41 | 302 | * \param[in] configId: configuration ID |
DiegoOstuni | 0:75fc82583a41 | 303 | * |
DiegoOstuni | 0:75fc82583a41 | 304 | * \return ERR_PARAM if Configuration ID is invalid |
DiegoOstuni | 0:75fc82583a41 | 305 | * \return ERR_INTERNAL if error updating setting to chip |
DiegoOstuni | 0:75fc82583a41 | 306 | * \return ERR_NONE if new settings is applied to chip |
DiegoOstuni | 0:75fc82583a41 | 307 | * |
DiegoOstuni | 0:75fc82583a41 | 308 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 309 | */ |
DiegoOstuni | 0:75fc82583a41 | 310 | ReturnCode rfalSetAnalogConfig( rfalAnalogConfigId configId, 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:75fc82583a41 | 311 | |
DiegoOstuni | 0:75fc82583a41 | 312 | |
DiegoOstuni | 0:75fc82583a41 | 313 | #endif /* RFAL_ANALOG_CONFIG_H */ |
DiegoOstuni | 0:75fc82583a41 | 314 | |
DiegoOstuni | 0:75fc82583a41 | 315 | /** |
DiegoOstuni | 0:75fc82583a41 | 316 | * @} |
DiegoOstuni | 0:75fc82583a41 | 317 | * |
DiegoOstuni | 0:75fc82583a41 | 318 | * @} |
DiegoOstuni | 0:75fc82583a41 | 319 | * |
DiegoOstuni | 0:75fc82583a41 | 320 | * @} |
DiegoOstuni | 0:75fc82583a41 | 321 | */ |