Location of software examples/snippets for nhs3100

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Location of software examples/snippets for nhs3100

1,170 Views
tillostermann
Contributor II

Hi,

in the nhs3100 SDK file lib_chip_nss/inc/nfc_nss.h is a reference to 3 examples. Here is corresponding nfc_nss_example_1.c example:

 * @par Example 1 - Simple NDEF Message Write
 *  The below example demonstrates how a simple NDEF message can be written to the shared memory which can then be read
 *  by an external reader. Refer to @ref MODS_NSS_NDEFT2T for a simplified API to handle NDEF Messages.
 *  @snippet nfc_nss_example_1.c nfc_nss_example_1

How can I download this example? It seems to be not in the SDK.

BR

0 Kudos
Reply
1 Reply

1,016 Views
driesmoors
NXP Employee
NXP Employee

Hi,

In the NHS3100 SDK 11.2: open docs/firmware.html, then from the left pane navigate to Modules > Modules > ndeft2t. The right pane now shows the full ndeft2t documentation, including the example code snippets:

Example1 - Creating an NDEF Message with a single record of type TEXT

NDEF messages consisting of a single record of types MIME, AAR and URI can be created in a similar way as given in this example.

uint8_t instanceBuffer[NDEFT2T_INSTANCE_SIZE] __attribute__((aligned (4)));
uint8_t messageBuffer[NFC_SHARED_MEM_BYTE_SIZE ] __attribute__((aligned (4)));
uint8_t locale[] = "en";
uint8_t payloadText[] = "Hello World";
/* Ensure initialization of the NFC HW block is done first. This needs to be done only once.
* Any previously written NDEF message will be lost as the NFC shared memory will be re-initialized.
*/
NDEFT2T_Init(); /* Required once, not for every message creation or parsing. */
NDEFT2T_CreateMessage((void*)instanceBuffer, messageBuffer, NFC_SHARED_MEM_BYTE_SIZE, true);
createRecordInfo.shortRecord = 1; /* Enable Short record */
createRecordInfo.pString = locale;
if (NDEFT2T_CreateTextRecord((void*)instanceBuffer, &createRecordInfo)) {
    /* The payload length to pass excludes the NUL terminator. */
    if (NDEFT2T_WriteRecordPayload((void*)instanceBuffer, payloadText, sizeof(payloadText) - 1)) {
        NDEFT2T_CommitRecord((void*)instanceBuffer);
    }
}
NDEFT2T_CommitMessage((void*)instanceBuffer);
/* The return value of the commit function is ignored here. However, the application should use it appropriately. */

Best,
Dries.