15 ESP_LOGW(TAG,
"read_nfcc_() timeout waiting for IRQ");
16 return nfc::STATUS_FAILED;
32 if (this->
wait_for_irq_(pn71xx::NFCC_IRQ_CLEAR_TIMEOUT,
false) != nfc::STATUS_OK) {
33 ESP_LOGVV(TAG,
"IRQ still active after read; another message is pending");
35 return nfc::STATUS_OK;
39 const auto encoded = tx.
encode();
43 const bool ready =
status == 0xFF;
49 ESP_LOGV(TAG,
"NFCC not ready for write (0x%02X)",
status);
51 return ready ? nfc::STATUS_OK : nfc::STATUS_FAILED;
55 PN7160::dump_config();
56 LOG_PIN(
" CS Pin: ", this->
cs_);
One NCI packet, held in a fixed buffer so building and reading messages never allocates.
uint8_t get_payload_size(bool recompute=false)
std::span< const uint8_t > encode()
Stamps the payload length into the header and returns the packet ready to send.
void set_payload_size(uint8_t size)
Sets the packet size to the header plus size payload bytes, for a bus driver filling the buffer direc...
uint8_t read_nfcc(nfc::NciMessage &rx, uint16_t timeout) override
uint8_t write_nfcc(nfc::NciMessage &tx) override
void dump_config() override
uint8_t wait_for_irq_(uint16_t timeout=NFCC_DEFAULT_TIMEOUT, bool pin_state=true)
void spi_setup() override
void write_byte(uint8_t data)
uint8_t transfer_byte(uint8_t data)
void write_array(const uint8_t *data, size_t length)
void read_array(uint8_t *data, size_t length)
ESPHOME_LOG_TAG(TAG, "pn7160_spi")