Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New library version #14

Merged
merged 4 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/Continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: X_NUCLEO_53L7A1 Continuous Integration
on:
push:
branches:
- main
paths-ignore:
- '*'
- '**.md'
- '**.txt'
pull_request:
paths-ignore:
- '*'
- '**.md'
- '**.txt'
jobs:
astyle_check:
runs-on: ubuntu-latest
name: AStyle check
steps:
# First of all, clone the repo using the checkout action.
- name: Checkout
uses: actions/checkout@main

- name: Astyle check
id: Astyle
uses: stm32duino/actions/astyle-check@main

# Use the output from the `Astyle` step
- name: Astyle Errors
if: failure()
run: |
cat ${{ steps.Astyle.outputs.astyle-result }}
exit 1
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main

# See: https://github.com/codespell-project/actions-codespell/blob/master/README.md
- name: Spell check
uses: codespell-project/actions-codespell@master
with:
check_filenames: true
check_hidden: true
# In the event of a false positive, add the word in all lower case to this file:
ignore_words_file: ./extras/codespell-ignore-words-list.txt
lib_build:
runs-on: ubuntu-latest
name: Library compilation
steps:

# First of all, clone the repo using the checkout action.
- name: Checkout
uses: actions/checkout@main

- name: Compilation
id: compile
uses: stm32duino/actions/compile-examples@main
with:
board-pattern: "NUCLEO_L476RG"
libraries: "STM32duino VL53L7CX"

# Use the output from the `Compilation` step
- name: Compilation Errors
if: failure()
run: |
cat ${{ steps.compile.outputs.compile-result }}
exit 1
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ When the NFC module is started and ready, the message "Sytstem init done!" is di
Next, the tag is written, we wait few seconds, we read the same tag and print it on the monitor window.

You can test this application by connecting it with your smartphone.
On Android, donwload a NFC Tools. Then start the app, check if NFC is activated
On Android, download a NFC Tools. Then start the app, check if NFC is activated
on your smartphone. Put your smartphone near the tag, you can read it. You can
write a tag with this app.

* X_NUCLEO_NFC04A1_SimpleWrite: This application writes a NDEF message, containg a URI record, to the tag.
* X_NUCLEO_NFC04A1_SimpleWrite: This application writes a NDEF message, containing a URI record, to the tag.

When the NFC module is started and ready, the message "System init done!" is displayed on the monitor window.
Next, the tag is written with a URI.

You can test this application by tapping the tag with your smartphone.
On Android, check if NFC is activated on your smartphone.
Put your smartphone near the tag to read it.
The prefered Internet Browser is automatically opened with the provided URI.
The preferred Internet Browser is automatically opened with the provided URI.

# Dependencies

Expand Down
43 changes: 23 additions & 20 deletions examples/X_NUCLEO_NFC04A1_HelloWorld/X_NUCLEO_NFC04A1_HelloWorld.ino
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -53,68 +53,71 @@
all LED's blink.

You can also use your smartphone to read/write a tag.
On Android, donwload a NFC Tools. Then start the app, check if NFC is activated
On Android, download a NFC Tools. Then start the app, check if NFC is activated
on your smartphone. Put your smartphone near the tag, you can read it. You can
write a tag with this app.
******************************************************************************
*/

#include "x_nucleo_nfc04.h"

#define DEV_I2C Wire
X_Nucleo_NFC04 Nfc(12, -1, &DEV_I2C);

