PN532 NFC/RFID Controller

See Application::make_pn532_component().

API Reference

class PN532Component : public PollingComponent, public SPIDevice

Public Functions

PN532Component(SPIComponent *parent, GPIOPin *cs, uint32_t update_interval = 1000)
void setup()

Where the component’s initialization should happen.

Analogous to Arduino’s setup(). This method is guaranteed to only be called once. Defaults to doing nothing.

void dump_config()
void update()
float get_setup_priority() const

priority of setup().

higher -> executed earlier

Defaults to 0.

The setup priority of this component

void loop()

This method will be called repeatedly.

Analogous to Arduino’s loop(). setup() is guaranteed to be called before this. Defaults to doing nothing.

PN532BinarySensor *make_tag(const std::string &name, const std::vector<uint8_t> &uid)
PN532Trigger *make_trigger()

Protected Types

enum PN532Error


NONE = 0

Protected Functions

bool msb_first()
void pn532_write_command_(uint8_t len)
bool pn532_write_command_check_ack_(uint8_t len, bool ignore = false)
void pn532_read_data_(uint8_t len)
bool is_ready()
bool read_ack()

Protected Attributes

uint8_t buffer_[32]
bool requested_read_ = {false}
std::vector<PN532BinarySensor *> binary_sensors_
std::vector<PN532Trigger *> triggers_
std::vector<uint8_t> last_uid_
binary_sensor::PN532Component::PN532Error NONE
class PN532BinarySensor : public binary_sensor::BinarySensor

Public Functions

PN532BinarySensor(const std::string &name, const std::vector<uint8_t> &uid, uint32_t update_interval)
bool process(uint8_t *data, uint8_t len)

Protected Attributes

std::vector<uint8_t> uid_