Repository navigation
Project Structure
The repository contains two independent codebases: the Arduino sketch in
firmware/ and the Rust host tool in cli/. The CLI is a library with a thin
binary, which keeps the serial and command layers testable without hardware.
RFID_Access_Control/
├── firmware/ C++ for the ESP32 Arduino core
│ ├── firmware.ino setup() and loop()
│ ├── Config.h pins, limits, baud, lockout, timezone defaults
│ ├── DatabaseManager.h/.cpp PSRAM-backed sorted array, users.bin, selective saves
│ ├── DisplayManager.h/.cpp LCD screens
│ ├── RFIDManager.h/.cpp PN532 over hardware SPI
│ ├── SerialProtocol.h/.cpp JSON control lines and raw bulk transfers
│ ├── NetworkManager.h/.cpp Wi-Fi, NTP, timezone in NVS
│ ├── BuzzerManager.h/.cpp passive buzzer sequences
│ ├── SystemController.h/.cpp state machine and command handlers
│ ├── ImportProfiler.h/.cpp import timing, not part of the stable protocol
│ ├── SyncProfiler.h/.cpp sync timing
│ ├── MicroTimer.h microsecond timing helper
│ ├── partitions.csv 16 MB layout, 12 MB LittleFS, coredump partition
│ ├── uploader.ps1 compile/upload/monitor on Windows
│ └── uploader.sh compile/upload/monitor on Linux and macOS
├── cli/ Rust crate "rfid-cli"
│ ├── Cargo.toml, Cargo.lock Rust 1.90+, lockfile committed
│ ├── src/
│ │ ├── main.rs argument parsing and exit codes
│ │ ├── lib.rs module map
│ │ ├── cli.rs clap definitions
│ │ ├── commands/ users, device, scan, bulk, sync
│ │ ├── repl.rs interactive shell
│ │ ├── serial.rs discovery, framing, retries, raw transfers
│ │ ├── protocol.rs typed requests and responses
│ │ ├── convert.rs users.bin codec, CRC32, sync entries
│ │ ├── userfile.rs JSON, CSV and .bin I/O
│ │ ├── database.rs Uid, names, dates, validity
│ │ ├── ui.rs messages, tables, progress bars, prompts
│ │ ├── sync_stats.rs timing model for sync --stats
│ │ ├── interrupt.rs Ctrl+C as a polled flag
│ │ └── error.rs one error type and exit codes
│ ├── tests/
│ │ ├── device_sim.rs end-to-end tests against a firmware simulator
│ │ └── golden/ byte vectors for the users.bin codec
│ └── samples/ users_example.csv, users_example.json
├── docs/
│ └── firmware-1.1.0-to-1.2.0.diff
├── .github/workflows/
│ ├── cli.yml stable and 1.90 tests, clippy
│ ├── firmware.yml ESP32-S3 compile
│ └── release.yml release archives on v* tags
├── CHOICES_AND_MODIFICATIONS.md
├── Wiring.png
├── LICENSE.md
└── README.md
cli/usersdata/ and cli/backups/ are git-ignored because they can contain
badge holders' names. wiki/ is a separate Git repository and is also ignored
by the main repository.
Each module only depends on the ones before it in this table. That is what lets the serial protocol and command handlers run against the simulator.
| Module | Responsibility |
|---|---|
error, interrupt
|
Error type and exit codes; Ctrl+C as a flag |
convert |
Record encoding, per-record CRC, database CRC, sync entries |
database |
UID, name and date validation; UserEntry
|
userfile |
One loader and writer for JSON, CSV and .bin
|
protocol |
Request enum and typed response views |
serial |
Port discovery, framing, retries, raw transfers |
ui, sync_stats
|
Output and sync timing |
cli, commands, repl
|
Command definitions, handlers, shell |
serial::Link is the boundary between the real port and the simulator. The
end-to-end tests implement that trait with an in-memory version of the firmware
protocol and run the normal command handlers against it.
cd cli
cargo test --lockedThere are 51 tests: 38 unit tests and 13 end-to-end tests. The unit tests cover
the codec, date and name validation, parsing, protocol serialization and clap
rules. The end-to-end tests cover import over both transports, export, sync and
its date rules, retries, noise lines, scan events, remove --except, backups,
import abort, and offline commands. See Development for the
local build commands.
GateCore · gatecore-firmware 1.2.0 · gatecore-cli 2.0.1 · ESP32-S3 + PN532
README · Changelog · Issues · MIT License