1// RFID lab R1 Wire & talk. uv run pio run -d labs/rfid-lab-r1 -e rfid-lab-r1 -t upload2// Talk to the reader chip itself, before any card: its version, the datasheet self-test,3// the FIFO, the registers. The card view is a preview of R2.4//5// Wiring: the screen from lesson 03, plus the RC522 (3.3V only):6// SDA->15 SCK->16 MOSI->17 MISO->18 IRQ->13 (optional) GND->GND RST->14 3.3V->3V37// The push button on GPIO 5 is optional: it does exactly what BOOT does.8//9// Views: chip · card (button: click = next, double-click = the action in the footer)10// Serial: help lists this lab's commands. The shared code is in kit/lib/rfid-lab-kit and kit/lib/rfid-kit.11#include "lab_commands.h"12 13namespace {14 15const LabView kViews[] = {16 {View::Chip, "selftest"},17 {View::Card, nullptr},18};19 20const LabCommand kCommands[] = {labcmd::kChip, labcmd::kReset, labcmd::kSelftest, labcmd::kLoopback, labcmd::kRegs, labcmd::kSpi, labcmd::kGain, labcmd::kTimeout, labcmd::kIrq};21 22const LabSpec kSpec{"rfid-lab-r1", "R1 Wire & talk", kViews, sizeof(kViews) / sizeof(kViews[0]), 0,23 kCommands, sizeof(kCommands) / sizeof(kCommands[0])};24 25Lab lab(kSpec);26 27} // namespace28 29void setup() { lab.begin(); }30 31void loop() { lab.loop(); }
// RFID lab R1 Wire & talk. uv run pio run -d labs/rfid-lab-r1 -e rfid-lab-r1 -t upload
// Talk to the reader chip itself, before any card: its version, the datasheet self-test,
// the FIFO, the registers. The card view is a preview of R2.
//
// Wiring: the screen from lesson 03, plus the RC522 (3.3V only):
// SDA->15 SCK->16 MOSI->17 MISO->18 IRQ->13 (optional) GND->GND RST->14 3.3V->3V3
// The push button on GPIO 5 is optional: it does exactly what BOOT does.
// Views: chip · card (button: click = next, double-click = the action in the footer)
// Serial: help lists this lab's commands. The shared code is in kit/lib/rfid-lab-kit and kit/lib/rfid-kit.
#include "lab_commands.h"
namespace {
const LabView kViews[] = {
{View::Chip, "selftest"},
{View::Card, nullptr},
};
const LabCommand kCommands[] = {labcmd::kChip, labcmd::kReset, labcmd::kSelftest, labcmd::kLoopback, labcmd::kRegs, labcmd::kSpi, labcmd::kGain, labcmd::kTimeout, labcmd::kIrq};
const LabSpec kSpec{"rfid-lab-r1", "R1 Wire & talk", kViews, sizeof(kViews) / sizeof(kViews[0]), 0,
kCommands, sizeof(kCommands) / sizeof(kCommands[0])};
Lab lab(kSpec);
} // namespace
void setup() { lab.begin(); }
void loop() { lab.loop(); }
New word #include
#include
Pastes another file in here, so this file can use what it declares.
PlatformIO environment rfid-lab-r1 includes C++ source files covering SPI address byte, registers, FIFO, datasheet self-test, two SPI buses, reading a bus fault.