diff --git a/.cproject b/.cproject index cbd8cfcf5ae9d1993456247d517d1fb05436a2d8..61fc97ae67bc734004dd1369f50b759da720435b 100644 --- a/.cproject +++ b/.cproject @@ -5,7 +5,7 @@ - + @@ -61,14 +61,14 @@ - + - + @@ -115,7 +115,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -309,7 +309,7 @@ - + - + diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index bd045412d7c293b9deec438982b52260b8932fee..543007ca4350d9943e3110befcb9ba783417b3ad 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -71,7 +71,7 @@ - + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..87edcb2d11b5712d9b9533654c241713c0b122cb --- /dev/null +++ b/Makefile @@ -0,0 +1,64 @@ +# Digital Logic +# www.d-logic.net +# +# Helper Makefile +# +$(VERBOSE).SILENT: + +PRJNAME = anti-collision-demo-con +all : help + +help info : + echo "----------------------------------------------" + echo "Making example to test Reader opening function" + echo "Project output name: $(PRJNAME)" + echo "----------------------------------------------" + echo "For 32 bit Windows - type: 'make win32'" + echo "For 64 bit Windows - type: 'make win64'" + echo "For 32 bit Linux - type: 'make lin32'" + echo "For 64 bit Linux - type: 'make lin64'" + echo "----------------------------------------------" + +lin32 linux32 : + cd linux32_release && gcc -m32 -o $(PRJNAME) ../src/*.c -I../lib/include -L../lib/linux/x86 -luFCoder-x86 -Wl,-R../lib/linux/x86 + echo "Making done, without errors." + echo "To run the example - type:" + echo " 'cd linux32_release && ./$(PRJNAME)'" + +lin64 linux64 : + cd linux64_release && gcc -m64 -o $(PRJNAME) ../src/*.c -I../lib/include -L../lib/linux/x86_64 -luFCoder-x86_64 -Wl,-R../lib/linux/x86_64 + echo "Making done, without errors." + echo "To run the example - type:" + echo " 'cd linux64_release && ./$(PRJNAME)'" + +win32 : + echo "If You see error like: 'skipping incompatible lib/windows/x86/uFCoder-x86.dll when searching for...'" + echo " This means You have the gcc compiler for 64 bit" + echo " type 'make win64' instead of 'make win32'" + echo "" + cd win32_release && gcc -o $(PRJNAME) ../src/*.c -I../lib/include -L../lib/windows/x86 -luFCoder-x86 -Wl,-Rlib/windows/x86 -Wl,--enable-stdcall-fixup + echo "Making done, without errors." + echo "To run the example - type:" + echo " 'cd win32_release'" + echo " 'run_me'" + # generate run_me + echo "@echo off" > win32_release\\run_me.cmd + echo "set path=..\lib\windows\x86;%path%" >> win32_release\\run_me.cmd + echo "$(PRJNAME).exe" >> win32_release\\run_me.cmd + +win64 : + echo "If You see error like: 'lib/windows/x86_64/uFCoder-x86_64.dll: file not recognized: File format not recognized'" + echo " This means You have the gcc compiler for 32 bit" + echo " type 'make win32' instead of 'make win64'" + echo "" + cd win64_release && gcc -o $(PRJNAME) ../src/*.c -I../lib/include -L../lib/windows/x86_64 -luFCoder-x86_64 -Wl,-Rlib/windows/x86_64 + echo "Making done, without errors." + echo "You must use library from the 'lib\windows\x86_64\'" + echo "" + echo "To run the example - type:" + echo " 'cd win64_release'" + echo " 'run_me'" + # generate run_me + echo "@echo off" > win64_release\\run_me.cmd + echo "set path=..\lib\windows\x86_64;%path%" >> win64_release\\run_me.cmd + echo "$(PRJNAME)" >> win64_release\\run_me.cmd diff --git a/Release_Linux32/anti-collision-demo-con b/Release_Linux32/anti-collision-demo-con deleted file mode 100644 index 25c8465c8532de4048a6dc06a49a69a074e7dbdb..0000000000000000000000000000000000000000 Binary files a/Release_Linux32/anti-collision-demo-con and /dev/null differ diff --git a/Release_Linux64/anti-collision-demo-con b/Release_Linux64/anti-collision-demo-con deleted file mode 100644 index 908421fbbc919ff5f4a835fbe8d1ac91a8099725..0000000000000000000000000000000000000000 Binary files a/Release_Linux64/anti-collision-demo-con and /dev/null differ diff --git a/Release_Win32/anti-collision-demo-con.exe b/Release_Win32/anti-collision-demo-con.exe deleted file mode 100644 index f5e218220a599cce8375059623bf747fac7bd54a..0000000000000000000000000000000000000000 Binary files a/Release_Win32/anti-collision-demo-con.exe and /dev/null differ diff --git a/Release_Win64/anti-collision-demo-con.exe b/Release_Win64/anti-collision-demo-con.exe index e487eff94c404f6336ad184d7568bc3bc18014dc..e298dcab50ea671291dd12e04281225e327bf5e1 100644 Binary files a/Release_Win64/anti-collision-demo-con.exe and b/Release_Win64/anti-collision-demo-con.exe differ diff --git a/lib b/lib index dce7c649edec122c7b55ed28216f522cf2dc9bfc..9cb400b77fee4789b6b74c391a6f602ec024a168 160000 --- a/lib +++ b/lib @@ -1 +1 @@ -Subproject commit dce7c649edec122c7b55ed28216f522cf2dc9bfc +Subproject commit 9cb400b77fee4789b6b74c391a6f602ec024a168 diff --git a/linux64_release/anti-collision-demo-con b/linux64_release/anti-collision-demo-con new file mode 100644 index 0000000000000000000000000000000000000000..1cec19ff33caffdc82d219c3c0800f1c13470991 Binary files /dev/null and b/linux64_release/anti-collision-demo-con differ diff --git a/src/anti_collision.c b/src/anti_collision.c index 763d0acc93ab07ffc566b105571f77e0b11c44fa..2bec8e42d38a75981488ab8c7cff3ece02a4c729 100644 --- a/src/anti_collision.c +++ b/src/anti_collision.c @@ -40,10 +40,10 @@ int main(void) { int8_t IsAntiCollEnabled; int8_t IsAnyCardSelected; uint8_t CardsNumber; - uint8_t List[4 * 11]; // Max list size is 44 bytes, first byte is always current UidSize + uint8_t List[10 * 11]; // Max list size is 44 bytes, first byte is always current UidSize uint8_t ListSize; - uint8_t ListOfSizes[4]; - uint8_t ListOfIndexes[4]; + uint8_t ListOfSizes[10]; + uint8_t ListOfIndexes[10]; uint8_t index; uint8_t CardType; int loop = 1; @@ -283,7 +283,11 @@ int main(void) { for (int i = 0; i < CardsNumber; i++) { ListOfSizes[i] = List[index]; ListOfIndexes[i] = index + 1; - printf("%d. ", i + 1); + if(i == 9) + printf("A."); + else + printf("%d. ", i + 1); + print_hex_ln(&List[ListOfIndexes[i]], ListOfSizes[i], ":"); index += 11; } @@ -310,7 +314,10 @@ int main(void) { } printf("Choose card uid:\n"); for (int i = 0; i < CardsNumber; i++) { - printf(" [%d] ", i + 1); + if(i == 9) + printf("A."); + else + printf(" [%d] ", i + 1); print_hex_ln(&List[ListOfIndexes[i]], ListOfSizes[i], ":"); } printf("[esc] Cancel operation.\n"); @@ -322,7 +329,16 @@ int main(void) { case '2': case '3': case '4': - selected = c - 0x30; // to int + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + if(c == 'A') + selected = 10; + else + selected = c - 0x30; // to int if (selected > CardsNumber) break; status = SelectCard(&List[ListOfIndexes[selected - 1]], ListOfSizes[selected - 1], &CardType); diff --git a/win64_release/anti-collision-demo-con.exe b/win64_release/anti-collision-demo-con.exe new file mode 100644 index 0000000000000000000000000000000000000000..1f2131c04863ec196add07384e8f8ccc4e9712bd Binary files /dev/null and b/win64_release/anti-collision-demo-con.exe differ diff --git a/win64_release/run_me.cmd b/win64_release/run_me.cmd new file mode 100644 index 0000000000000000000000000000000000000000..189b3cb50e93bcaa2ac1e685b553ad6e982e323b --- /dev/null +++ b/win64_release/run_me.cmd @@ -0,0 +1,3 @@ +@echo off +set path=..\lib\windows\x86_64;%path% +anti-collision-demo-con