# stm32duino/m24sr64-y architecture

> Architecture diagram of the GitHub repository stm32duino/m24sr64-y, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stm32duino/m24sr64-y
- Repository: https://github.com/stm32duino/m24sr64-y

## Overview

This Arduino library builds, reads, and writes NDEF messages through the M24SR64-Y NFC/RFID tag IC over I2C. The principal workflow is sketch/API use → message and record construction → generic NDEF serialization → M24SR-specific tag operations → chip command and I2C handling; reads travel back through the tag abstraction. Record classes cover the documented text, URI, mail, SMS, MIME, and Android application records, plus Geo, vCard, and Wi-Fi records. Source excerpts are partial, so only documented or indexed relationships are shown.

Main entry points: [`src/Message.cpp`](https://github.com/stm32duino/m24sr64-y/blob/main/src/Message.cpp) (NDEF Message), [`src/RecordURI.h`](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordURI.h) (URI Record), [`src/NDefNfcTagM24SR.h`](https://github.com/stm32duino/m24sr64-y/blob/main/src/NDefNfcTagM24SR.h) (M24SR Tag Adapter), [`src/M24SR.cpp`](https://github.com/stm32duino/m24sr64-y/blob/main/src/M24SR.cpp) (M24SR Commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Library API"]
  node_facade["Tag API<br/>[M24SR.h]"]
end

subgraph group_ndef["NDEF Messages"]
  node_tag["Generic Tag<br/>[NDefNfcTag.h]"]
  node_message["NDEF Message<br/>[Message.cpp]"]
end

subgraph group_records["Record Types"]
  node_record["Record Base<br/>[Record.h]"]
  node_header["Record Header<br/>[RecordHeader.h]"]
  node_text["Text Record<br/>[RecordText.h]"]
  node_uri["URI Record<br/>[RecordURI.h]"]
  node_aar["Android App Record<br/>[RecordAAR.h]"]
  node_mime["MIME Record<br/>[RecordMimeType.h]"]
  node_mail["Mail Record<br/>[RecordMail.h]"]
  node_sms["SMS Record<br/>[RecordSMS.h]"]
  node_geo["Geo Record<br/>[RecordGeo.h]"]
  node_vcard["vCard Record<br/>[RecordVCard.h]"]
  node_wifi["Wi-Fi Record<br/>[RecordWifiConf.h]"]
end

subgraph group_device["M24SR Device"]
  node_adapter["M24SR Tag Adapter<br/>[NDefNfcTagM24SR.h]"]
  node_chip["M24SR Commands<br/>[M24SR.cpp]"]
  node_defs["Command Definitions<br/>[m24sr_def.h]"]
  node_nfc["NFC Interface<br/>[Nfc.h]"]
end

node_user(("Arduino Sketch"))
node_tagic[("M24SR64-Y")]

node_user -->|"calls API"| node_facade
node_facade -->|"creates adapter"| node_adapter
node_adapter -->|"implements"| node_tag
node_tag -->|"serializes"| node_message
node_message -->|"uses records"| node_record
node_record -->|"stores header"| node_header
node_message -->|"constructs"| node_text
node_message -->|"constructs"| node_aar
node_message -->|"constructs"| node_mime
node_message -->|"constructs"| node_uri
node_mail -->|"specializes"| node_uri
node_sms -->|"specializes"| node_uri
node_geo -->|"specializes"| node_uri
node_vcard -->|"specializes"| node_mime
node_chip -->|"uses commands"| node_defs
node_defs -->|"uses interface"| node_nfc
node_adapter -.->|"delegates I/O"| node_chip
node_chip -.->|"reads and writes"| node_tagic

click node_facade "https://github.com/stm32duino/m24sr64-y/blob/main/src/M24SR.h"
click node_tag "https://github.com/stm32duino/m24sr64-y/blob/main/src/NDefNfcTag.h"
click node_adapter "https://github.com/stm32duino/m24sr64-y/blob/main/src/NDefNfcTagM24SR.h"
click node_message "https://github.com/stm32duino/m24sr64-y/blob/main/src/Message.cpp"
click node_record "https://github.com/stm32duino/m24sr64-y/blob/main/src/Record.h"
click node_header "https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordHeader.h"
click node_text "https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordText.h"
click node_uri "https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordURI.h"
click node_aar "https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordAAR.h"
click node_mime "https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordMimeType.h"
click node_mail "https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordMail.h"
click node_sms "https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordSMS.h"
click node_geo "https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordGeo.h"
click node_vcard "https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordVCard.h"
click node_wifi "https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordWifiConf.h"
click node_chip "https://github.com/stm32duino/m24sr64-y/blob/main/src/M24SR.cpp"
click node_defs "https://github.com/stm32duino/m24sr64-y/blob/main/src/m24sr_def.h"
click node_nfc "https://github.com/stm32duino/m24sr64-y/blob/main/src/Nfc.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_facade toneBlue
class node_tag,node_message,node_tagic toneAmber
class node_record,node_header,node_text,node_uri,node_aar,node_mime,node_mail,node_sms,node_geo,node_vcard,node_wifi toneMint
class node_adapter,node_chip,node_defs,node_nfc toneRose
class node_user toneIndigo
```

## Components

### Library API

- [Tag API](https://github.com/stm32duino/m24sr64-y/blob/main/src/M24SR.h): `src/M24SR.h`

### NDEF Messages

- [Generic Tag](https://github.com/stm32duino/m24sr64-y/blob/main/src/NDefNfcTag.h): `src/NDefNfcTag.h`
- [NDEF Message](https://github.com/stm32duino/m24sr64-y/blob/main/src/Message.cpp): `src/Message.cpp`

### Record Types

- [Record Base](https://github.com/stm32duino/m24sr64-y/blob/main/src/Record.h): `src/Record.h`
- [Record Header](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordHeader.h): `src/RecordHeader.h`
- [Text Record](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordText.h): `src/RecordText.h`
- [URI Record](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordURI.h): `src/RecordURI.h`
- [Android App Record](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordAAR.h): `src/RecordAAR.h`
- [MIME Record](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordMimeType.h): `src/RecordMimeType.h`
- [Mail Record](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordMail.h): `src/RecordMail.h`
- [SMS Record](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordSMS.h): `src/RecordSMS.h`
- [Geo Record](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordGeo.h): `src/RecordGeo.h`
- [vCard Record](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordVCard.h): `src/RecordVCard.h`
- [Wi-Fi Record](https://github.com/stm32duino/m24sr64-y/blob/main/src/RecordWifiConf.h): `src/RecordWifiConf.h`

### M24SR Device

- [M24SR Tag Adapter](https://github.com/stm32duino/m24sr64-y/blob/main/src/NDefNfcTagM24SR.h): `src/NDefNfcTagM24SR.h`
- [M24SR Commands](https://github.com/stm32duino/m24sr64-y/blob/main/src/M24SR.cpp): `src/M24SR.cpp`
- [Command Definitions](https://github.com/stm32duino/m24sr64-y/blob/main/src/m24sr_def.h): `src/m24sr_def.h`
- [NFC Interface](https://github.com/stm32duino/m24sr64-y/blob/main/src/Nfc.h): `src/Nfc.h`

### Other components

- **Arduino Sketch**
- **M24SR64-Y**

## Connections

- Arduino Sketch → Tag API: calls API (evidence: `README.md`)
- Tag API → M24SR Tag Adapter: creates adapter (evidence: `src/M24SR.cpp`)
- M24SR Tag Adapter → Generic Tag: implements (evidence: `src/NDefNfcTagM24SR.h`)
- Generic Tag → NDEF Message: serializes (evidence: `src/NDefNfcTag.h`)
- NDEF Message → Record Base: uses records (evidence: `src/Message.cpp`)
- Record Base → Record Header: stores header (evidence: `src/Record.h`)
- NDEF Message → Text Record: constructs (evidence: `src/Message.cpp`)
- NDEF Message → Android App Record: constructs (evidence: `src/Message.cpp`)
- NDEF Message → MIME Record: constructs (evidence: `src/Message.cpp`)
- NDEF Message → URI Record: constructs (evidence: `src/Message.cpp`)
- Mail Record → URI Record: specializes (evidence: `src/RecordMail.h`)
- SMS Record → URI Record: specializes (evidence: `src/RecordSMS.h`)
- Geo Record → URI Record: specializes (evidence: `src/RecordGeo.h`)
- vCard Record → MIME Record: specializes (evidence: `src/RecordVCard.h`)
- M24SR Commands → Command Definitions: uses commands (evidence: `src/M24SR.cpp`)
- Command Definitions → NFC Interface: uses interface (evidence: `src/m24sr_def.h`)
- M24SR Tag Adapter → M24SR Commands: delegates I/O (evidence: `src/M24SR.cpp`)
- M24SR Commands → M24SR64-Y: reads and writes
