Skip to content

Commit

Permalink
Add _example for nfc tag
Browse files Browse the repository at this point in the history
  • Loading branch information
blavka committed Jun 28, 2018
1 parent 7daab62 commit 72228cf
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
48 changes: 48 additions & 0 deletions _examples/nfc-tag/application.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <application.h>

bc_led_t led;

bc_tag_nfc_t tag_nfc;

void application_init(void)
{
bc_led_init(&led, BC_GPIO_LED, false, false);

bc_log_init(BC_LOG_LEVEL_DEBUG, BC_LOG_TIMESTAMP_ABS);

bc_log_info("bc_tag_nfc_init");

if (bc_tag_nfc_init(&tag_nfc, BC_I2C_I2C0, BC_TAG_NFC_I2C_ADDRESS_DEFAULT))
{
bc_log_info("ok");
}
else
{
bc_log_error("error");
}

bc_tag_nfc_ndef_t ndef;

bc_tag_nfc_ndef_init(&ndef);

bc_tag_nfc_ndef_add_text(&ndef, "BigClown home page", "en");

bc_tag_nfc_ndef_add_uri(&ndef, "https://www.bigclown.com/");

bc_tag_nfc_ndef_add_text(&ndef, "Documentation", "en");

bc_tag_nfc_ndef_add_uri(&ndef, "https://doc.bigclown.com/");

bc_log_info("bc_tag_nfc_memory_write_ndef");

if (bc_tag_nfc_memory_write_ndef(&tag_nfc, &ndef))
{
bc_log_info("ok");
}
else
{
bc_log_error("error");
}

bc_led_pulse(&led, 2000);
}
10 changes: 10 additions & 0 deletions _examples/nfc-tag/application.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef _APPLICATION_H
#define _APPLICATION_H

#ifndef VERSION
#define VERSION "vdev"
#endif

#include <bcl.h>

#endif // _APPLICATION_H

0 comments on commit 72228cf

Please sign in to comment.