MCPcopy Create free account
hub / github.com/devkitPro/libctru / NFC_StartCommsAdapter

Function NFC_StartCommsAdapter

libctru/source/services/nfc.c:68–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68static Result NFC_StartCommsAdapter(void)
69{
70 Result ret, ret2;
71 bool new3ds_flag = false;
72 u8 status;
73
74 APT_CheckNew3DS(&new3ds_flag);
75
76 if(new3ds_flag) return 0;
77
78 ret = NFC_StartCommunication();
79 if(R_FAILED(ret))return ret;
80
81 while(1)
82 {
83 status = 0;
84 ret = NFC_CommunicationGetStatus(&status);
85 if(R_FAILED(ret))break;
86
87 if(status==1)//"Attempting to initialize Old3DS NFC adapter communication."
88 {
89 svcSleepThread(1000000*100);
90 continue;
91 }
92 else if(status==2)//"Old3DS NFC adapter communication initialization successfully finished."
93 {
94 break;
95 }
96
97 //An error occured with Old3DS NFC-adapter communication initialization.
98
99 ret = NFC_CommunicationGetResult(&ret2);
100 if(R_FAILED(ret))break;
101
102 return ret2;
103 }
104
105 return ret;
106}
107
108Result nfcStartScanning(u16 inval)
109{

Callers 2

nfcStartScanningFunction · 0.85
nfcStartOtherTagScanningFunction · 0.85

Calls 4

APT_CheckNew3DSFunction · 0.85
NFC_StartCommunicationFunction · 0.85

Tested by

no test coverage detected