Mistake on this page?
Report an issue in GitHub or email us

NFC EEPROM

NFCEEPROM class hierarchy

An NFC EEPROM can store NDEF messages. You can use a smartphone access the message through the NFC interface the EEPROM exposes.

To use an NFC EEPROM, you must initiate the instance with a driver instance, an event queue and a scratch buffer for NDEF messages.

NFCEEPROM class reference

Data Structures
struct  Delegate
 The NFCEEPROM delegate. More...
Public Member Functions
 NFCEEPROM (NFCEEPROMDriver *driver, events::EventQueue *queue, const Span< uint8_t > &ndef_buffer)
 Construct a NFCEEPROM instance. More...
nfc_err_t initialize ()
 Initialize the NFC EEPROM. More...
void set_delegate (Delegate *delegate)
 Set the delegate that will receive events generated by this EEPROM. More...
virtual void write_ndef_message ()
 Write a NDEF message to the target. More...
virtual void read_ndef_message ()
 Read a NDEF message from the target. More...
virtual void erase_ndef_message ()
 Erase the NDEF message in the target. More...
virtual bool is_ndef_supported () const
 Check if this instance actually supports NDEF content. More...
Protected Member Functions
void parse_ndef_message (const ac_buffer_t &buffer)
 Parse a NDEF message. More...
void build_ndef_message (ac_buffer_builder_t &buffer_builder)
 Build NDEF message. More...
ndef_msg_tndef_message ()
 Retrieve underlying NDEF message instance. More...

NFCEEPROM example

/*
 * Copyright (c) 2006-2020 Arm Limited and affiliates.
 * SPDX-License-Identifier: Apache-2.0
 */
#include "stdint.h"

#include "NFC.h"
#include "events/EventQueue.h"
#include "m24sr_driver.h"

static uint8_t ndef_buffer[1024] = {0};

int main()
{
    mbed::nfc::vendor::ST::M24srDriver m24sr_driver(D14, D15);
    events::EventQueue queue;
    mbed::nfc::NFCEEPROM nfc(&m24sr_driver, &queue, ndef_buffer);

    // ...
    nfc.write_ndef_message();
}

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.