summaryrefslogtreecommitdiff
path: root/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry
diff options
context:
space:
mode:
authorkrolyxon <me@krolyxon.com>2026-06-08 23:12:15 +0530
committerkrolyxon <me@krolyxon.com>2026-06-08 23:12:15 +0530
commit8a4d103196312b8a18afc0a2ba0fc13ff1a0b180 (patch)
treea92424ac65fbdb93702ea8c44a5c52c9fd66e28c /.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry
parent1d557527be495c59bbc07f194d903b1cec1780d3 (diff)
remove .pio
Diffstat (limited to '.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry')
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/.esp32.test.skip0
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.classpath7
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.project29
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/BlackBerry_App_Descriptor.xml40
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/build.xml35
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/ColorMixer.java152
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/MyApp.java47
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/MyScreen.java163
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/apduToBlackBerry.ino148
10 files changed, 0 insertions, 633 deletions
diff --git a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/.esp32.test.skip b/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/.esp32.test.skip
deleted file mode 100644
index e69de29..0000000
--- a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/.esp32.test.skip
+++ /dev/null
diff --git a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.classpath b/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.classpath
deleted file mode 100644
index 4426948..0000000
--- a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="res"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/net.rim.ejde.BlackBerryVMInstallType/BlackBerry JRE 7.0.0"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.project b/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.project
deleted file mode 100644
index 1a8239a..0000000
--- a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.project
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>TargetEmulation</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>net.rim.ejde.internal.builder.BlackBerryPreprocessBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>net.rim.ejde.internal.builder.BlackBerryResourcesBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>net.rim.ejde.BlackBerryPreProcessNature</nature>
- <nature>net.rim.ejde.BlackBerryProjectCoreNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.settings/org.eclipse.jdt.core.prefs b/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 3f59a3e..0000000
--- a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,12 +0,0 @@
-#Fri Jun 22 00:02:13 EDT 2012
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/BlackBerry_App_Descriptor.xml b/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/BlackBerry_App_Descriptor.xml
deleted file mode 100644
index aa610d2..0000000
--- a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/BlackBerry_App_Descriptor.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
-
- Copyright (c) 2013 Research In Motion Limited.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<!-- This file has been generated by the BlackBerry Plugin for Eclipse v3.6.0. -->
-
-<Properties ModelVersion="1.1.2">
- <General Title="" Version="1.0.0" Vendor="BlackBerry Developer" Description=""/>
- <Application Type="BlackBerry Application" MainMIDletName="" MainArgs="" HomeScreenPosition="0" StartupTier="7" IsSystemModule="false" IsAutostartup="false"/>
- <Resources hasTitleResource="false" TitleResourceBundleName="" TitleResourceBundleRelativePath="" TitleResourceBundleClassName="" TitleResourceBundleKey="" DescriptionId="">
- <Icons>
- <Icon CanonicalFileName="res\img\icon.png" IsFocus="false"/>
- </Icons>
- </Resources>
- <KeywordResources KeywordResourceBundleName="" KeywordResourceBundleRelativePath="" KeywordResourceBundleClassName="" KeywordResourceBundleKey=""/>
- <Compile OutputCompilerMessages="false" ConvertImages="true" CreateWarningForNoExportedRoutine="true" CompressResources="false" AliasList="">
- <PreprocessorDefines/>
- </Compile>
- <Packaging PreBuildStep="" PostBuildStep="" CleanStep="" OutputFileName="TargetEmulation" OutputFolder="deliverables" GenerateALXFile="true">
- <AlxFiles/>
- </Packaging>
- <HiddenProperties>
- <ClassProtection/>
- <PackageProtection/>
- </HiddenProperties>
- <AlternateEntryPoints/>
-</Properties>
diff --git a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/build.xml b/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/build.xml
deleted file mode 100644
index 72bf0c3..0000000
--- a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/build.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
-
- Copyright (c) 2013 Research In Motion Limited.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<project default="all">
- <property name="jde.path" value="c:/Program Files/Research In Motion/BlackBerry JDE 7.1.0" />
- <target name="all" depends="sign,deploy">
- </target>
-
- <target name="sign">
- <java failonerror="true" fork="true"
- jar="c:/Program Files/Research In Motion/BlackBerry JDE 7.1.0/bin/SignatureTool.jar" args="-p s0ftc0ck -a -c deliverables/Standard/7.0.0/TargetEmulation.cod">
- </java>
- </target>
- <target name="deploy">
- <exec executable="${jde.path}/bin/JavaLoader.exe">
- <arg value="-wpasscc" />
- <arg value="load" />
- <arg value="deliverables/Standard/7.0.0/TargetEmulation.cod" />
- </exec>
- </target>
-</project>
diff --git a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/ColorMixer.java b/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/ColorMixer.java
deleted file mode 100644
index d81f802..0000000
--- a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/ColorMixer.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/**
- Copyright (c) 2011, 2012, 2013 Research In Motion Limited.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-**/
-package mypackage;
-
-import net.rim.device.api.ui.Field;
-import net.rim.device.api.ui.Graphics;
-import net.rim.device.api.ui.TouchEvent;
-
-public class ColorMixer extends Field {
- private static final int[] colors = new int[] { 0xff0000, 0xff00, 0xff };
- private int barGap = 5;
-
- private int barHeight = 64;
- private int color;
- private MyScreen owner;
-
- private double r, g, b;
-
- public ColorMixer(MyScreen owner) {
- this.owner = owner;
- }
-
- protected void layout(int width, int height) {
- setExtent(640, barHeight * 3 + barGap * 2);
- }
-
- protected void paint(Graphics graphics) {
- int barWidth = getWidth() - barHeight * 3 - barGap * 3;
- double[] values = new double[] { r, g, b };
-
- // Draw color sliders
- for (int i = 0; i < 3; ++i) {
- int top = i * (barHeight + barGap);
- int toDraw = (int) (values[i] * barWidth + 0.5);
- graphics.setColor(0);
- graphics.fillRect(toDraw, top, barWidth - toDraw, barHeight);
-
- graphics.setColor(colors[i]);
- graphics.fillRect(0, top, toDraw, barHeight);
-
- graphics.setColor(0x7f7f7f);
- graphics.drawRect(0, top, barWidth, barHeight);
- }
-
- // Draw mixed down color
- int boxWidth = barHeight * 3 + barGap * 2;
- graphics.setColor(color);
- graphics.fillRect(getWidth() - 1 - boxWidth, 0, boxWidth, boxWidth);
-
- graphics.setColor(0x7f7f7f);
- graphics.drawRect(getWidth() - 1 - boxWidth, 0, boxWidth, boxWidth);
- }
-
- public void setColor(int color) {
- if (color != this.color) {
- this.color = color;
- r = ((color >> 16) & 0xff) / 255.0;
- g = ((color >> 8) & 0xff) / 255.0;
- b = (color & 0xff) / 255.0;
- invalidate();
- }
- }
-
- private void setPart(int which, double value) {
- double source = which == 0 ? r : which == 1 ? g : b;
- if (value == source) {
- return;
- }
- int bv = (int) (value * 255 + 0.5);
- bv &= 0xff;
- if (which == 0) {
- r = value;
- color &= 0xffff;
- color |= bv << 16;
- } else if (which == 1) {
- g = value;
- color &= 0xff00ff;
- color |= bv << 8;
- } else {
- b = value;
- color &= 0xffff00;
- color |= bv;
- }
- owner.setColor(color);
- invalidate();
- }
-
- private int touchTarget = -1;
-
- protected boolean touchEvent(TouchEvent message) {
- int event = message.getEvent();
-
- int x = message.getX(1);
- int y = message.getY(1);
-
- int barWidth = getWidth() - barHeight * 3 - barGap * 3;
-
- if (event == TouchEvent.UP) {
- touchTarget = -1;
- return false;
- } else if (event == TouchEvent.DOWN) {
- if (y < -5 || y > getWidth() + 5) {
- return false;
- }
-
- if (x <= barWidth) {
- for (int i = 0; i < 3; ++i) {
- if (y < 0) {
- break;
- }
- if (y < barHeight) {
- touchTarget = i;
- break;
- }
- y -= barHeight;
- y -= barGap;
- }
- } else {
- return false;
- }
- }
-
- if (touchTarget == -1) {
- return false;
- }
-
- double newValue = 1.0 * x / barWidth;
- if (newValue < 0) {
- newValue = 0;
- }
- if (newValue > 1) {
- newValue = 1;
- }
-
- setPart(touchTarget, newValue);
-
- return true;
- }
-}
diff --git a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/MyApp.java b/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/MyApp.java
deleted file mode 100644
index 4da1da5..0000000
--- a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/MyApp.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- Copyright (c) 2011, 2012, 2013 Research In Motion Limited.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-**/
-package mypackage;
-
-import net.rim.device.api.ui.UiApplication;
-
-/**
- * This class extends the UiApplication class, providing a
- * graphical user interface.
- */
-public class MyApp extends UiApplication
-{
- /**
- * Entry point for application
- * @param args Command line arguments (not used)
- */
- public static void main(String[] args)
- {
- // Create a new instance of the application and make the currently
- // running thread the application's event dispatch thread.
- MyApp theApp = new MyApp();
- theApp.enterEventDispatcher();
- }
-
-
- /**
- * Creates a new MyApp object
- */
- public MyApp()
- {
- // Push a screen onto the UI stack for rendering.
- pushScreen(new MyScreen());
- }
-}
diff --git a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/MyScreen.java b/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/MyScreen.java
deleted file mode 100644
index 0f80667..0000000
--- a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/BlackBerry7/src/mypackage/MyScreen.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- Copyright (c) 2011, 2012, 2013 Research In Motion Limited.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-**/
-package mypackage;
-
-import net.rim.device.api.io.nfc.NFCException;
-import net.rim.device.api.io.nfc.emulation.VirtualISO14443Part4TargetCallback;
-import net.rim.device.api.io.nfc.emulation.VirtualISO14443Part4TypeATarget;
-import net.rim.device.api.ui.Field;
-import net.rim.device.api.ui.FieldChangeListener;
-import net.rim.device.api.ui.component.CheckboxField;
-import net.rim.device.api.ui.component.LabelField;
-import net.rim.device.api.ui.container.MainScreen;
-import net.rim.device.api.ui.decor.BackgroundFactory;
-
-/**
- * A class extending the MainScreen class, which provides default standard
- * behavior for BlackBerry GUI applications.
- */
-public final class MyScreen extends MainScreen implements
- VirtualISO14443Part4TargetCallback, FieldChangeListener {
-
- private int color = 0x7f7f7f;
-
- private boolean colorQueued = false;
- private CheckboxField colorQueueLocked;
- private VirtualISO14443Part4TypeATarget emulated;
- private ColorMixer mixer;
-
- private LabelField status;
-
- /**
- * Creates a new MyScreen object
- */
- public MyScreen() {
- // Set the displayed title of the screen
- setTitle("Colour Control Setter");
- setBackground(BackgroundFactory.createSolidBackground(0x3f3f3f));
-
- add(new LabelField(""));
- add(colorQueueLocked = new CheckboxField("Lock Color", false));
- colorQueueLocked.setChangeListener(this);
-
- add(mixer = new ColorMixer(this));
- mixer.setColor(0x7f7f7f);
-
- add(status = new LabelField(""));
-
- try {
- emulated = new VirtualISO14443Part4TypeATarget(this, "10451045",
- null);
- log("created");
- emulated.startEmulation();
- log("emulating");
- } catch (NFCException e) {
- log("Failed to listen");
- status.setText(e.getClass().getName() + " " + e.getMessage());
- e.printStackTrace();
- }
- }
-
- // private TextField textField;
-
- public void fieldChanged(Field field, int context) {
- if (colorQueueLocked.getChecked()) {
- setColor(color);
- } else {
- colorQueued = false;
- status.setText("");
- }
- }
-
- private boolean isColorQueueLocked() {
- return colorQueueLocked.getChecked();
- }
-
- protected void log(String message) {
- System.out.println("SUPERDUPER: " + message);
- // textField.setText(textField.getText() + "\n" + message);
- }
-
- public void onVirtualTargetEvent(int targetEvent) {
- log("Target event: " + targetEvent);
- }
-
- public byte[] processCommand(byte[] command) {
- byte[] toReturn = processCommandInternal(command);
- String message = "[" + toString(command) + "," + toString(toReturn)
- + "]";
- // status.setText(message);
- // log(message);
- return toReturn;
- }
-
- private byte[] processCommandInternal(byte[] command) {
- if (command == null) {
- return new byte[0];
- }
- int messageType = command[0] & 0xff;
- switch (messageType) {
- case 1:
- if (command.length == 4) {
- int colorIn = (command[1] & 0xff) << 16;
- colorIn |= (command[2] & 0xff) << 8;
- colorIn |= (command[3] & 0xff);
-
- if (colorIn != color) {
- if (colorQueued) {
-
- byte[] toReturn = new byte[4];
- toReturn[0] = 1;
- toReturn[1] = (byte) (color >> 16);
- toReturn[2] = (byte) (color >> 8);
- toReturn[3] = (byte) color;
-
- if (!isColorQueueLocked()) {
- colorQueued = false;
- status.setText("");
- }
-
- return toReturn;
- } else {
- this.color = colorIn;
- mixer.setColor(colorIn);
- }
- }
- }
- break;
- }
- return new byte[] { 0 };
- }
-
- public void setColor(int color) {
- colorQueued = true;
- this.color = color;
- status.setText("#" + toHex(color));
- }
-
- private String toHex(int i) {
- String toReturn = "000000" + Integer.toString(i, 16);
- return toReturn.substring(toReturn.length() - 6);
- }
-
- private String toString(byte[] command) {
- String toReturn = "";
- for (int i = 0; i < command.length; ++i) {
- toReturn += Integer.toString(command[i] & 0xff, 16) + " ";
- }
- return toReturn;
- }
-}
diff --git a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/apduToBlackBerry.ino b/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/apduToBlackBerry.ino
deleted file mode 100644
index 0b5269a..0000000
--- a/.pio/libdeps/esp32-s3-n16r8/Adafruit PN532/examples/apduToBlackBerry/apduToBlackBerry.ino
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- Copyright (c) 2011, 2012, 2013 Research In Motion Limited.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-**/
-#include <Wire.h>
-#include <SPI.h>
-#include <Adafruit_PN532.h>
-
-// If using the breakout with SPI, define the pins for SPI communication.
-#define PN532_SCK (2)
-#define PN532_MOSI (3)
-#define PN532_SS (4)
-#define PN532_MISO (5)
-
-// If using the breakout or shield with I2C, define just the pins connected
-// to the IRQ and reset lines. Use the values below (2, 3) for the shield!
-#define PN532_IRQ (2)
-#define PN532_RESET (3) // Not connected by default on the NFC Shield
-
-// Uncomment just _one_ line below depending on how your breakout or shield
-// is connected to the Arduino:
-
-// Use this line for a breakout with a SPI connection:
-Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);
-
-// Use this line for a breakout with a hardware SPI connection. Note that
-// the PN532 SCK, MOSI, and MISO pins need to be connected to the Arduino's
-// hardware SPI SCK, MOSI, and MISO pins. On an Arduino Uno these are
-// SCK = 13, MOSI = 11, MISO = 12. The SS line can be any digital IO pin.
-//Adafruit_PN532 nfc(PN532_SS);
-
-// Or use this line for a breakout or shield with an I2C connection:
-//Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);
-
-// PWM LED will be on the following PINs.
-#define R_PIN (9)
-#define G_PIN (10)
-#define B_PIN (11)
-
-// Initial values of RGB.
-uint8_t r = 0x00;
-uint8_t g = 0x00;
-uint8_t b = 0x7f;
-
-/**
- * Write the current color to the output pins.
- */
-void showColor() {
- analogWrite(R_PIN,r);
- analogWrite(G_PIN,g);
- analogWrite(B_PIN,b);
-}
-
-
-void setup() {
- Serial.begin(115200);
- while (!Serial) delay(10); // for Leonardo/Micro/Zero
-
- pinMode(R_PIN,OUTPUT);
- pinMode(G_PIN,OUTPUT);
- pinMode(B_PIN,OUTPUT);
- showColor();
-
- nfc.begin();
-
- uint32_t versiondata = nfc.getFirmwareVersion();
- if (! versiondata) {
- Serial.println("Did not find the shield - locking up");
- while (true) {
- }
- }
-
- Serial.print("Found chip PN5");
- Serial.println((versiondata>>24) & 0xFF, HEX);
- Serial.print("Firmware ver. ");
- Serial.print((versiondata>>16) & 0xFF, DEC);
- Serial.print('.');
- Serial.println((versiondata>>8) & 0xFF, DEC);
-
- nfc.begin();
-}
-
-uint8_t message[4];
-
-void loop(void) {
- uint8_t i;
-
- // Serial.println("Listening...");
- if (nfc.inListPassiveTarget()) {
- // Serial.println("Something's there...");
- while(true) {
- message[0] = 1;
- message[1] = r;
- message[2] = g;
- message[3] = b;
- uint8_t responseLength = sizeof(message);
- if (nfc.inDataExchange(message,sizeof(message),message,&responseLength)) {
- uint8_t command = message[0];
- switch(command) {
- case 0:
- // NOP
- break;
- case 1:
- if (responseLength==4) {
- r = message[1];
- g = message[2];
- b = message[3];
- showColor();
- //Serial.print("Read a color: ");
- //for (i=0; i<3; ++i) {
- // Serial.print(message[i+1],HEX);
- // Serial.print(' ');
- //}
- //Serial.println();
- }
- else {
- //Serial.println("Doesn't seem to be a color...");
- }
- break;
- default:
- //Serial.print("Unknown command ");
- //Serial.println(message[0]);
- ;
- }
- delay(10);
- }
- else {
- //Serial.println("It's gone...");
- break;
- }
- }
- }
- else {
- //Serial.print("Trying again...");
- }
-}
-