cryptnox-sdk-esp32 1.0.0
ESP32 SDK for Cryptnox Hardware Wallet
Loading...
Searching...
No Matches
pn532_adapter.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: LGPL-3.0-or-later
3 * Copyright (c) 2026 Cryptnox SA
4 */
5
17
18#ifndef PN532_ADAPTER_H
19#define PN532_ADAPTER_H
20
21#include "CW_NfcTransport.h"
22#include "CW_Logger.h"
23#include "pn532.h"
24
54class PN532Adapter : public CW_NfcTransport {
55public:
66 PN532Adapter(const pn532_config_t &config, CW_Logger &logger);
67
78 bool begin() override;
79
86 bool inListPassiveTarget() override;
87
101 bool sendAPDU(const uint8_t *apdu, uint8_t apduLen,
102 uint8_t *response, uint8_t &responseLen) override;
103
119 bool sendAPDULarge(const uint8_t *apdu, uint8_t apduLen,
120 uint8_t *response, uint16_t &responseLen) override;
121
128 void resetReader() override;
129
138 bool printFirmwareVersion() override;
139
140private:
143 CW_Logger &_logger;
145};
146
147#endif /* PN532_ADAPTER_H */
void resetReader() override
Release the currently selected NFC target.
pn532_t _dev
PN532 device state (owned by this adapter).
bool printFirmwareVersion() override
Query and log the PN532 firmware version.
bool sendAPDU(const uint8_t *apdu, uint8_t apduLen, uint8_t *response, uint8_t &responseLen) override
Exchange one ISO-DEP APDU with the selected card (short response).
PN532Adapter(const pn532_config_t &config, CW_Logger &logger)
Construct the adapter with the given PN532 configuration.
pn532_config_t _config
Stored configuration forwarded to pn532_init.
bool inListPassiveTarget() override
Scan for a passive ISO 14443-A card.
bool begin() override
Initialise the PN532 driver and configure the SAM.
bool sendAPDULarge(const uint8_t *apdu, uint8_t apduLen, uint8_t *response, uint16_t &responseLen) override
Exchange one ISO-DEP APDU with the selected card (large response).
CW_Logger & _logger
Logger reference for printFirmwareVersion.
bool _initialized
true after a successful pn532_init call.
Low-level PN532 NFC controller driver for ESP-IDF (SPI and I²C).
Compile-time configuration passed to pn532_init.
Definition pn532.h:111
Opaque-like runtime state for a single PN532 instance.
Definition pn532.h:141