This repository has been archived by the owner on Sep 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAmiibo.h
executable file
·78 lines (58 loc) · 1.72 KB
/
Amiibo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**************************************************************************/
/*!
@file Adafruit_PN532.h
@author Adafruit Industries
@license BSD (see license.txt)
This is a library for the Adafruit PN532 NFC/RFID breakout boards
This library works with the Adafruit NFC breakout
----> https://www.adafruit.com/products/364
Check out the links above for our tutorials and wiring diagrams
These chips use SPI or I2C to communicate.
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
@section HISTORY
v2.0 - Refactored to add I2C support from Adafruit_NFCShield_I2C library.
v1.1 - Added full command list
- Added 'verbose' mode flag to constructor to toggle debug output
- Changed readPassiveTargetID() to return variable length values
*/
/**************************************************************************/
#ifndef AMIIBO_H
#define AMIIBO_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "Adafruit_PN532.h"
#define AMIIBO_PAGE_COUNT (135)
struct Amiibo_Info {
uint8_t game_serie;
uint8_t character;
uint8_t character_variation;
uint8_t format;
uint16_t amiibo_id;
uint8_t amiibo_serie;
uint8_t static_byte;
};
class Amiibo
{
public:
Amiibo(Adafruit_PN532);
~Amiibo();
void begin();
bool read();
bool readFull();
bool readInfo(Amiibo_Info*);
void clearCache();
void printCache();
private:
void readAmiibo();
bool readPage(uint8_t);
uint8_t getByteAt(uint8_t, uint8_t);
Adafruit_PN532 nfc;
uint8_t* amiiboDataCache;
bool* amiiboDataCacheStatus;
};
#endif