4 #include "pcd_config.h"
6 uint8_t RCRegFactor
[19] =
8 0x12, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
9 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x3F, 0x3F
12 //*******************************************
13 // ISO 14443 TypeA config data
14 //*******************************************
15 static const uint8_t CfgTbl_AGen
[] =
17 ModeReg
, 0x39, //CRCPreset = 6363H
27 static const uint8_t CfgTbl_A106Tx
[] =
29 TxModeReg
,0x80, //ISO/IEC 14443A/MIFARE and 106 kbit, TxCRCEn On
34 static const uint8_t CfgTbl_A106Rx
[] =
36 RxModeReg
,0x80, //ISO/IEC 14443A/MIFARE and 106 kbit, RxCRCEn On
40 static const uint8_t CfgTbl_A212Tx
[] =
47 static const uint8_t CfgTbl_A212Rx
[] =
53 static const uint8_t CfgTbl_A424Tx
[] =
60 static const uint8_t CfgTbl_A424Rx
[] =
66 static const uint8_t CfgTbl_A848Tx
[] =
73 static const uint8_t CfgTbl_A848Rx
[] =
79 //*******************************************
80 // ISO 14443 TypeB config data
81 //*******************************************
82 static const uint8_t CfgTbl_BGen
[] =
93 static const uint8_t CfgTbl_B106Tx
[] =
100 static const uint8_t CfgTbl_B106Rx
[] =
107 static const uint8_t CfgTbl_B212Tx
[] =
115 static const uint8_t CfgTbl_B212Rx
[] =
122 static const uint8_t CfgTbl_B424Tx
[] =
129 static const uint8_t CfgTbl_B424Rx
[] =
136 static const uint8_t CfgTbl_B848Tx
[] =
143 static const uint8_t CfgTbl_B848Rx
[] =
150 void pcd_config_iso14443_card(uint8_t flagConfig
, uint8_t cardType
)
154 const uint8_t *pTable
;
157 if(flagConfig
== CONFIGTYPEA
) {
158 pTable
= CfgTbl_AGen
;
159 pn51x_reg_write(CWGsPReg
, RCRegFactor
[TypeACWGsP
]);
162 pTable
= CfgTbl_BGen
;
163 pn51x_reg_write(CWGsPReg
, RCRegFactor
[TypeBCWGsP
]);
164 pn51x_reg_write(ModGsPReg
, RCRegFactor
[BModeIndex
]);
167 regAddr
= pTable
[i
++];
169 pn51x_reg_write(regAddr
,pTable
[i
++]);
170 regAddr
= pTable
[i
++];
174 /* if CONFIGNOTHING only do cardtype config */
177 pTable
= CfgTbl_A106Tx
;
180 pTable
= CfgTbl_A212Tx
;
183 pTable
= CfgTbl_A424Tx
;
186 pTable
= CfgTbl_A848Tx
;
189 pTable
= CfgTbl_B106Tx
;
192 pTable
= CfgTbl_B212Tx
;
195 pTable
= CfgTbl_B424Tx
;
198 pTable
= CfgTbl_B848Tx
;
201 pn51x_reg_write(RFCfgReg
, RCRegFactor
[ARFAmpCfg106
]);
202 pn51x_reg_write(RxThresholdReg
, RCRegFactor
[RxAThres106
]);
203 pTable
= CfgTbl_A106Rx
;
206 pn51x_reg_write(RFCfgReg
, RCRegFactor
[ARFAmpCfg212
]);
207 pn51x_reg_write(RxThresholdReg
, RCRegFactor
[RxAThres212
]);
208 pTable
= CfgTbl_A212Rx
;
211 pn51x_reg_write(RFCfgReg
, RCRegFactor
[ARFAmpCfg424
]);
212 pn51x_reg_write(RxThresholdReg
, RCRegFactor
[RxAThres424
]);
213 pTable
= CfgTbl_A424Rx
;
216 pn51x_reg_write(RFCfgReg
, RCRegFactor
[ARFAmpCfg848
]);
217 pn51x_reg_write(RxThresholdReg
, RCRegFactor
[RxAThres848
]);
218 pTable
= CfgTbl_A848Rx
;
221 pn51x_reg_write(RFCfgReg
, RCRegFactor
[BRFAmpCfg106
]);
222 pn51x_reg_write(RxThresholdReg
, RCRegFactor
[RxBThres106
]);
223 pTable
= CfgTbl_B106Rx
;
226 pn51x_reg_write(RFCfgReg
, RCRegFactor
[BRFAmpCfg212
]);
227 pn51x_reg_write(RxThresholdReg
, RCRegFactor
[RxBThres212
]);
228 pTable
= CfgTbl_B212Rx
;
231 pn51x_reg_write(RFCfgReg
, RCRegFactor
[BRFAmpCfg424
]);
232 pn51x_reg_write(RxThresholdReg
, RCRegFactor
[RxBThres424
]);
233 pTable
= CfgTbl_B424Rx
;
236 pn51x_reg_write(RFCfgReg
, RCRegFactor
[BRFAmpCfg848
]);
237 pn51x_reg_write(RxThresholdReg
, RCRegFactor
[RxBThres848
]);
238 pTable
= CfgTbl_B848Rx
;
243 regAddr
= pTable
[i
++];
245 pn51x_reg_write(regAddr
,pTable
[i
++]);
246 regAddr
= pTable
[i
++];