20 Arduino Easy API
This document introduces a simplified Arduino-facing API layer built on top of the existing C99 core APIs.
Goals
- Keep the original low-level APIs intact.
- Provide a small set of high-frequency calls for sketch authors.
- Reduce boilerplate in setup/loop paths.
Header and Entry
- Arduino include entry:
src/OSynapticFX.h - Easy API header:
include/osfx_easy.h - Easy API implementation:
src/osfx_easy.c - Reference sketch:
examples/EasyQuickStart/EasyQuickStart.ino
Example Matrix (Current)
- Easy-first entry:
examples/EasyQuickStart/EasyQuickStart.ino
- Core API examples:
examples/BasicEncode/BasicEncode.inoexamples/PacketMetaDecode/PacketMetaDecode.inoexamples/FusionAutoMode/FusionAutoMode.inoexamples/MultiSensorNodePacket/MultiSensorNodePacket.inoexamples/SecureSessionRoundtrip/SecureSessionRoundtrip.ino
- Advanced runtime / diagnostics examples:
examples/FusionModeTest/FusionModeTest.inoexamples/BootCliOrRun/BootCliOrRun.inoexamples/QuickBench/QuickBench.ino
Easy API Surface
Context type:
osfx_easy_context
Init and configuration:
osfx_easy_initosfx_easy_set_nodeosfx_easy_set_tidosfx_easy_set_aid
AID allocator helpers:
osfx_easy_init_id_allocatorosfx_easy_allocate_aidosfx_easy_touch_aidosfx_easy_save_idsosfx_easy_load_idsosfx_easy_is_aid_ready
Encode helpers:
osfx_easy_encode_sensor_autoosfx_easy_encode_multi_sensor_autoosfx_easy_cmd_name
Minimal Single-Sensor Flow
- Call
osfx_easy_initonce. - Call
osfx_easy_init_id_allocatorandosfx_easy_allocate_aidinsetup. - Call
osfx_easy_encode_sensor_autoinloop. - Print command via
osfx_easy_cmd_namefor debugging.
Reference: examples/EasyQuickStart/EasyQuickStart.ino
Minimal Multi-Sensor Flow
- Init context as above.
- Set node info through
osfx_easy_set_node. - Build
osfx_core_sensor_input[]. - Call
osfx_easy_encode_multi_sensor_auto.
Notes
- Easy API still uses the same wire format and fusion behavior as core APIs.
osfx_easy_load_idsrestores lease table state, but does not auto-select a local current AID. After load, callosfx_easy_allocate_aidorosfx_easy_set_aidexplicitly.- For advanced behavior (secure session, protocol matrix dispatch, CLI bridges), continue using core/runtime APIs directly.