void setup() {
const char uri_write_message[] = "st.com/st25"; // Uri message to write in the tag
const char uri_write_protocol[] = URI_ID_0x01_STRING; // Uri protocol to write in the tag
String uri_write = String(uri_write_protocol) + String(uri_write_message);
String uri_read;

if (X_Nucleo_Nfc04.begin()) {
if (Nfc.begin()) {
while (1) {
X_Nucleo_Nfc04.ledOn(GREEN_LED);
Nfc.ledOn(GREEN_LED);
delay(100);
X_Nucleo_Nfc04.ledOff(GREEN_LED);
Nfc.ledOff(GREEN_LED);
delay(100);
}
}
X_Nucleo_Nfc04.ledOn(GREEN_LED);
Nfc.ledOn(GREEN_LED);

if (X_Nucleo_Nfc04.writeURI(uri_write_protocol, uri_write_message, "")) {
if (Nfc.writeURI(uri_write_protocol, uri_write_message, "")) {
while (1) {
X_Nucleo_Nfc04.ledOn(BLUE_LED);
Nfc.ledOn(BLUE_LED);
delay(100);
X_Nucleo_Nfc04.ledOff(BLUE_LED);
Nfc.ledOff(BLUE_LED);
delay(100);
}
}

X_Nucleo_Nfc04.ledOn(BLUE_LED);
Nfc.ledOn(BLUE_LED);

delay(100);

if (X_Nucleo_Nfc04.readURI(&uri_read)) {
if (Nfc.readURI(&uri_read)) {
while (1) {
X_Nucleo_Nfc04.ledOn(YELLOW_LED);
Nfc.ledOn(YELLOW_LED);
delay(100);
X_Nucleo_Nfc04.ledOff(YELLOW_LED);
Nfc.ledOff(YELLOW_LED);
delay(100);
}
}

X_Nucleo_Nfc04.ledOn(YELLOW_LED);
Nfc.ledOn(YELLOW_LED);

if (strcmp(uri_read.c_str(), uri_write.c_str()) != 0) {
while (1) {
X_Nucleo_Nfc04.ledOn(GREEN_LED);
X_Nucleo_Nfc04.ledOn(BLUE_LED);
X_Nucleo_Nfc04.ledOn(YELLOW_LED);
Nfc.ledOn(GREEN_LED);
Nfc.ledOn(BLUE_LED);
Nfc.ledOn(YELLOW_LED);
delay(100);
X_Nucleo_Nfc04.ledOff(GREEN_LED);
X_Nucleo_Nfc04.ledOff(BLUE_LED);
X_Nucleo_Nfc04.ledOff(YELLOW_LED);
Nfc.ledOff(GREEN_LED);
Nfc.ledOff(BLUE_LED);
Nfc.ledOff(YELLOW_LED);
delay(100);
}
}
}

void loop() {
//empty loop
}
}
14 changes: 8 additions & 6 deletions examples/X_NUCLEO_NFC04A1_SimpleWrite/X_NUCLEO_NFC04A1_SimpleWrite.ino
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@
You can use your smartphone to read the tag.
On Android, check if NFC is activated on your smartphone.
Put your smartphone near the tag to natively read it.
The prefered Internet Browser is automatically opened with the provided URI.
The preferred Internet Browser is automatically opened with the provided URI.
******************************************************************************
*/

#include "x_nucleo_nfc04.h"

#define SerialPort Serial
#define DEV_I2C Wire
X_Nucleo_NFC04 Nfc(12, -1, &DEV_I2C);

void setup() {
const char uri_write_message[] = "st.com/st25"; // Uri message to write in the tag
Expand All @@ -69,23 +71,23 @@ void setup() {
// Initialize serial for output.
SerialPort.begin(115200);

if (X_Nucleo_Nfc04.begin() == 0) {
if (Nfc.begin() == 0) {
SerialPort.println("System Init done!");
X_Nucleo_Nfc04.ledOn(GREEN_LED);
Nfc.ledOn(GREEN_LED);
} else {
SerialPort.println("System Init failed!");
while (1);
}

if (X_Nucleo_Nfc04.writeURI(uri_write_protocol, uri_write_message, "")) {
if (Nfc.writeURI(uri_write_protocol, uri_write_message, "")) {
SerialPort.println("Write failed!");
while (1);
}

X_Nucleo_Nfc04.ledOn(BLUE_LED);
Nfc.ledOn(BLUE_LED);

}

void loop() {
//empty loop
}
}
1 change: 1 addition & 0 deletions extras/codespell-ignore-words-list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
msbuid
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=STM32duino X-NUCLEO-NFC04A1
version=1.1.1
version=2.0.0
author=STMicroelectronics
maintainer=stm32duino
sentence=Allows controlling the ST X-NUCLEO-NFC04A1 expansion board
Expand Down
128 changes: 0 additions & 128 deletions src/BSP/x_nucleo_nfc04a1.cpp

This file was deleted.

Loading