changes
This commit is contained in:
30
ext/rfid/MFRC522.cpp
Normal file
30
ext/rfid/MFRC522.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "MFRC522.h"
|
||||
|
||||
void MFRC522::init() {
|
||||
|
||||
|
||||
debugMod(NAME, "init");
|
||||
|
||||
spi::init();
|
||||
|
||||
//os_delay_us(5000);
|
||||
|
||||
// Reset baud rates
|
||||
writeReg8(Register::TX_MODE_REG, 0x00);
|
||||
writeReg8(Register::RX_MODE_REG, 0x00);
|
||||
// Reset ModWidthReg
|
||||
writeReg8(Register::MOD_WIDTH_REG, 0x26);
|
||||
|
||||
writeReg8(Register::T_MODE_REG, 0x80);
|
||||
writeReg8(Register::T_PRESCALER_REG, 0xA9);
|
||||
writeReg8(Register::T_RELOAD_REG_L, 0xE8);
|
||||
writeReg8(Register::T_RELOAD_REG_H, 0x03);
|
||||
writeReg8(Register::TX_AUTO_REG, 0x40);
|
||||
writeReg8(Register::MODE_REG, 0x3D); // very important. set CRC preset to 0x6363 by setting bit 0 and clearing bit 1 in MODE_REG
|
||||
|
||||
antennaOn();
|
||||
|
||||
writeReg8(Register::COMMAND_REG, Command::IDLE);
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user