Documentation ¶
Index ¶
- Constants
- type Mfrc522
- func (mfrc522 *Mfrc522) AntennaOff()
- func (mfrc522 *Mfrc522) AntennaOn()
- func (mfrc522 *Mfrc522) Anticoll() ([]byte, error)
- func (mfrc522 *Mfrc522) Auth(authMode byte, blockAddr byte, sectorkey []byte, serNum []byte) int
- func (mfrc522 *Mfrc522) ClearBitMask(reg byte, mask byte)
- func (mfrc522 *Mfrc522) DumpClassic1K(Key []byte) (error, string, []byte, []types.Mfrc522Sector16)
- func (mfrc522 *Mfrc522) Read(addr byte) (byte, error)
- func (mfrc522 *Mfrc522) ReadCard(blockAddr byte) (byte, []byte, error)
- func (mfrc522 *Mfrc522) Request(reqMode byte) (int, []byte)
- func (mfrc522 *Mfrc522) RequestIdle() (string, error)
- func (mfrc522 *Mfrc522) Reset()
- func (mfrc522 *Mfrc522) SelectTag(serNum []byte) (int, int)
- func (mfrc522 *Mfrc522) SetBitMask(reg byte, mask byte)
- func (mfrc522 *Mfrc522) StopCrypto1()
- func (mfrc522 *Mfrc522) ToCard(command byte, sendData []byte, expected int) (int, []byte)
- func (mfrc522 *Mfrc522) WaitForTag() (error, string, []byte)
- func (mfrc522 *Mfrc522) Write(addr byte, val byte)
- func (mfrc522 *Mfrc522) WriteCard(blockAddr byte, writeData []byte) (byte, []byte, error)
- func (mfrc522 *Mfrc522) WriteClassic1K(key []byte, uid []byte, sector byte, data []byte) error
Constants ¶
const ( MAX_LEN = 16 PCD_IDLE = 0x00 PCD_AUTHENT = 0x0E PCD_RECEIVE = 0x08 PCD_TRANSMIT = 0x04 PCD_TRANSCEIVE = 0x0C PCD_RESETPHASE = 0x0F PCD_CALCCRC = 0x03 PICC_REQIDL = 0x26 PICC_REQALL = 0x52 PICC_ANTICOLL = 0x93 PICC_SELECTTAG = 0x93 PICC_AUTHENT1A = 0x60 PICC_AUTHENT1B = 0x61 PICC_READ = 0x30 PICC_WRITE = 0xA0 PICC_DECREMENT = 0xC0 PICC_INCREMENT = 0xC1 PICC_RESTORE = 0xC2 PICC_TRANSFER = 0xB0 PICC_HALT = 0x50 )
const ( MI_OK = 0 MI_NOTAGERR = 1 MI_ERR = 2 MI_ERR_CRC = 3 MI_ERR_CRC_LEN = 4 MI_ERR_SEND = 5 MI_ERR_REQUEST = 6 MI_ERR_TIMEOUT = 7 // Status2Reg register MFCrypto1On bit not set // indicates that the MIFARE Crypto1 unit is switched on and // therefore all data communication with the card is encrypted MI_ERR_CRYPTO = 8 )
const ( Reserved00 = 0x00 CommandReg = 0x01 ComIEnReg = 0x02 DivlEnReg = 0x03 ComIrqReg = 0x04 DivIrqReg = 0x05 ErrorReg = 0x06 Status1Reg = 0x07 Status2Reg = 0x08 FIFODataReg = 0x09 FIFOLevelReg = 0x0A WaterLevelReg = 0x0B ControlReg = 0x0C BitFramingReg = 0x0D CollReg = 0x0E Reserved01 = 0x0F Reserved10 = 0x10 ModeReg = 0x11 TxModeReg = 0x12 RxModeReg = 0x13 TxControlReg = 0x14 TxAutoReg = 0x15 TxSelReg = 0x16 RxSelReg = 0x17 RxThresholdReg = 0x18 DemodReg = 0x19 Reserved11 = 0x1A Reserved12 = 0x1B MifareReg = 0x1C Reserved13 = 0x1D Reserved14 = 0x1E SerialSpeedReg = 0x1F Reserved20 = 0x20 CRCResultRegM = 0x21 CRCResultRegL = 0x22 Reserved21 = 0x23 ModWidthReg = 0x24 Reserved22 = 0x25 RFCfgReg = 0x26 GsNReg = 0x27 CWGsPReg = 0x28 ModGsPReg = 0x29 TModeReg = 0x2A TPrescalerReg = 0x2B TReloadRegH = 0x2C TReloadRegL = 0x2D TCounterValueRegH = 0x2E TCounterValueRegL = 0x2F Reserved30 = 0x30 TestSel1Reg = 0x31 TestSel2Reg = 0x32 TestPinEnReg = 0x33 TestPinValueReg = 0x34 TestBusReg = 0x35 AutoTestReg = 0x36 VersionReg = 0x37 AnalogTestReg = 0x38 TestDAC1Reg = 0x39 TestDAC2Reg = 0x3A TestADCReg = 0x3B Reserved31 = 0x3C Reserved32 = 0x3D Reserved33 = 0x3E Reserved34 = 0x3F )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mfrc522 ¶
type Mfrc522 struct {
// contains filtered or unexported fields
}
Mfrc522 : instance Mfrc522 device struct
func (*Mfrc522) Auth ¶
Auth : Auth This command manages MIFARE authentication to enable a secure communication to any MIFARE Mini, MIFARE 1K and MIFARE 4K card. The following data is written to the FIFO buffer before the command can be activated • Authentication command code (60h, 61h) • Block address • Sector key byte 0 • Sector key byte 1 • Sector key byte 2 • Sector key byte 3 • Sector key byte 4 • Sector key byte 5 • Card serial number byte 0 • Card serial number byte 1 • Card serial number byte 2 • Card serial number byte 3
func (*Mfrc522) ClearBitMask ¶
ClearBitMask : reset bit mask
func (*Mfrc522) DumpClassic1K ¶
DumpClassic1K : handler for DumpClassic1K
func (*Mfrc522) RequestIdle ¶
RequestIdle : RequestIdle Output tagType 0x4400 = Mifare_UltraLight 0x0400 = Mifare_One(S50) 0x0200 = Mifare_One(S70) 0x0800 = Mifare_Pro(X) 0x4403 = Mifare_DESFire
func (*Mfrc522) SetBitMask ¶
SetBitMask : reset bit mask
func (*Mfrc522) WaitForTag ¶
WaitForTag : handler for WaitForTag