Skip to content

Commit 40b9758

Browse files
committed
update library properties, examples and readme
1 parent a695a66 commit 40b9758

File tree

7 files changed

+96
-19
lines changed

7 files changed

+96
-19
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
# Permission by file type
55
*.cpp @GogoVega
66
*.h @GogoVega
7+
*.ino @GogoVega
8+
*.json @GogoVega
79
*.md @GogoVega

README.md

Lines changed: 69 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RFIDtoEEPROM
1+
# RFID to EEPROM
22

33
<p align="left">
44
<a href="https://github.com/GogoVega/RFIDtoEEPROM/releases/latest">
@@ -14,13 +14,11 @@
1414

1515
Library to write an RFID Code in the [EEPROM](https://docs.arduino.cc/learn/built-in-libraries/eeprom) in order to check if the Code corresponds to a Code already saved.
1616

17-
## Feature
18-
19-
- Compatibility with I2C EEPROM.
20-
2117
## Usage
2218

23-
This library is used for saving an RFID Code to your Arduino's **internal EEPROM** rather than your Code to avoid **showing your RFID Code**. To then check if the Code corresponds to a Code already registered.
19+
This library is used for saving an RFID Code to your Arduino's EEPROM or I2C EEPROM rather than your Code to avoid **showing your RFID Code**. To then check if the Code corresponds to a Code already registered.
20+
21+
**Warning:** you must use the same number of bytes in your functions as defined in the Constructor and less than or equal to 16!
2422

2523
## How To Use
2624

@@ -31,12 +29,61 @@ Go to the Libraries Manager on [PlatformIO](https://platformio.org/platformio-id
3129
Or use `platformIO Core CLI` and paste the following command:
3230

3331
```bash
34-
pio lib install "gogovega/RFID to EEPROM@^1.0.0"
32+
pio lib install "gogovega/RFID to EEPROM@^1.1.0"
3533
```
3634

3735
## How It Works
3836

37+
### Constructor
38+
39+
- Internal EEPROM
40+
41+
```cpp
42+
RFIDtoEEPROM(uint8_t byteNumber);
43+
```
44+
45+
- I2C EEPROM
46+
47+
```cpp
48+
RFIDtoEEPROM_I2C(eeprom_size_t eepromSize, uint8_t address, uint8_t byteNumber);
49+
```
50+
51+
#### Set I2C BUS Speed
52+
53+
```cpp
54+
void begin(twiClockFreq_t twiFreq);
55+
```
56+
57+
#### Enumerations
58+
Use one of the enumerations below to set EEPROM Size:
59+
```
60+
{
61+
RFIDtoEEPROM_I2C::kbits_2,
62+
RFIDtoEEPROM_I2C::kbits_4,
63+
RFIDtoEEPROM_I2C::kbits_8,
64+
RFIDtoEEPROM_I2C::kbits_16,
65+
RFIDtoEEPROM_I2C::kbits_32,
66+
RFIDtoEEPROM_I2C::kbits_64,
67+
RFIDtoEEPROM_I2C::kbits_128,
68+
RFIDtoEEPROM_I2C::kbits_256,
69+
RFIDtoEEPROM_I2C::kbits_512,
70+
RFIDtoEEPROM_I2C::kbits_1024,
71+
RFIDtoEEPROM_I2C::kbits_2048
72+
}
73+
```
74+
75+
And use one of the enumerations below to set twiClock (Wire) Frequence:
76+
```
77+
{
78+
RFIDtoEEPROM_I2C::twiClock100kHz,
79+
RFIDtoEEPROM_I2C::twiClock400kHz
80+
}
81+
```
82+
83+
### Functions
84+
3985
This library contains several functions:
86+
4087
| Name | Description |
4188
|---|---|
4289
| `CardNumber()` | Returns the number of Cards already registered. |
@@ -46,7 +93,21 @@ This library contains several functions:
4693
| `EraseAllCards()` | Resets all Cards to 0. |
4794
| `MaxCards()` | Returns the maximum number of recordable Cards. Currently **set to 255**. |
4895
49-
**Note:** The EEPROM memory has a specified life of 100,000 write/erase cycles, so you may need to be careful about how often you write to it.
96+
**Note:** The EEPROM memory has a specified life of 100,000 write/erase cycles (depends on models), so you may need to be careful about how often you write to it.
97+
98+
## Tested On
99+
100+
- Atmel AT24C256
101+
102+
## Future Features
103+
104+
- Increase the number of recordable Cards (currently set to 255).
105+
- Improve error handling.
106+
107+
## Limitations
108+
109+
- The Number of Bytes in the UID must be less than or equal to 16!
110+
- The Number of recordable Cards is fixed at 255.
50111
51112
## License
52113

docs/platformio.png

230 KB
Loading

examples/basic_example/basic_example.ino

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
* - Erase all Cards.
1313
*
1414
* Warning: you must use the same number of bytes in your functions as defined
15-
* in the constructor!
15+
* in the Constructor and less than or equal to 16!
1616
*
17-
* Create april 2022
17+
* Create April 2022
1818
*
1919
* Copyright (c) 2022 Gauthier Dandele
2020
*
@@ -24,12 +24,20 @@
2424
#include <RFIDtoEEPROM.h>
2525

2626
#define NUMBYTES 4
27-
// By default, the Number of Bytes of ID = 4
27+
28+
// By default, the Number of Bytes in the UID = 4
2829
RFIDtoEEPROM myCard(NUMBYTES);
2930

31+
// Uncomment to use I2C EEPROM (EEPROMSize, I2CAddress, ByteNumber)
32+
// RFIDtoEEPROM_I2C myCard(RFIDtoEEPROM_I2C::kbits_256, 0x50, NUMBYTES);
33+
3034
void setup() {
3135
Serial.begin(9600);
3236

37+
// Uncomment to use I2C EEPROM
38+
// Wire.begin();
39+
// myCard.begin();
40+
3341
// Erase all Cards
3442
// myCard.EraseAllCards();
3543

examples/mfrc522_example/mfrc522_example.ino

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
*
2323
* More pin layouts for other boards can be found here: https://github.com/miguelbalboa/rfid#pin-layout
2424
*
25-
*
2625
* Warning: you must use the same number of bytes in your functions as defined
27-
* in the constructor!
26+
* in the Constructor and less than or equal to 16!
2827
*
29-
* Create april 2022
28+
* Create April 2022
3029
*
3130
* Copyright (c) 2022 Gauthier Dandele
3231
*
@@ -42,9 +41,12 @@
4241

4342
MFRC522 rfid(SS_PIN, RST_PIN);
4443

45-
// By default, the Number of Bytes of ID = 4
44+
// By default, the Number of Bytes in the UID = 4
4645
RFIDtoEEPROM myCard;
4746

47+
// Uncomment to use I2C EEPROM (EEPROMSize, I2CAddress, ByteNumber)
48+
// RFIDtoEEPROM_I2C myCard(RFIDtoEEPROM_I2C::kbits_256, 0x50, NUMBYTES);
49+
4850
byte Code[4];
4951

5052
void setup() {
@@ -53,6 +55,10 @@ void setup() {
5355
SPI.begin();
5456
rfid.PCD_Init();
5557

58+
// Uncomment to use I2C EEPROM
59+
// Wire.begin();
60+
// myCard.begin();
61+
5662
// Reset the Number of Cards
5763
// myCard.ClearCardNumber();
5864

library.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "RFID to EEPROM",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "Library to write an RFID code in the EEPROM in order to check if the code corresponds to a code already saved.",
5-
"keywords": ["rfid", "eeprom"],
5+
"keywords": ["rfid", "eeprom", "storage"],
66
"repository":
77
{
88
"type": "git",
@@ -16,5 +16,6 @@
1616
},
1717
"license": "MIT",
1818
"frameworks": "arduino",
19-
"platforms": "atmelavr"
19+
"platforms": ["atmelavr", "atmelmegaavr", "espressif32", "espressif8266", "raspberrypi"],
20+
"headers": "RFIDtoEEPROM.h"
2021
}

src/RFIDtoEEPROM/RFIDtoEEPROM_I2C.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ RFIDtoEEPROM_I2C::RFIDtoEEPROM_I2C(eeprom_size_t eepromSize, uint8_t address, ui
3737
_twoAddress = eepromSize > kbits_16 ? true : false;
3838
}
3939

40-
4140
/*!
4241
@brief Set the I2C communication frequency.
4342
@param twiFreq Frequency.

0 commit comments

Comments
 (0)