►xCrocoDiffusion◄
/
shopcaisse
ethernet
lit_rfid.h
- Committer:
- denishautot
- Date:
- 2017-05-16
- Revision:
- 0:63a05302ef72
File content as of revision 0:63a05302ef72:
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; } }