Skip to main content
The ANX SDK is a C library that runs on top of ANX OS and gives your application direct access to all hardware peripherals and networking capabilities on ANX dev modules. Every module in the SDK maps to a dedicated header file and exposes a consistent, error-code-driven API so you can build reliable embedded applications without wrestling with low-level register access or OS internals.

SDK Modules

The SDK is organized into focused modules. Include only the headers you need to keep your binary lean.

Initialization

Core system setup, logging, delays, and device info via anx/anx.h.

GPIO

Digital I/O, pull resistors, and interrupt handlers via anx/gpio.h.

Communication

Serial protocols — UART, I2C, and SPI — via anx/uart.h, anx/i2c.h, and anx/spi.h.

ADC

Analog-to-digital conversion and channel sampling via anx/adc.h.

PWM

Pulse-width modulation output and duty-cycle control via anx/pwm.h.

Wi-Fi

Station and access-point mode, network scanning, and connection management via anx/wifi.h.

MQTT

Publish, subscribe, and broker connection management via anx/mqtt.h.

OTA

Over-the-air firmware updates and rollback support via anx/ota.h.

Including the SDK

Always include anx/anx.h as the first header in your application. It initializes the ANX OS integration layer and pulls in the common types — including anx_err_t — that every other module depends on.
main.c
ANX OS calls app_main() automatically after the hardware and config.json finish loading. You do not need to write a main() function yourself.

SDK Versioning

Call anx_sdk_version() at runtime to retrieve the SDK version string (for example, "1.2.0"). The SDK version must be compatible with the firmware version running on the device — compatibility requires that the MAJOR and MINOR components match exactly. A mismatch will cause anx_sdk_version() to log a warning on boot and may result in undefined behavior from certain API calls.
version_check.c
Print both versions on startup so that your serial logs always capture the exact firmware and SDK combination used during a test run.

Error Handling

Every ANX SDK function returns an anx_err_t value. Check the return value after every call — silent failures in embedded systems are difficult to diagnose in the field. Use anx_err_to_str() to convert an error code into a human-readable string for logging. Use the pattern below as a template for every SDK call in your application:
error_handling.c
Never ignore a non-ANX_OK return value in production code. Proceeding after a failed initialization call typically produces unpredictable hardware behavior that is hard to reproduce.