►xCrocoDiffusion◄
/
shopcaisse
ethernet
Diff: lit_rfid.h
- Revision:
- 0:63a05302ef72
diff -r 000000000000 -r 63a05302ef72 lit_rfid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lit_rfid.h Tue May 16 07:37:46 2017 +0000 @@ -0,0 +1,105 @@ +void lit() +{ + bool a=true; + while(a){ + //a=false; + if ( RfChip.PICC_IsNewCardPresent()) + { + continue; + } + // Look for new cards + if ( ! RfChip.PICC_IsNewCardPresent()) + { + continue; + } + + //LedGreen = !LedGreen; + // Select one of the cards + if ( ! RfChip.PICC_ReadCardSerial()) + { + + continue; + } + + + + // Print Card UID + pc.printf("Card UID: "); + for (uint8_t i = 0; i < RfChip.uid.size; i++) + { + pc.printf("%X", RfChip.uid.uidByte[i]); + } + pc.printf("\n\r"); + + } +} +void lit_rfid(void) +{ + // Init. RC522 Chip + for (int i = 0; i < 10; i++) recept[i]='x'; + bool a; + char low,high; + a=true; + + while (a) { + + + + pc.printf("\n\r"); + recept[8]='\0'; + printf("Envoye au Client :%s",recept); + pc.printf("\n\r"); + a=false; + + + if ( RfChip.PICC_IsNewCardPresent()) { + pc.printf("1"); + a=false; + continue; + } + // Look for new cards + if ( ! RfChip.PICC_IsNewCardPresent()) { + pc.printf("2"); + a=false; + continue; + } + + //LedGreen = !LedGreen; + // Select one of the cards + if ( ! RfChip.PICC_ReadCardSerial()) { +pc.printf("3"); +a=false; + continue; + } + + + + // Print Card UID + pc.printf("Lu :%d",RfChip.uid.size); + for (int i = 0; i < RfChip.uid.size; i++) { + printf("%d\n",i); + low=RfChip.uid.uidByte[i]; + high=RfChip.uid.uidByte[i]; + pc.printf("%X02", RfChip.uid.uidByte[i]); + high=high & 0x0F; + low=low>>4; + low=low & 0x0f; + low=low+0x30; + high=high+0x30; + if (low>58) low=low+10-3; + if (high>58) high=high+10-3; + recept[i*2]=low; + recept[2*i+1]=high; + + + } + pc.printf("\n\r"); + recept[8]='\0'; + printf("Envoye au Client :%s",recept); + pc.printf("\n\r"); + a=false; + } + +} + +