Class pn532::esp32::hsu_channel

Inheritance Relationships

Base Type

Class Documentation

class hsu_channel : public pn532::channel

Implementation of HSU channel protocol for PN532 over ESP32’s I2C driver (UM0701-02 §6.2.3).

Public Functions

virtual bool wake() override

Sends the byte sequence 55 55 55.

hsu_channel(uart_port_t port, uart_config_t config, gpio_num_t to_device_tx, gpio_num_t to_device_rx)

Construct an HSU channel for a PN532 with the given settings.

Note

In case of invalid port or configuration, an error message is printed, but the class is correctly constructed. It will simply always fail to send and receive anything (and may clog your output with error messages).

Parameters:
  • port – Communication port for the HSU channel. This is passed as-is to the UART driver.

  • config – Configuration for the HSU channel. This is passed as-is to the UART driver.

  • to_device_tx – The pin connected to the TX line on the PN532

  • to_device_rx – The pin connected to the RX line on the PN532

~hsu_channel() override

Deletes the allocated UART driver.

Protected Functions

virtual result raw_send(mlab::range<bin_data::const_iterator> buffer, ms timeout) override

Wraps around uart_write_bytes.

virtual result raw_receive(mlab::range<bin_data::iterator> buffer, ms timeout) override

Wraps around uart_read_bytes.

inline virtual comm_rx_mode raw_receive_mode() const override
Returns:

For hsu_channel, this is always comm_rx_mode::stream.

virtual bool on_send_prepare(ms timeout) override

Flushes the RX buffer via uart_flush_input.