Skip to content

Commit b995f53

Browse files
committed
105 test
1 parent b6a7179 commit b995f53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+6166
-396
lines changed

ADXL335.cpp

Lines changed: 0 additions & 84 deletions
This file was deleted.

ADXL335.h

Lines changed: 0 additions & 86 deletions
This file was deleted.

LICENSE.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2012, Adafruit Industries
4+
Copyright (c) 2013, Seeed Technology Inc.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 132 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,145 @@
1-
## Accelerometer_ADXL335 [![Build Status](https://travis-ci.com/Seeed-Studio/Accelerometer_ADXL335.svg?branch=master)](https://travis-ci.com/Seeed-Studio/Accelerometer_ADXL335)
1+
# NFC library
22

3-
<img src="https://statics3.seeedstudio.com/images/P2241478.JPG" width=auto>
3+
This is an library for PN532 to use NFC technology.
4+
It is for [NFC Shield](https://www.seeedstudio.com/NFC-Shield-V2-0.html) and [Grove - NFC](https://www.seeedstudio.com/Grove-NFC.html).
45

5-
[Grove 3-Axis Analog Accelerometer](https://www.seeedstudio.com/Grove-3Axis-Analog-Accelerometer-p-1086.html)
6+
[![NFC Shield](https://statics3.seeedstudio.com/images/113030001%201.jpg)](https://www.seeedstudio.com/NFC-Shield-V2-0.html)
7+
[![Grove - NFC](https://statics3.seeedstudio.com/images/product/grove%20nfc.jpg)](https://www.seeedstudio.com/Grove-NFC.html)
68

7-
The ADXL335 is a small, thin, low power, complete 3-axis accelerometer with signal conditioned voltage outputs. The product measures acceleration with a minimum full-scale range of ±3 g.
8-
The module was designed as breakout board because ADXL335's signal is analog( more ports requested ). But the board outline is grove module that you can fix it conveniently like other groves. The sensor combined 3.3 and 5V power supply,can be used in standard arduino device and seeduino stalker. The following program code includes first-order filter which can make the output smoothly if the sensor was used in robot or toy car.
9+
## Features
910

10-
For more information, please refer to [Grove - 3-Axis Analog Accelerometer wiki](http://wiki.seeedstudio.com/Grove-3-Axis_Analog_Accelerometer/)
11+
- Support all interfaces of PN532 (I2C, SPI, HSU)
12+
- Read/write Mifare Classic Card
13+
- Works with [Don's NDEF Library](https://github.com/don/NDEF)
14+
- Communicate with android 4.0+([Lists of devices supported](https://github.com/Seeed-Studio/PN532/wiki/List-of-devices-supported))
15+
- Support [mbed platform](https://os.mbed.com/teams/Seeed/code/PN532/)
16+
- Card emulation (NFC Type 4 tag)
1117

12-
----
13-
This software is written by Frankie Chu for seeed studio<br>
14-
and is licensed under [The MIT License](http://opensource.org/licenses/mit-license.php). Check License.txt for more information.<br>
18+
## To Do
1519

16-
Contributing to this software is warmly welcomed. You can do this basically by<br>
17-
[forking](https://help.github.com/articles/fork-a-repo), committing modifications and then [pulling requests](https://help.github.com/articles/using-pull-requests) (follow the links above<br>
18-
for operating guide). Adding change log and your contact into file header is encouraged.<br>
19-
Thanks for your contribution.
20+
- To support more than one INFO PDU of P2P communication
21+
- To read/write NFC Type 4 tag
2022

21-
Seeed is a hardware innovation platform for makers to grow inspirations into differentiating products. By working closely with technology providers of all scale, Seeed provides accessible technologies with quality, speed and supply chain knowledge. When prototypes are ready to iterate, Seeed helps productize 1 to 1,000 pcs using in-house engineering, supply chain management and agile manufacture forces. Seeed also team up with incubators, Chinese tech ecosystem, investors and distribution channels to portal Maker startups beyond.
23+
## Getting Started
2224

25+
### Using Arduino IDE
2326

27+
1. Download [zip file](https://github.com/Seeed-Studio/PN532/archive/refs/heads/arduino.zip), extract it into Arduino's libraries and rename it to PN532-Arduino.
28+
2. Download [Don's NDEF library](https://github.com/don/NDEF/archive/refs/heads/master.zip), extract it into Arduino's libraries and rename it to NDEF.
29+
3. Add the `NFC_INTERFACE_<interface>` build flag to your build system or define it in your code using `#define NFC_INTERFACE_<interface>` like
2430

31+
```cpp
32+
#define NFC_INTERFACE_I2C
33+
```
2534

26-
[![Analytics](https://ga-beacon.appspot.com/UA-46589105-3/Accelerometer_ADXL335)](https://github.com/igrigorik/ga-beacon)
35+
4. Follow the examples of the two libraries.
2736

37+
### PlatformIO library
2838

39+
Add `https://github.com/Seeed-Studio/PN532.git` to your `lib_deps` variable in `platformio.ini` like so. This library will automatically include Don's NDEF library as well.
40+
41+
```
42+
lib_deps =
43+
https://github.com/Seeed-Studio/PN532.git
44+
```
45+
46+
> ⚠️ Besides using the correct `PN532_<interface>.h` include file, you have to add `-DNFC_INTERFACE_<interface>` to `build_flags` to select what interface you want to use. This is done to prevent requiring unnecessary dependencies on e.g. `SoftwareSerial` or `SPI` when you are not using those interfaces.
47+
48+
```
49+
build_flags =
50+
-DNFC_INTERFACE_HSU
51+
```
52+
53+
### Git way for Linux/Mac (recommended)
54+
55+
1. Get PN532 library and NDEF library
56+
57+
cd {Arduino}\libraries
58+
git clone --recursive https://github.com/Seeed-Studio/PN532.git NFC
59+
git clone --recursive https://github.com/don/NDEF.git NDEF
60+
ln -s NFC/PN532 ./
61+
ln -s NDEF/NDEF ./
62+
63+
1. Add the `NFC_INTERFACE_<interface>` build flag to your build system or define it in your code using `#define NFC_INTERFACE_<interface>` like
64+
65+
```cpp
66+
#define NFC_INTERFACE_I2C
67+
```
68+
69+
1. Follow the examples of the two libraries
70+
71+
## Interfaces
72+
73+
This library offers four ways to interface with the PN532 board:
74+
75+
- `HSU` (High Speed Uart)
76+
- `I2C`
77+
- `SPI`
78+
- `SWHSU` (Software-based High Speed Uart)
79+
80+
Read the section for the interface you want to use.
81+
82+
> Make sure to add the `PN532_<interface>.h` include file and the `NFC_INTERFACE_<interface>` define to your code like the example below:
83+
84+
```cpp
85+
#define NFC_INTERFACE_HSU
86+
87+
#include <PN532_HSU.h>
88+
#include <PN532.h>
89+
```
90+
91+
## HSU Interface
92+
93+
HSU is short for High Speed Uart. HSU interface needs only 4 wires to connect PN532 with Arduino, [Sensor Shield](http://goo.gl/i0EQgd) can make it more easier. For some Arduino boards like [Leonardo][leonardo], [DUE][due], [Mega][mega] ect, there are more than one `Serial` on these boards, so we can use this additional Serial to control PN532, HSU uses 115200 baud rate.
94+
95+
To use the `Serial1` control PN532, refer to the code below.
96+
97+
```c++
98+
#define NFC_INTERFACE_HSU
99+
100+
#include <PN532_HSU.h>
101+
#include <PN532.h>
102+
103+
PN532_HSU pn532hsu(Serial1);
104+
PN532 nfc(pn532hsu);
105+
106+
void setup(void)
107+
{
108+
nfc.begin();
109+
//...
110+
}
111+
```
112+
113+
If your Arduino has only one serial interface and you want to keep it for control or debugging with the Serial Monitor, you can use the [`SoftwareSerial`][softwareserial] library to control the PN532 by emulating a serial interface. Include `PN532_SWHSU.h` instead of `PN532_HSU.h`:
114+
115+
```c++
116+
#define NFC_INTERFACE_SWHSU
117+
118+
#include <SoftwareSerial.h>
119+
#include <PN532_SWHSU.h>
120+
#include <PN532.h>
121+
122+
SoftwareSerial SWSerial( 10, 11 ); // RX, TX
123+
124+
PN532_SWHSU pn532swhsu( SWSerial );
125+
PN532 nfc( pn532swhsu );
126+
127+
void setup(void)
128+
{
129+
nfc.begin();
130+
//...
131+
}
132+
```
133+
134+
## Attribution
135+
136+
This library is based on [Adafruit_NFCShield_I2C](https://github.com/adafruit/Adafruit_NFCShield_I2C).
137+
[Seeed Studio](hhttps://www.seeedstudio.com/) rewrite the library to make it easy to support different interfaces and platforms.
138+
[@Don](https://github.com/don) writes the [NDEF library](https://github.com/don/NDEF) to make it more easy to use.
139+
[@JiapengLi](https://github.com/JiapengLi) adds HSU interface.
140+
[@awieser](https://github.com/awieser) adds card emulation function.
141+
142+
[mega]: http://arduino.cc/en/Main/arduinoBoardMega
143+
[due]: http://arduino.cc/en/Main/arduinoBoardDue
144+
[leonardo]: http://arduino.cc/en/Main/arduinoBoardLeonardo
145+
[softwareserial]: https://www.arduino.cc/en/Reference/softwareSerial

0 commit comments

Comments
 (0)