Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions acrealio/StaticReader.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "Arduino.h"
#include "StaticReader.h"

StaticReader::StaticReader()
{
card = 0;
pinMode(STATIC_SCAN_PIN, INPUT_PULLUP);
readcmd = false;
pinset = false;
readstatus = 0;
}

void StaticReader::setPins(int sensor, HardwareSerial* serialid)
{
pinset=true;
}

void StaticReader::update()
{
if (!pinset)
return;
if (!readcmd)
return;

//internal uid has been set in constructor, just has to return card type when button is pressed, 0 otherwise

if (digitalRead(STATIC_SCAN_PIN) == LOW)
{
card = STATIC_TYPE; // 1=iso15693 2=FeliCa
}
else
{
card = 0;
}
readcmd = false; //job done
}

byte StaticReader::isCardPresent()
{
return card;
}

void StaticReader::read()
{
readcmd = true;
}

void StaticReader::getUID(byte* uida)
{
memcpy(uida,uid,8);
}
30 changes: 30 additions & 0 deletions acrealio/StaticReader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* this module fakes a card scan by pressing a button. Faked card type and UID is configured in pinoutconfig.h */
#ifndef StaticReader_H
#define StaticReader_H

#include "Arduino.h"
#include "pinoutconfig.h"
#include "RfidModule.h"

class StaticReader : public RfidModule
{
public:
StaticReader();
void setPins(int sensor, HardwareSerial* serialid);
void read();
void update();
byte isCardPresent();
void getUID(byte* uid);

private:
byte card; // 0 : no card 1:ISO15693 2:Felica
byte uid[8] = STATIC_UID; //internal UID to be faked, as defined in pinoutconfig.h
boolean pinset; // pin init done flag
boolean readcmd; // read request from host flag
byte readstatus; // 0 : idle, 1 : looking for ISO15693, 2 : looking for Felica
};

#endif



8 changes: 5 additions & 3 deletions acrealio/acrealio.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
#include "RR10.h"
#include "SL015M.h"
#include "PN5180Reader.h"
#include "StaticReader.h"
#include "Ddr.h"



#define MINTIME 14 // Min time between 2 sent packet(Min is 14ms, Max is around 50ms) some games require this
#define MAX_NODES 3

Expand Down Expand Up @@ -83,6 +82,8 @@ SL015M mod1;
RR10 mod1;
#elif RFID_MODULE1 == 3
PN5180Reader mod1;
#elif RFID_MODULE1 == 4
StaticReader mod1;
#endif


Expand All @@ -95,6 +96,8 @@ SL015M mod2;
RR10 mod2;
#elif RFID_MODULE2 == 3
PN5180Reader mod2;
#elif RFID_MODULE2 == 4
StaticReader mod2;
#endif
#endif

Expand Down Expand Up @@ -465,4 +468,3 @@ long detRate()

return baudrates[i];
}

12 changes: 10 additions & 2 deletions acrealio/pinoutconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#define RFID_BAUD 115200 //Baud rate for RFID Module

#define RFID_MODULE1 3 //Rfid module used for reader1, 1:SL015M 2:RR10 3:PN5180
#define RFID_MODULE2 3 //Rfid module used for reader2, 1:SL015M 2:RR10 3:PN5180
#define RFID_MODULE1 4 //Rfid module used for reader1, 1:SL015M 2:RR10 3:PN5180 4:Static
#define RFID_MODULE2 4 //Rfid module used for reader2, 1:SL015M 2:RR10 3:PN5180 4:Static

#define SDVX_VOL_SENS 7 //Sensitivity for SDVX Volume buttons

Expand Down Expand Up @@ -109,5 +109,13 @@ COL C COL B COL A
#define PN5180_BUSY_PIN 9
#define PN5180_RST_PIN 7

//Static RFID Module configuration
//button to trigger a card scan
#define STATIC_SCAN_PIN A15
//card type (1 for ISO15693, 2 for FeliCa)
#define STATIC_TYPE 1
//card UID
#define STATIC_UID {0xE0,0x04,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF}

#endif