Skip to content

Commit 7345108

Browse files
committed
Some tweaks
1 parent 1d46503 commit 7345108

7 files changed

Lines changed: 40 additions & 28 deletions

File tree

examples/UnitUnified/Dump/main/Dump.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,9 @@ void loop()
6363
if (unit.detectDevice()) {
6464
UID uid{};
6565
if (unit.activateDevice(uid)) {
66+
M5.Speaker.tone(1000, 20);
6667
M5_LOGI("UID:%s %s", uid.uidAsString().c_str(), uid.typeAsString().c_str());
67-
//
68-
// Use any API...
69-
//
68+
unit.dumpDevice(uid); // Using defaukt keyA if Classic
7069
unit.deactivateDevice();
7170
}
7271
}

examples/UnitUnified/ValueBlock/main/ValueBlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void loop()
209209
if (unit.activateDevice(uid)) {
210210
if (uid.isClassic()) {
211211
M5_LOGI("Restore");
212-
M5.Speaker.tone(1000, 20);
212+
M5.Speaker.tone(2000, 20);
213213
M5_LOGI("UID:%s %s", uid.uidAsString().c_str(), uid.typeAsString().c_str());
214214

215215
uint8_t block = uid.type == Type::MIFARE_Classic_4K ? 128 : 44;

src/rfid/nfc/ndef.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
*/
66
/*!
77
@file ndef.cpp
8-
@brief NFC related
9-
@warning Only support NFC-A Type-2
8+
@brief NDEF related
109
*/
1110

1211
#include "ndef.hpp"

src/rfid/nfc/ndef.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
namespace m5 {
1717
namespace rfid {
1818
namespace nfc {
19+
/*!
20+
@namespace ndef
21+
@brief For NDEF
22+
*/
1923
namespace ndef {
2024

2125
/*!

src/rfid/nfc/nfc.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@
1818
namespace m5 {
1919
namespace rfid {
2020
/*!
21-
@namespce nfc
22-
@brief namespace for NFC
21+
@namespace nfc
22+
@brief For NFC
2323
*/
2424
namespace nfc {
2525
} // namespace nfc
26-
2726
} // namespace rfid
2827
} // namespace m5
2928
#endif

src/rfid/rfid.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,20 @@ enum class Type : uint8_t {
7575
MIFARE_Classic_4K, //!< Also known as MIFARE Standard 4K
7676
MIFARE_UltraLight, //!< MIFARE Ultralight
7777
MIFARE_UltraLightC, //!< MIFARE UltralightC
78-
MIFARE_Plus_2K, //!< MIFARE Plus 2K
79-
MIFARE_Plus_4K, //!< MIFARE Plus 4K
80-
MIFARE_DESFire_2K, //!< MIFARE DESFire 2K
81-
MIFARE_DESFire_4K, //!< MIFARE DESFire 4K
82-
MIFARE_DESFire_8K, //!< MIFARE DESFire 8K
78+
MIFARE_Plus_2K, //!< MIFARE Plus 2K [Not supported]
79+
MIFARE_Plus_4K, //!< MIFARE Plus 4K [Not supported]
80+
MIFARE_DESFire_2K, //!< MIFARE DESFire 2K [Not supported]
81+
MIFARE_DESFire_4K, //!< MIFARE DESFire 4K [Not supported]
82+
MIFARE_DESFire_8K, //!< MIFARE DESFire 8K [Not supported]
8383
NTAG_203, //!< NATG 203
8484
NTAG_210u, //!< NTAG 210μ
8585
NTAG_210, //!< NTAG 210
8686
NTAG_212, //!< NTAG 212
8787
NTAG_213, //!< NTAG 213
8888
NTAG_215, //!< NTAG 215
8989
NTAG_216, //!< NTAG 216
90-
ISO_14443_4, //!< PICC compliant with ISO/IEC 14443-4
91-
ISO_18092, //!< PICC compliant with ISO/IEC 18092 (NFC)
90+
ISO_14443_4, //!< PICC compliant with ISO/IEC 14443-4 [Not supported]
91+
ISO_18092, //!< PICC compliant with ISO/IEC 18092 (NFC) [Not supported]
9292
NotCompleted = 0xFF, //!< SAK indicates UID is not complete
9393
};
9494

src/unit/unit_MFRC522.hpp

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ namespace mfrc522 {
2626
@brief PCD command
2727
*/
2828
enum class Command : uint8_t {
29-
Idle, //!< no action, cancels current command execution
30-
Mem, //!< stores 25 bytes into the internal buffer
31-
GenerateRandomID, //!< generates a 10-byte random ID number
32-
CalcCRC, //!< activates the CRC coprocessor or performs a self test
33-
Transmit, //!< transmits data from the FIFO buffer
34-
NoCmdChange = 0x07, //!< no command change
35-
Receive, //!< activates the receiver circuits
36-
Transceive = 0x0C, //!< transmits data from FIFO buffer to antenna and automatically activates the receiver after
29+
Idle, //!< No action, cancels current command execution
30+
Mem, //!< Stores 25 bytes into the internal buffer
31+
GenerateRandomID, //!< Generates a 10-byte random ID number
32+
CalcCRC, //!< Activates the CRC coprocessor or performs a self test
33+
Transmit, //!< Transmits data from the FIFO buffer
34+
NoCmdChange = 0x07, //!< No command change
35+
Receive, //!< Activates the receiver circuits
36+
Transceive = 0x0C, //!< Transmits data from FIFO buffer to antenna and automatically activates the receiver after
3737
//!< transmission
38-
MFAuthent = 0x0E, //!< performs the MIFARE standard authentication as a reader
39-
SoftReset, //!< performs the MIFARE standard authentication as a reader
38+
MFAuthent = 0x0E, //!< Performs the MIFARE standard authentication as a reader
39+
SoftReset, //!< Resets the MFRC522
4040
};
4141

4242
/*!
@@ -61,7 +61,7 @@ enum class ReceiverGain : uint8_t {
6161
enum class Error : uint8_t {
6262
OCCUR_COLLISION, //!< Ccollision occurs
6363
UID_NOT_COLMPLETED, //!< UID is not yet complete
64-
ARGUMENT = 0x80, //!< Error caused by arguments
64+
ARGUMENT = 0x80, //!< Error caused by arguments (0x80)
6565
COMMUNICATION, //!< Error in communication (0x81)
6666
REGISTER, //!< Error by error register value (0x82)
6767
TIMEOUT, //!< Timeout occurs (0x83)
@@ -84,6 +84,10 @@ class UnitMFRC522 : public Component {
8484
M5_UNIT_COMPONENT_HPP_BUILDER(UnitMFRC522, 0x28);
8585

8686
public:
87+
/*!
88+
@brief API return value
89+
@note The user can treat it as if it were a bool type
90+
*/
8791
using result_t = m5::stl::expected<void, mfrc522::Error>;
8892

8993
/*!
@@ -192,11 +196,16 @@ class UnitMFRC522 : public Component {
192196
bool writeReceiverGain(const mfrc522::ReceiverGain gain);
193197
///@}
194198

199+
///@note Timer settings
195200
///@name TPrescale
196201
///@{
202+
//! @brief Read the TPrescale
197203
bool readTPrescale(uint16_t& tprescale);
204+
//! @brief Read the TPrescale
198205
bool readTPrescale(float& tprescale);
206+
//! @brief Write the TPrescale
199207
bool writeTPrescale(const uint16_t tprescale);
208+
//! @brief Write the TPrescale
200209
bool writeTPrescale(const float tprescale);
201210
///@}
202211

@@ -242,14 +251,16 @@ class UnitMFRC522 : public Component {
242251
@note Device status changes from READY to ACTIVE
243252
@note Device status changes from READY* to ACTIVE*
244253
@note ISO14443-4 processing can be performed on devices in ACTIVE state
254+
@warning Whenever an operation on an activated device is no longer required, it must be deactivated
245255
*/
246256
result_t activateDevice(UID& uid);
247257
/*!
248258
@brief Deactivate device
249-
@param uid target UID
259+
@param uid Target UID
250260
@return True if successful
251261
@note Send HLTA command and stop crypt1
252262
@note Device status changes from ACTIVE to HALT
263+
@note Device status changes from ACTIVE* to HALT
253264
*/
254265
result_t deactivateDevice();
255266
///@}

0 commit comments

Comments
 (0)