|
@@ -3,7 +3,6 @@
|
|
|
#include "bit_buffer.h"
|
|
#include "bit_buffer.h"
|
|
|
#include "core/log.h"
|
|
#include "core/log.h"
|
|
|
#include <nfc/protocols/iso14443_3a/iso14443_3a_poller.h>
|
|
#include <nfc/protocols/iso14443_3a/iso14443_3a_poller.h>
|
|
|
-#include <nfc/helpers/nfc_util.h>
|
|
|
|
|
|
|
|
|
|
#define GEN4_CMD_PREFIX (0xCF)
|
|
#define GEN4_CMD_PREFIX (0xCF)
|
|
|
|
|
|
|
@@ -37,7 +36,7 @@ Gen4PollerError
|
|
|
|
|
|
|
|
do {
|
|
do {
|
|
|
uint8_t password_arr[4] = {};
|
|
uint8_t password_arr[4] = {};
|
|
|
- nfc_util_num2bytes(password, COUNT_OF(password_arr), password_arr);
|
|
|
|
|
|
|
+ bit_lib_num_to_bytes_be(password, COUNT_OF(password_arr), password_arr);
|
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_PREFIX);
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_PREFIX);
|
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_GET_CFG);
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_GET_CFG);
|
|
@@ -69,7 +68,7 @@ Gen4PollerError
|
|
|
|
|
|
|
|
do {
|
|
do {
|
|
|
uint8_t password_arr[4] = {};
|
|
uint8_t password_arr[4] = {};
|
|
|
- nfc_util_num2bytes(password, COUNT_OF(password_arr), password_arr);
|
|
|
|
|
|
|
+ bit_lib_num_to_bytes_be(password, COUNT_OF(password_arr), password_arr);
|
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_PREFIX);
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_PREFIX);
|
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_GET_REVISION);
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_GET_REVISION);
|
|
@@ -104,7 +103,7 @@ Gen4PollerError gen4_poller_set_config(
|
|
|
|
|
|
|
|
do {
|
|
do {
|
|
|
uint8_t password_arr[4] = {};
|
|
uint8_t password_arr[4] = {};
|
|
|
- nfc_util_num2bytes(password, COUNT_OF(password_arr), password_arr);
|
|
|
|
|
|
|
+ bit_lib_num_to_bytes_be(password, COUNT_OF(password_arr), password_arr);
|
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_PREFIX);
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_PREFIX);
|
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
|
uint8_t fuse_config = fuse ? GEN4_CMD_FUSE_CFG : GEN4_CMD_SET_CFG;
|
|
uint8_t fuse_config = fuse ? GEN4_CMD_FUSE_CFG : GEN4_CMD_SET_CFG;
|
|
@@ -139,7 +138,7 @@ Gen4PollerError gen4_poller_write_block(
|
|
|
|
|
|
|
|
do {
|
|
do {
|
|
|
uint8_t password_arr[4] = {};
|
|
uint8_t password_arr[4] = {};
|
|
|
- nfc_util_num2bytes(password, COUNT_OF(password_arr), password_arr);
|
|
|
|
|
|
|
+ bit_lib_num_to_bytes_be(password, COUNT_OF(password_arr), password_arr);
|
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_PREFIX);
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_PREFIX);
|
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_WRITE);
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_WRITE);
|
|
@@ -171,12 +170,12 @@ Gen4PollerError
|
|
|
|
|
|
|
|
do {
|
|
do {
|
|
|
uint8_t password_arr[4] = {};
|
|
uint8_t password_arr[4] = {};
|
|
|
- nfc_util_num2bytes(pwd_current, COUNT_OF(password_arr), password_arr);
|
|
|
|
|
|
|
+ bit_lib_num_to_bytes_be(pwd_current, COUNT_OF(password_arr), password_arr);
|
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_PREFIX);
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_PREFIX);
|
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
|
|
|
|
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_SET_PWD);
|
|
bit_buffer_append_byte(instance->tx_buffer, GEN4_CMD_SET_PWD);
|
|
|
- nfc_util_num2bytes(pwd_new, COUNT_OF(password_arr), password_arr);
|
|
|
|
|
|
|
+ bit_lib_num_to_bytes_be(pwd_new, COUNT_OF(password_arr), password_arr);
|
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
bit_buffer_append_bytes(instance->tx_buffer, password_arr, COUNT_OF(password_arr));
|
|
|
|
|
|
|
|
Iso14443_3aError error = iso14443_3a_poller_send_standard_frame(
|
|
Iso14443_3aError error = iso14443_3a_poller_send_standard_frame(
|