mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-06 04:48:27 +02:00
Fix some NFC/PN532 crashes (#4678)
* Add + use some constants, fix some crashes * Fix PN532 crashes
This commit is contained in:
@@ -14,6 +14,9 @@ namespace nfc {
|
||||
static const uint8_t MIFARE_CLASSIC_BLOCK_SIZE = 16;
|
||||
static const uint8_t MIFARE_CLASSIC_LONG_TLV_SIZE = 4;
|
||||
static const uint8_t MIFARE_CLASSIC_SHORT_TLV_SIZE = 2;
|
||||
static const uint8_t MIFARE_CLASSIC_BLOCKS_PER_SECT_LOW = 4;
|
||||
static const uint8_t MIFARE_CLASSIC_BLOCKS_PER_SECT_HIGH = 16;
|
||||
static const uint8_t MIFARE_CLASSIC_16BLOCK_SECT_START = 32;
|
||||
|
||||
static const uint8_t MIFARE_ULTRALIGHT_PAGE_SIZE = 4;
|
||||
static const uint8_t MIFARE_ULTRALIGHT_READ_SIZE = 4;
|
||||
@@ -30,10 +33,18 @@ static const uint8_t TAG_TYPE_UNKNOWN = 99;
|
||||
// Mifare Commands
|
||||
static const uint8_t MIFARE_CMD_AUTH_A = 0x60;
|
||||
static const uint8_t MIFARE_CMD_AUTH_B = 0x61;
|
||||
static const uint8_t MIFARE_CMD_HALT = 0x50;
|
||||
static const uint8_t MIFARE_CMD_READ = 0x30;
|
||||
static const uint8_t MIFARE_CMD_WRITE = 0xA0;
|
||||
static const uint8_t MIFARE_CMD_WRITE_ULTRALIGHT = 0xA2;
|
||||
|
||||
// Mifare Ack/Nak
|
||||
static const uint8_t MIFARE_CMD_ACK = 0x0A;
|
||||
static const uint8_t MIFARE_CMD_NAK_INVALID_XFER_BUFF_VALID = 0x00;
|
||||
static const uint8_t MIFARE_CMD_NAK_CRC_ERROR_XFER_BUFF_VALID = 0x01;
|
||||
static const uint8_t MIFARE_CMD_NAK_INVALID_XFER_BUFF_INVALID = 0x04;
|
||||
static const uint8_t MIFARE_CMD_NAK_CRC_ERROR_XFER_BUFF_INVALID = 0x05;
|
||||
|
||||
static const char *const MIFARE_CLASSIC = "Mifare Classic";
|
||||
static const char *const NFC_FORUM_TYPE_2 = "NFC Forum Type 2";
|
||||
static const char *const ERROR = "Error";
|
||||
|
||||
Reference in New Issue
Block a user