{"id":50996631,"url":"https://github.com/apadevices/apaserialsync","last_synced_at":"2026-06-20T10:03:10.796Z","repository":{"id":350821141,"uuid":"1208396161","full_name":"apadevices/APASerialSync","owner":"apadevices","description":"APASerialSync: The Ultimate Zero-Copy Data-Sync Engine for Arduino","archived":false,"fork":false,"pushed_at":"2026-04-12T09:49:06.000Z","size":590,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-12T10:12:00.230Z","etag":null,"topics":["arduino","arduino-library","bi-directional","cpp","data-synchronization","embedded","microcontroller","protocol","serial","serial-communication","transfer","uart-protocol"],"latest_commit_sha":null,"homepage":"https://ais-dev-dvam5rizdrcefwneu2ingf-152136505447.europe-west2.run.app","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apadevices.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-12T08:08:22.000Z","updated_at":"2026-04-12T09:49:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/apadevices/APASerialSync","commit_stats":null,"previous_names":["apadevices/apaserialsync"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/apadevices/APASerialSync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apadevices%2FAPASerialSync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apadevices%2FAPASerialSync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apadevices%2FAPASerialSync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apadevices%2FAPASerialSync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apadevices","download_url":"https://codeload.github.com/apadevices/APASerialSync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apadevices%2FAPASerialSync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34565244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-library","bi-directional","cpp","data-synchronization","embedded","microcontroller","protocol","serial","serial-communication","transfer","uart-protocol"],"created_at":"2026-06-20T10:03:10.023Z","updated_at":"2026-06-20T10:03:10.787Z","avatar_url":"https://github.com/apadevices.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# APASerialSync 🚀\n\n**The Ultimate Zero-Copy Data-Sync Engine for Arduino**\n\nStop fighting with manual Serial parsing. **APASerialSync** is a high-performance, memory-thrifty library that makes synchronizing complex data structures between microcontrollers as easy as a single function call.\n\n---\n\n## 🌟 Why APASerialSync?\n\n- 💎 **Zero-Copy Performance**: RAM is a luxury on 8-bit MCUs. Our architecture writes data directly into your variables, eliminating redundant internal buffers and maximizing efficiency.\n- 🔄 **True Bi-Directional Sync**: Move data both ways simultaneously without complex state machines or blocking your code.\n- 🌍 **MCU Agnostic**: Works seamlessly across AVR (Uno/Nano), ESP32, ESP8266, STM32, and more.\n- ⚡ **Non-Blocking Logic**: No `delay()` calls. Your main loop stays fast and responsive.\n- 🛡️ **Rock-Solid Reliability**: CRC16 checksums and Packet ID tracking ensure your data arrives 100% intact.\n- 🧩 **Type-Safe Templates**: Uses C++ templates to handle any `struct` or `class` with full type safety.\n\n---\n\n## 🎨 The APA Serial-Sync Designer\n\n![APA Serial-Sync Designer Screenshot](DESIGNER/designer_screenshot.png)\n\nDon't waste time writing boilerplate code by hand! We provide a powerful companion tool to help you get started:\n\n1.  **Online Version**: Use the **[Live Web Designer](https://ais-dev-dvam5rizdrcefwneu2ingf-152136505447.europe-west2.run.app)** to visually build your data structure and generate code.\n2.  **Local Version**: Check the `/DESIGNER` folder in this repository. It contains a ZIP file with the full designer tool that you can run locally on your machine (just open `index.html` in any browser).\n\n---\n\n## 🛠️ Installation\n\n1. Download this repository as a `.zip` file.\n2. In the Arduino IDE: **Sketch** -\u003e **Include Library** -\u003e **Add .ZIP Library...**\n3. Select the downloaded file.\n4. **Note**: If using `SoftwareSerial`, ensure you have it installed (usually built-in for AVR).\n\n---\n\n## 🔌 Wiring (The \"Golden Rules\")\n\nTo make the MCUs talk, you **must** follow these three rules:\n1. **Cross the wires**: MCU1 **TX** goes to MCU2 **RX**. MCU1 **RX** goes to MCU2 **TX**.\n2. **Common Ground**: Connect the **GND** pins of both MCUs together.\n3. **Voltage Match**: If using a 5V MCU (Uno) with a 3.3V MCU (ESP32), use a logic level shifter.\n\n---\n\n## 📖 Quick Start\n\n### 1. Define your Data\nBoth MCUs **must** use the exact same struct. We use `#pragma pack(push, 1)` to ensure the memory layout is identical on both sides.\n\n```cpp\n#pragma pack(push, 1)\nstruct MyData {\n  int counter;\n  float temperature;\n  bool ledStatus;\n};\n#pragma pack(pop)\n```\n\n### 2. Setup\nInitialize the Serial port first, then the library.\n\n```cpp\nMyData myData;\n// Pass the Serial port (e.g. Serial1) and your data variable\nAPASerialSync\u003cMyData\u003e sync(Serial1, myData);\n\nvoid setup() {\n  // 1. Start the Serial port at your desired speed\n  Serial1.begin(9600); \n  \n  // 2. Initialize the library\n  sync.apaBegin(); \n}\n```\n\n### 3. The Loop\n```cpp\nvoid loop() {\n  // Check for incoming data (non-blocking)\n  if (sync.apaSync()) {\n    // 'myData' has been updated automatically!\n    digitalWrite(LED_BUILTIN, myData.ledStatus);\n  }\n\n  // Send local changes (e.g. every 2 seconds)\n  static unsigned long lastSend = 0;\n  if (millis() - lastSend \u003e 2000) {\n    myData.counter++;\n    sync.apaSend(); \n    lastSend = millis();\n  }\n}\n```\n\n---\n\n## 📂 Folder Structure\n\n- `src/`: Library source code (`APASerialSync.h`).\n- `examples/`: Organized samples (Basic, Intermediate, Advanced).\n- `DESIGNER/`: Local version of the web-based code generator tool.\n- `library.properties`: Arduino library metadata.\n- `keywords.txt`: Syntax highlighting for Arduino IDE.\n\n---\n\n## ⚠️ Common Pitfalls\n*   **Forgot GND**: If grounds aren't connected, the signal has no reference and will fail.\n*   **Struct Mismatch**: If MCU1 has 4 variables and MCU2 has 3, the sync will fail CRC checks.\n*   **Blocking Code**: If your loop has long `delay()` calls, you might miss incoming serial data.\n\n---\n\n## ⚖️ License\nReleased under the **MIT License**. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapadevices%2Fapaserialsync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapadevices%2Fapaserialsync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapadevices%2Fapaserialsync/lists"}