-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Returns card type (mifare 1k, 4k, ...) based on SAK - Functions for reading/writing from/to memory on MIFARE Classic cards - Sector Trailer block protection (write prevented by default, configurable via menuconfig) - Hard reset via RST pin (optional, auto switch to soft if hard fails) - Firing events when picc changes state (all states described in 14443 iso are supported) - Added examples - Basic for getting UID and type of the card - Dump whole card memory content - Reading and writing from/to card memory - Unit tests - CI - Run unit tests - Build examples - Returns UID length, and UID is now in the form of a byte array - resolves #41 - resolves #23 - Rewritten read_write test. Using PCD fifo buffer now to test if the library can read/write multiple bytes - resolves #37 (hopefully) - Firing event when card disappears from the scanner field - Additional affected issues: - closes #40 - closes #25 because library is fully rewritten, and this should be tried again (feel free to reopen the issue if you are facing the same issue in the new version)
- Loading branch information
Showing
55 changed files
with
4,426 additions
and
1,103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Validate | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "0 0 * * 6" | ||
|
||
jobs: | ||
format_check: | ||
name: "Check formatting" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: 'clang-format check' | ||
uses: jidicula/[email protected] | ||
with: | ||
clang-format-version: 18 | ||
|
||
unit_test: | ||
name: "Unit test" | ||
runs-on: ubuntu-latest | ||
|
||
needs: | ||
- format_check | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: rc522 | ||
|
||
- name: "Unit test" | ||
uses: espressif/esp-idf-ci-action@v1 | ||
with: | ||
path: rc522/test | ||
esp_idf_version: release-v5.3 | ||
target: linux | ||
command: idf.py build && ./build/test.elf | ||
|
||
build_examples: | ||
name: "Build example" | ||
runs-on: ubuntu-latest | ||
|
||
needs: | ||
- unit_test | ||
|
||
strategy: | ||
matrix: | ||
example: | ||
- basic | ||
- basic_i2c | ||
- memory_dump | ||
- read_write | ||
idf_ver: | ||
- release-v5.0 | ||
- release-v5.1 | ||
- release-v5.2 | ||
- release-v5.3 | ||
idf_target: | ||
- esp32 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: rc522 | ||
|
||
- name: Build | ||
uses: espressif/esp-idf-ci-action@v1 | ||
with: | ||
path: rc522/examples/${{ matrix.example }} | ||
esp_idf_version: ${{ matrix.idf_ver }} | ||
target: ${{ matrix.idf_target }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
sdkconfig.old | ||
sdkconfig | ||
.vscode | ||
/examples/**/dependencies.lock | ||
dependencies.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,36 @@ | ||
idf_component_register( | ||
INCLUDE_DIRS include | ||
SRCS src/rc522.c | ||
REQUIRES esp_event driver | ||
INCLUDE_DIRS | ||
include | ||
PRIV_INCLUDE_DIRS | ||
private_include | ||
SRCS | ||
src/rc522.c | ||
src/rc522_helpers.c | ||
src/rc522_pcd.c | ||
src/rc522_picc.c | ||
src/picc/rc522_mifare.c | ||
src/rc522_driver.c | ||
src/driver/rc522_spi.c | ||
src/driver/rc522_i2c.c | ||
REQUIRES | ||
esp_event | ||
# esp_driver_spi # introduced in esp-idf 5.3, autoincluded in 'driver' component | ||
driver # required for i2c, TODO: migrate to the new API | ||
) | ||
|
||
target_compile_options(${COMPONENT_LIB} PRIVATE | ||
-Werror # Warning as error | ||
#-pedantic | ||
-Wextra | ||
-Wall | ||
-Wshadow | ||
-Wcast-qual | ||
-Wswitch-default | ||
#-Wswitch-enum | ||
#-Wconversion | ||
-Wunreachable-code | ||
-Wuninitialized | ||
-Winit-self | ||
-Wpointer-arith | ||
-Werror-implicit-function-declaration | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
menu "RC522" | ||
|
||
config RC522_PREVENT_SECTOR_TRAILER_WRITE | ||
bool "Prevent writing to the Sector Trailer block" | ||
default y | ||
help | ||
The Sector Trailer block stores authentication keys | ||
and access bits. Enabling this option prevents writing | ||
to the Trailer block. This is enabled by default to protect | ||
inexperienced users from accidentally overwriting keys or | ||
writing incorrect access bits, which could render the sector | ||
unusable. | ||
|
||
endmenu |
Oops, something went wrong.