M5Unit-NFC 0.0.3 git rev:59f5362
Loading...
Searching...
No Matches
nfc.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3 *
4 * SPDX-License-Identifier: MIT
5 */
10#ifndef M5_UNIT_UNIFIED_NFC_NFC_NFC_HPP
11#define M5_UNIT_UNIFIED_NFC_NFC_NFC_HPP
12
13#include <cstdint>
14#include "manufacturer_id.hpp"
15
16namespace m5 {
21namespace nfc {
22
27enum class NFC : uint8_t {
28 None,
29 A,
30 B,
31 F,
32 V
33};
34
39enum class NFCForumTag : uint8_t {
40 None,
41 Type1,
42 Type2,
43 Type3,
44 Type4,
45 Type5,
46};
47
52enum class Bitrate : uint8_t {
53 Bps106K,
54 Bps212K,
55 Bps424K,
56 Bps848K,
57 Invalid = 0xFF,
58};
59
62using file_system_feature_t = uint8_t;
68
69inline bool is_file_system_memory(const file_system_feature_t fsf)
70{
71 return (fsf & FILE_SYSTEM_FLAT_MEMORY);
72}
73
74inline bool is_file_system_file(const file_system_feature_t fsf)
75{
76 return (fsf & (FILE_SYSTEM_ISO7816_4 | FILE_SYSTEM_DESFIRE | FILE_SYSTEM_DESFIRE_LIGHT));
77}
78
79inline bool is_file_system_ISO(const file_system_feature_t fsf)
80{
81 return (fsf & FILE_SYSTEM_ISO7816_4);
82}
83
84inline bool is_file_system_desfire(const file_system_feature_t fsf)
85{
86 return (fsf & (FILE_SYSTEM_DESFIRE | FILE_SYSTEM_DESFIRE_LIGHT));
87}
88
89inline bool is_file_system_desfire_normal(const file_system_feature_t fsf)
90{
91 return (fsf & FILE_SYSTEM_DESFIRE);
92}
93
94inline bool is_file_system_desfire_light(const file_system_feature_t fsf)
95{
96 return (fsf & FILE_SYSTEM_DESFIRE_LIGHT);
97}
98
99} // namespace nfc
100} // namespace m5
101
102// #include "a/nfca.hpp"
103// #include "b/nfcb.hpp"
104// #include "f/nfcf.hpp"
105// #include "v/nfcv.hpp"
106// #include "ndef/ndef.hpp"
107#endif
Manufacturer ID (UID[0]) definitions for ISO/IEC 14443-3.
Top level namespace of M5stack.
NFC related definitions.
uint8_t file_system_feature_t
Alias for file_system_feature_t.
Definition nfc.hpp:62
constexpr file_system_feature_t FILE_SYSTEM_FLAT_MEMORY
Block/Page base R/W (flat memory)
Definition nfc.hpp:63
constexpr file_system_feature_t FILE_SYSTEM_DESFIRE
MIFARE DESFire (multi file base)
Definition nfc.hpp:65
NFC
NFC type.
Definition nfc.hpp:27
Bitrate
Communication bitrate.
Definition nfc.hpp:52
constexpr file_system_feature_t FILE_SYSTEM_ISO7816_4
ISO 7816-4 (multi file base)
Definition nfc.hpp:64
constexpr file_system_feature_t FILE_SYSTEM_DESFIRE_LIGHT
MIFARE DESFire light (single file base)
Definition nfc.hpp:66
NFCForumTag
NFC Forum Tag Type.
Definition nfc.hpp:39
@ Type4
Type 4 (NFC-A, NFC-B)
@ Type1
Type 1 (NFC-A)
@ Type3
Type 3 (NFC-F)
@ Type5
Type 5 ISO/IEC 15693.
@ Type2
Type 2 (NFC-A)