.
|
Public Member Functions |
| | SM130 () |
| | Constructor.
|
| void | reset () |
| | Hardware or software reset of the SM130 module.
|
| const char * | getFirmwareVersion () |
| | Returns a null-terminated string with the firmware version of the SM130 module.
|
| boolean | available () |
| | Returns true if a response packet is available.
|
| byte * | getRawData () |
| | Returns a pointer to the response packet.
|
| byte | getCommand () |
| | Returns the last executed command.
|
| byte | getPacketLength () |
| | Returns the packet length, excluding checksum.
|
| byte | getCheckSum () |
| | Returns the checksum.
|
| byte * | getPayload () |
| | Returns a pointer to the packet payload.
|
| byte | getBlockNumber () |
| | Returns the block number for read/write commands.
|
| byte * | getBlock () |
| | Returns a pointer to the read block (with a length of 16 bytes).
|
| byte * | getTagNumber () |
| | Returns the tag's serial number as a byte array.
|
| byte | getTagLength () |
| | Returns the length of the tag's serial number obtained by getTagNumer().
|
| const char * | getTagString () |
| | Returns the tag's serial number as a hexadecimal null-terminated string.
|
| byte | getTagType () |
| | Returns the tag type (SM130::MIFARE_XX).
|
| const char * | getTagName () |
| | Returns the tag type as a null-terminated string.
|
| char | getErrorCode () |
| | Returns the error code of the last executed command.
|
| const char * | getErrorMessage () |
| | Returns a human-readable error message corresponding to the error code.
|
| byte | getAntennaPower () |
| | Returns the antenna power level (0 or 1).
|
| void | seekTag () |
| | Sends a SEEK_TAG command.
|
| void | selectTag () |
| | Sends a SELECT_TAG command.
|
| void | haltTag () |
| | Sends a HALT_TAG command.
|
| void | setAntennaPower (byte level) |
| | Set antenna power (on/off).
|
| void | sleep () |
| | Sends a SLEEP command (can only wake-up with hardware reset!).
|
| void | writeBlock (byte block, const char *message) |
| | Writes a null-terminated string of maximum 15 characters.
|
| void | writeFourByteBlock (byte block, const char *message) |
| | Writes a null-terminated string of maximum 3 characters to a Mifare Ultralight.
|
| void | authenticate (byte block) |
| | Sends a AUTHENTICATE command using the transport key.
|
| void | authenticate (byte block, byte keyType, byte key[6]) |
| | Sends a AUTHENTICATE command using the specified key.
|
| void | readBlock (byte block) |
| | Reads a 16-byte block.
|
Data Fields |
| boolean | debug |
| | debug mode, prints all I2C communication to Serial port
|
| byte | address |
| | I2C address (default 0x42).
|
| byte | pinRESET |
| | RESET pin (default 3).
|
| byte | pinDREADY |
| | DREADY pin (default 4).
|
Static Public Attributes |
| static const int | VERSION = 1 |
| | version of this library
|
| static const byte | MIFARE_ULTRALIGHT = 1 |
| static const byte | MIFARE_1K = 2 |
| static const byte | MIFARE_4K = 3 |
| static const byte | CMD_RESET = 0x80 |
| static const byte | CMD_VERSION = 0x81 |
| static const byte | CMD_SEEK_TAG = 0x82 |
| static const byte | CMD_SELECT_TAG = 0x83 |
| static const byte | CMD_AUTHENTICATE = 0x85 |
| static const byte | CMD_READ16 = 0x86 |
| static const byte | CMD_READ_VALUE = 0x87 |
| static const byte | CMD_WRITE16 = 0x89 |
| static const byte | CMD_WRITE_VALUE = 0x8a |
| static const byte | CMD_WRITE4 = 0x8b |
| static const byte | CMD_WRITE_KEY = 0x8c |
| static const byte | CMD_INC_VALUE = 0x8d |
| static const byte | CMD_DEC_VALUE = 0x8e |
| static const byte | CMD_ANTENNA_POWER = 0x90 |
| static const byte | CMD_READ_PORT = 0x91 |
| static const byte | CMD_WRITE_PORT = 0x92 |
| static const byte | CMD_HALT_TAG = 0x93 |
| static const byte | CMD_SET_BAUD = 0x94 |
| static const byte | CMD_SLEEP = 0x96 |
.
Hardware or software reset of the SM130 module.
Reset the SM130 module.
This function should be called in setup(). It initializes the IO pins and issues a hardware or software reset, depending on the definition of pinRESET. After reset, a HALT_TAG command is issued to terminate the automatic SEEK mode.
Wire.begin() should also be called in setup(), and Wire.h should be included.
If pinRESET has the value 0xff (-1), software reset over I2C will be used. If pinDREADY has the value 0xff (-1), the SM130 will be polled over I2C while in SEEK mode, otherwise the DREADY pin will be polled in SEEK mode. For other commands, response polling is always over I2C.
Definition at line 65 of file SM130.cpp.