M5Unit-NFC 0.0.3 git rev:59f5362
Loading...
Searching...
No Matches
nfcv.hpp File Reference

NFC-V definitions. More...

#include "nfc/nfc.hpp"
#include <cstdint>
#include <string>
#include <cstring>
#include <vector>

Go to the source code of this file.

Classes

struct  m5::nfc::v::PICC
 PICC for NFC-V. More...
 

Namespaces

namespace  m5
 Top level namespace of M5stack.
 
namespace  v
 NFC-V definitions.
 

Enumerations

enum class  m5::nfc::v::Type : uint8_t {
  Unknown , NXP_ICODE_SLI , NXP_ICODE_SLIX , NXP_ICODE_SLIX_2 ,
  NXP , TI_TAGIT_2048 , TI_TAGIT_HF_I , TI_TAGIT_HF_I_Plus ,
  TI_TAGIT_HF_I_Pro , TI , ST_LRI , ST_ST25V ,
  ST_ST25DV , ST , Fujitsu_FRAM , Fujitsu ,
  Unclassified
}
 Type of the PICC. More...
 
enum class  m5::nfc::v::ModulationMode : uint8_t { OneOf4 , OneOf256 }
 
enum class  m5::nfc::v::Command : uint8_t {
  Inventory = 0x01 , StayQuiet = 0x02 , Select = 0x25 , ResetToReady = 0x26 ,
  GetSystemInformaion = 0x2B , ExtendedGetSystemInfo = 0x3B , ReadSingleBlock = 0x20 , ExtendedReadSingleBlock = 0x30 ,
  WriteSingleBlock = 0x21 , ExtendedWriteSingleBlock = 0x31
}
 ISO/IEC 15693 Command. More...
 

Functions

m5::nfc::NFCForumTag m5::nfc::v::get_nfc_forum_tag_type (const Type t)
 Get NFC Forum Tag Type from PICC type.
 
bool m5::nfc::v::operator== (const PICC &a, const PICC &b)
 Equal?
 
bool m5::nfc::v::operator!= (const PICC &a, const PICC &b)
 Not equal?
 
Type m5::nfc::v::identify_type (const PICC &picc)
 Identify the type from Manufacturer Code, IC Identifier, IC Reference.
 
uint32_t m5::nfc::v::encode_VCD (std::vector< uint8_t > &out, const ModulationMode mode, const uint8_t *buffer, const uint32_t length, const bool high_rate=true, const bool add_crc=true)
 Encode to VCD frame.
 
bool m5::nfc::v::decode_VICC (std::vector< uint8_t > &out, const uint8_t *buffer, const uint32_t length, const uint32_t ignore_bits=16)
 Decode from VICC frame.
 

Variables

Request flags
const uint8_t m5::nfc::v::option_flag {0x40}
 
const uint8_t m5::nfc::v::address_flag {0x20}
 
const uint8_t m5::nfc::v::select_flag {0x10}
 
const uint8_t m5::nfc::v::inventory_flag {0x04}
 
const uint8_t m5::nfc::v::data_rate_flag {0x02}
 
const uint8_t m5::nfc::v::subcarrior_flag {0x01}
 
const uint8_t m5::nfc::v::nb_slots_flag {0x20}
 
const uint8_t m5::nfc::v::AFI_flag {0x10}
 
constexpr uint8_t m5::nfc::v::MAX_BLOCK_SIZE {32}
 
Timeout
constexpr uint32_t m5::nfc::v::TIMEOUT_INVENTORY {16}
 
constexpr uint32_t m5::nfc::v::TIMEOUT_STAY_QUIET {16}
 
constexpr uint32_t m5::nfc::v::TIMEOUT_SELECT {16}
 
constexpr uint32_t m5::nfc::v::TIMEOUT_RESET_TO_READY {16}
 
constexpr uint32_t m5::nfc::v::TIMEOUT_GET_SYSTEM_INFORMATION {20}
 
constexpr uint32_t m5::nfc::v::TIMEOUT_READ_SINGLE_BLOCK {20}
 
constexpr uint32_t m5::nfc::v::TIMEOUT_WRITE_SINGLE_BLOCK {30}
 

Detailed Description

NFC-V definitions.

Enumeration Type Documentation

◆ Command

enum class m5::nfc::v::Command : uint8_t
strong

ISO/IEC 15693 Command.

Enumerator
Inventory 

IVENTORY.

StayQuiet 

STAY QUIET.

Select 

SELECT.

ResetToReady 

RESET TO READY.

GetSystemInformaion 

GET SYSTEM INFORMATION.

ExtendedGetSystemInfo 

EXTENDED GET SYSTEM INFORMATION.

ReadSingleBlock 

READ SINGLE BLOCK.

ExtendedReadSingleBlock 

EXTENDED READ SINGLE BLOCK.

WriteSingleBlock 

WRITE SINGLE BLOCK.

ExtendedWriteSingleBlock 

EXTENDED WRITE SINGLE BLOCK.

◆ ModulationMode

enum class m5::nfc::v::ModulationMode : uint8_t
strong
Enumerator
OneOf4 

1 out of 4 pulse-position modulation

OneOf256 

1 out of 256 pulse-position modulation

◆ Type

enum class m5::nfc::v::Type : uint8_t
strong

Type of the PICC.

Enumerator
Unknown 

Unknown type.

NXP_ICODE_SLI 

ICODE SLI.

NXP_ICODE_SLIX 

ICODE SLIX.

NXP_ICODE_SLIX_2 

ICODE SLIX2.

NXP 

NXP (Unclassified)

TI_TAGIT_2048 

Tag-it 2048.

TI_TAGIT_HF_I 

Tag-it HF-I Standard.

TI_TAGIT_HF_I_Plus 

Tag-it HF-I Plus.

TI_TAGIT_HF_I_Pro 

Tag-it HF-I Pro.

TI 

TI (Unclassified)

ST_LRI 

ST LRI.

ST_ST25V 

ST25V.

ST_ST25DV 

ST25DV.

ST 

ST (Unclassified)

Fujitsu_FRAM 

FRAM.

Fujitsu 

Fujitsu (Unclassified)

Unclassified 

Unclassified.

Function Documentation

◆ decode_VICC()

bool m5::nfc::v::decode_VICC ( std::vector< uint8_t > & out,
const uint8_t * buffer,
const uint32_t length,
const uint32_t ignore_bits = 16 )

Decode from VICC frame.

Parameters
outOutput buffer
bufferInput buffer
lengthInput buffer length
Returns
True if successful

◆ encode_VCD()

uint32_t m5::nfc::v::encode_VCD ( std::vector< uint8_t > & out,
const ModulationMode mode,
const uint8_t * buffer,
const uint32_t length,
const bool high_rate = true,
const bool add_crc = true )

Encode to VCD frame.

Parameters
outOutput buffer
modeModulationMode
bufferInput buffer (allow nullptr )
lengthInput buffer length (allow 0)
high_rateHigh data rate if true
add_crcAppend CRC16 if true
Returns
Encoded size in bytes, or 0 on error
Note
Make EOF only if buffer is nullptr and length is 0

◆ identify_type()

Type m5::nfc::v::identify_type ( const PICC & picc)

Identify the type from Manufacturer Code, IC Identifier, IC Reference.

Returns
Type
Warning
Not all tags can be identified
If identification is impossible, Unclassified is returned