MIFARE definitions.
More...
#include "mifare.hpp"
#include <cstring>
|
| namespace | m5 |
| | Top level namespace of M5stack.
|
| |
|
| bool | m5::nfc::a::mifare::classic::decode_value_block (int32_t &value, uint8_t &addr, const uint8_t buf[16]) |
| | Decode the value of value block.
|
| |
| const uint8_t * | m5::nfc::a::mifare::classic::encode_value_block (uint8_t buf[16], const int32_t value, const uint8_t addr) |
| | Encode the value of value block.
|
| |
| bool | m5::nfc::a::mifare::classic::encode_access_bits (uint8_t abits[3], const uint8_t p0, const uint8_t p1, const uint8_t p2, const uint8_t p3) |
| | Encode access bits from permissions.
|
| |
| bool | m5::nfc::a::mifare::classic::decode_access_bits (uint8_t permissions[4], const uint8_t ab0, const uint8_t ab1, const uint8_t ab2) |
| | Decode access bits to permissions.
|
| |
◆ decode_access_bits()
| bool m5::nfc::a::mifare::classic::decode_access_bits |
( |
uint8_t | permissions[4], |
|
|
const uint8_t | ab0, |
|
|
const uint8_t | ab1, |
|
|
const uint8_t | ab2 ) |
Decode access bits to permissions.
- Parameters
-
| permissions[4] | Output buffer at least 4 bytes |
| ab0 | 1st byte of the access bits |
| ab1 | 2nd byte of the access bits |
| ab2 | 3rd byte of the access bits |
- Returns
- True if successful
- Note
- permissions[0] block 0
-
permissions[1] block 1
-
permissions[2] block 2
-
permissions[3] sector trailer
- Warning
- Return values should always be checked
◆ decode_value_block()
| bool m5::nfc::a::mifare::classic::decode_value_block |
( |
int32_t & | value, |
|
|
uint8_t & | addr, |
|
|
const uint8_t | buf[16] ) |
Decode the value of value block.
- Parameters
-
| [out] | value | Value |
| [out] | addr | Block address |
| buf | Data of block(16 bytes) |
- Returns
- True if successful
◆ encode_access_bits()
| bool m5::nfc::a::mifare::classic::encode_access_bits |
( |
uint8_t | abits[3], |
|
|
const uint8_t | p0, |
|
|
const uint8_t | p1, |
|
|
const uint8_t | p2, |
|
|
const uint8_t | p3 ) |
Encode access bits from permissions.
- Parameters
-
| abits[3] | Output buffer at least 3 bytes |
| p0 | permissions for block 0 |
| p1 | permissions for block 1 |
| p2 | permissions for block 2 |
| p3 | permissions for sector tarailer |
- Returns
- True if successful
- Warning
- Return values should always be checked
-
Writing incorrect access bits may make the sector inaccessible!
◆ encode_value_block()
| const uint8_t * m5::nfc::a::mifare::classic::encode_value_block |
( |
uint8_t | buf[16], |
|
|
const int32_t | value, |
|
|
const uint8_t | addr ) |
Encode the value of value block.
- Parameters
-
| [out] | buf | Output buffer at least 16 bytes |
| value | Value |
| addr | Block address |
- Returns
- Encoded buffer