oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Macros
OVE_*_DEFINE_STATIC Macros

One-step static primitive declaration with automatic initialisation. More...

Collaboration diagram for OVE_*_DEFINE_STATIC Macros:

Macros

#define OVE_MUTEX_DEFINE_STATIC(name)
 Declare and auto-initialise a static mutex.
 
#define OVE_RECURSIVE_MUTEX_DEFINE_STATIC(name)
 Declare and auto-initialise a static recursive mutex.
 
#define OVE_SEM_DEFINE_STATIC(name, initial, max)
 Declare and auto-initialise a static semaphore.
 
#define OVE_EVENT_DEFINE_STATIC(name)
 Declare and auto-initialise a static event object.
 
#define OVE_CONDVAR_DEFINE_STATIC(name)
 Declare and auto-initialise a static condition variable.
 
#define OVE_THREAD_DEFINE_STATIC(hname, stack_sz, fn, ctx, prio, tname)
 Declare and auto-initialise a static thread.
 
#define OVE_QUEUE_DEFINE_STATIC(name, item_sz, max)
 Declare and auto-initialise a static message queue.
 
#define OVE_TIMER_DEFINE_STATIC(name, cb, user_data, period_ms, one_shot)
 Declare and auto-initialise a static timer.
 
#define OVE_EVENTGROUP_DEFINE_STATIC(name)
 Declare and auto-initialise a static event group.
 
#define OVE_WORKQUEUE_DEFINE_STATIC(name, stack_sz, wq_name, prio)
 Declare and auto-initialise a static work queue.
 
#define OVE_WORK_DEFINE_STATIC(name, handler)
 Declare and auto-initialise a static work item.
 
#define OVE_STREAM_DEFINE_STATIC(name, buf_sz, trigger)
 Declare and auto-initialise a static stream buffer.
 
#define OVE_WATCHDOG_DEFINE_STATIC(name, timeout_ms)
 Declare and auto-initialise a static watchdog timer.
 
#define OVE_MODEL_DEFINE_STATIC(name, model_ptr, model_sz, arena_sz)
 Declare and auto-initialise a static ML model.
 
#define OVE_I2C_DEFINE_STATIC(name, inst, spd)
 Declare and auto-initialise a static I2C bus.
 
#define OVE_SPI_DEFINE_STATIC(name, cfg_ptr)
 Declare and auto-initialise a static SPI bus.
 
#define OVE_UART_DEFINE_STATIC(name, rx_buf_sz, cfg_ptr)
 Declare and auto-initialise a static UART.
 
#define OVE_I2S_DEFINE_STATIC(name, tx_dma_bytes, rx_dma_bytes, cfg_ptr)
 Declare and auto-initialise a static I2S bus with caller-supplied DMA buffers.
 
#define OVE_NETIF_DEFINE_STATIC(name)
 Declare and auto-initialise a static network interface.
 
#define OVE_SOCKET_DEFINE(name)   static ove_socket_storage_t name
 Declare a static socket storage variable named name.
 
#define OVE_TLS_DEFINE_STATIC(name)
 Declare and auto-initialise a static TLS session.
 
#define OVE_HTTP_CLIENT_DEFINE_STATIC(name)
 Declare and auto-initialise a static HTTP client.
 
#define OVE_MQTT_CLIENT_DEFINE_STATIC(name)
 Declare and auto-initialise a static MQTT client.
 

Detailed Description

One-step static primitive declaration with automatic initialisation.

Each macro declares a handle, allocates the corresponding static storage, and registers a C constructor (__attribute__((constructor))) that initialises the handle before main(). No runtime init boilerplate is needed.

The constructor calls the corresponding _init() function with static storage in both heap and zero-heap modes — the macros perform a true static allocation regardless of build configuration.

Usage:

OVE_QUEUE_DEFINE_STATIC(my_q, sizeof(int), 8);
// my_q is ready to use in any function.
#define OVE_QUEUE_DEFINE_STATIC(name, item_sz, max)
Declare and auto-initialise a static message queue.
Definition storage.h:673

Macro Definition Documentation

◆ OVE_MUTEX_DEFINE_STATIC

#define OVE_MUTEX_DEFINE_STATIC (   name)
Value:
static ove_mutex_storage_t _##name##_storage; \
static ove_mutex_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_mutex_init(&name, &_##name##_storage); \
OVE_DEFINE_STATIC_CTOR_END_(name)
OVE_NODISCARD int ove_mutex_init(ove_mutex_t *mtx, ove_mutex_storage_t *storage) OVE_NONNULL(1
Initialise a non-recursive mutex using caller-supplied static storage.
struct ove_mutex * ove_mutex_t
Opaque handle for a mutex object.
Definition types.h:211

Declare and auto-initialise a static mutex.

Parameters
nameVariable name for the resulting ove_mutex_t handle.

◆ OVE_RECURSIVE_MUTEX_DEFINE_STATIC

#define OVE_RECURSIVE_MUTEX_DEFINE_STATIC (   name)
Value:
static ove_mutex_storage_t _##name##_storage; \
static ove_mutex_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_recursive_mutex_init(&name, &_##name##_storage); \
OVE_DEFINE_STATIC_CTOR_END_(name)
OVE_NODISCARD int ove_recursive_mutex_init(ove_mutex_t *mtx, ove_mutex_storage_t *storage) OVE_NONNULL(1
Initialise a recursive mutex using caller-supplied static storage.

Declare and auto-initialise a static recursive mutex.

Parameters
nameVariable name for the resulting ove_mutex_t handle.

◆ OVE_SEM_DEFINE_STATIC

#define OVE_SEM_DEFINE_STATIC (   name,
  initial,
  max 
)
Value:
static ove_sem_storage_t _##name##_storage; \
static ove_sem_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_sem_init(&name, &_##name##_storage, (initial), (max)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
OVE_NODISCARD int ove_sem_init(ove_sem_t *sem, ove_sem_storage_t *storage, unsigned int initial, unsigned int max) OVE_NONNULL(1
Initialise a counting semaphore using caller-supplied static storage.
struct ove_sem * ove_sem_t
Opaque handle for a counting semaphore object.
Definition types.h:214

Declare and auto-initialise a static semaphore.

Parameters
nameVariable name for the resulting ove_sem_t handle.
initialInitial semaphore count.
maxMaximum semaphore count.

◆ OVE_EVENT_DEFINE_STATIC

#define OVE_EVENT_DEFINE_STATIC (   name)
Value:
static ove_event_storage_t _##name##_storage; \
static ove_event_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_event_init(&name, &_##name##_storage); \
OVE_DEFINE_STATIC_CTOR_END_(name)
OVE_NODISCARD int ove_event_init(ove_event_t *evt, ove_event_storage_t *storage) OVE_NONNULL(1
Initialise a binary event object using caller-supplied static storage.
struct ove_event * ove_event_t
Opaque handle for a binary event (signal/wait) object.
Definition types.h:217

Declare and auto-initialise a static event object.

Parameters
nameVariable name for the resulting ove_event_t handle.

◆ OVE_CONDVAR_DEFINE_STATIC

#define OVE_CONDVAR_DEFINE_STATIC (   name)
Value:
static ove_condvar_storage_t _##name##_storage; \
static ove_condvar_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_condvar_init(&name, &_##name##_storage); \
OVE_DEFINE_STATIC_CTOR_END_(name)
OVE_NODISCARD int OVE_NODISCARD int ove_condvar_init(ove_condvar_t *cv, ove_condvar_storage_t *storage) OVE_NONNULL(1
Initialise a condition variable using caller-supplied static storage.
struct ove_condvar * ove_condvar_t
Opaque handle for a condition variable object.
Definition types.h:220

Declare and auto-initialise a static condition variable.

Parameters
nameVariable name for the resulting ove_condvar_t handle.

◆ OVE_THREAD_DEFINE_STATIC

#define OVE_THREAD_DEFINE_STATIC (   hname,
  stack_sz,
  fn,
  ctx,
  prio,
  tname 
)
Value:
static ove_thread_storage_t _##hname##_storage; \
OVE_THREAD_STACK_DEFINE_(_##hname##_stack, stack_sz); \
static ove_thread_t hname; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(hname) \
int _err = ove_thread_init(&hname, &_##hname##_storage, (tname), (fn), (ctx), (prio), \
(stack_sz), _##hname##_stack); \
OVE_DEFINE_STATIC_CTOR_END_(hname)
int ove_thread_init(ove_thread_t *handle, ove_thread_storage_t *storage, const char *name, ove_thread_fn entry, void *arg, ove_prio_t priority, size_t stack_size, void *stack)
Initialise a thread using caller-supplied static storage and stack.
struct ove_thread * ove_thread_t
Opaque handle for a thread object.
Definition types.h:208

Declare and auto-initialise a static thread.

Parameters
hnameVariable name for the resulting ove_thread_t handle.
stack_szThread stack size in bytes.
fnThread entry function.
ctxArgument passed to fn.
prioThread priority.
tnameHuman-readable thread name string.

◆ OVE_QUEUE_DEFINE_STATIC

#define OVE_QUEUE_DEFINE_STATIC (   name,
  item_sz,
  max 
)
Value:
static ove_queue_storage_t _##name##_storage; \
static uint8_t _##name##_buf[(item_sz) * (max)]; \
static ove_queue_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_queue_init(&name, &_##name##_storage, _##name##_buf, (item_sz), (max)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
OVE_NODISCARD int ove_queue_init(ove_queue_t *q, ove_queue_storage_t *storage, void *buffer, size_t item_size, unsigned int max_items) OVE_NONNULL(1
Initialise a queue using caller-supplied static storage and data buffer.
struct ove_queue * ove_queue_t
Opaque handle for a message queue object.
Definition queue.h:40

Declare and auto-initialise a static message queue.

Parameters
nameVariable name for the resulting ove_queue_t handle.
item_szSize of each queue item in bytes.
maxMaximum number of items in the queue.

◆ OVE_TIMER_DEFINE_STATIC

#define OVE_TIMER_DEFINE_STATIC (   name,
  cb,
  user_data,
  period_ms,
  one_shot 
)
Value:
static ove_timer_storage_t _##name##_storage; \
static ove_timer_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_timer_init(&name, &_##name##_storage, (cb), (user_data), (period_ms), \
(one_shot)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_timer_init(ove_timer_t *timer, ove_timer_storage_t *storage, ove_timer_fn callback, void *user_data, uint32_t period_ms, int one_shot)
Initialise a software timer using caller-supplied static storage.
struct ove_timer * ove_timer_t
Opaque handle for a software timer object.
Definition timer.h:37

Declare and auto-initialise a static timer.

Parameters
nameVariable name for the resulting ove_timer_t handle.
cbTimer expiry callback.
user_dataOpaque pointer forwarded to cb.
period_msTimer period in milliseconds.
one_shotNon-zero for a one-shot timer, zero for periodic.

◆ OVE_EVENTGROUP_DEFINE_STATIC

#define OVE_EVENTGROUP_DEFINE_STATIC (   name)
Value:
static ove_eventgroup_storage_t _##name##_storage; \
static ove_eventgroup_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_eventgroup_init(&name, &_##name##_storage); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_eventgroup_init(ove_eventgroup_t *eg, ove_eventgroup_storage_t *storage)
Initialise an event group using caller-provided static storage.
struct ove_eventgroup * ove_eventgroup_t
Opaque handle for an event-group (bit-field) object.
Definition types.h:223

Declare and auto-initialise a static event group.

Parameters
nameVariable name for the resulting ove_eventgroup_t handle.

◆ OVE_WORKQUEUE_DEFINE_STATIC

#define OVE_WORKQUEUE_DEFINE_STATIC (   name,
  stack_sz,
  wq_name,
  prio 
)
Value:
static ove_workqueue_storage_t _##name##_storage; \
OVE_THREAD_STACK_DEFINE_(_##name##_stack, (stack_sz)); \
static ove_workqueue_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_workqueue_init(&name, &_##name##_storage, (wq_name), (prio), (stack_sz), \
_##name##_stack); \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_workqueue * ove_workqueue_t
Opaque handle for a work queue object.
Definition types.h:226
int ove_workqueue_init(ove_workqueue_t *wq, ove_workqueue_storage_t *storage, const char *name, ove_prio_t priority, size_t stack_size, void *stack)
Initialise a work queue using caller-provided static storage.

Declare and auto-initialise a static work queue.

Parameters
nameVariable name for the resulting ove_workqueue_t handle.
stack_szStack size in bytes for the work queue thread.
wq_nameHuman-readable work queue name string.
prioThread priority for the work queue thread.

◆ OVE_WORK_DEFINE_STATIC

#define OVE_WORK_DEFINE_STATIC (   name,
  handler 
)
Value:
static ove_work_storage_t _##name##_storage; \
static ove_work_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_work_init_static(&name, &_##name##_storage, (handler)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_work * ove_work_t
Opaque handle for a deferred work item.
Definition types.h:229
int ove_work_init_static(ove_work_t *work, ove_work_storage_t *storage, ove_work_fn handler)
Initialise a work item using caller-provided static storage.

Declare and auto-initialise a static work item.

Parameters
nameVariable name for the resulting ove_work_t handle.
handlerWork handler function invoked when the item is executed.

◆ OVE_STREAM_DEFINE_STATIC

#define OVE_STREAM_DEFINE_STATIC (   name,
  buf_sz,
  trigger 
)
Value:
static ove_stream_storage_t _##name##_storage; \
static uint8_t _##name##_buf[(buf_sz) + 1]; \
static ove_stream_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_stream_init(&name, &_##name##_storage, _##name##_buf, (buf_sz), (trigger)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_stream_init(ove_stream_t *stream, ove_stream_storage_t *storage, void *buffer, size_t size, size_t trigger)
Initialise a stream using caller-provided static storage.
struct ove_stream * ove_stream_t
Opaque handle for a byte-stream (ring-buffer) object.
Definition types.h:232

Declare and auto-initialise a static stream buffer.

Parameters
nameVariable name for the resulting ove_stream_t handle.
buf_szStream buffer capacity in bytes.
triggerMinimum bytes required before a blocked reader is unblocked.

◆ OVE_WATCHDOG_DEFINE_STATIC

#define OVE_WATCHDOG_DEFINE_STATIC (   name,
  timeout_ms 
)
Value:
static ove_watchdog_storage_t _##name##_storage; \
static ove_watchdog_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_watchdog_init(&name, &_##name##_storage, (timeout_ms)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_watchdog * ove_watchdog_t
Opaque handle for a software watchdog object.
Definition types.h:235
int ove_watchdog_init(ove_watchdog_t *wdt, ove_watchdog_storage_t *storage, uint32_t timeout_ms)
Initialise a watchdog timer using caller-provided static storage.

Declare and auto-initialise a static watchdog timer.

Parameters
nameVariable name for the resulting ove_watchdog_t handle.
timeout_msWatchdog timeout in milliseconds.

◆ OVE_MODEL_DEFINE_STATIC

#define OVE_MODEL_DEFINE_STATIC (   name,
  model_ptr,
  model_sz,
  arena_sz 
)
Value:
static ove_model_storage_t _##name##_storage; \
static uint8_t __attribute__((aligned(16))) _##name##_arena[(arena_sz)]; \
static ove_model_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
struct ove_model_config _cfg = { \
.model_data = (model_ptr), \
.model_size = (model_sz), \
.arena_size = (arena_sz), \
}; \
int _err = ove_model_init(&name, &_##name##_storage, _##name##_arena, &_cfg); \
OVE_DEFINE_STATIC_CTOR_END_(name)

Declare and auto-initialise a static ML model.

Parameters
nameVariable name for the resulting ove_model_t handle.
model_ptrPointer to the .tflite FlatBuffer data.
model_szSize of the FlatBuffer in bytes.
arena_szTensor arena size in bytes (must be compile-time constant).

◆ OVE_I2C_DEFINE_STATIC

#define OVE_I2C_DEFINE_STATIC (   name,
  inst,
  spd 
)
Value:
static ove_i2c_storage_t _##name##_storage; \
static ove_i2c_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
struct ove_i2c_cfg _cfg = { \
.instance = (inst), \
.speed = (spd), \
}; \
int _err = ove_i2c_init(&name, &_##name##_storage, &_cfg); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_i2c_init(ove_i2c_t *i2c, ove_i2c_storage_t *storage, const struct ove_i2c_cfg *cfg)
Initialise an I2C bus using caller-provided static storage.
struct ove_i2c * ove_i2c_t
Opaque handle for an I2C bus controller.
Definition types.h:268
I2C bus configuration descriptor.
Definition i2c.h:60
unsigned int instance
Definition i2c.h:61
ove_i2c_speed_t speed
Definition i2c.h:62

Declare and auto-initialise a static I2C bus.

Parameters
nameVariable name for the resulting ove_i2c_t handle.
instPeripheral instance index.
spdBus speed (ove_i2c_speed_t).

◆ OVE_SPI_DEFINE_STATIC

#define OVE_SPI_DEFINE_STATIC (   name,
  cfg_ptr 
)
Value:
static ove_spi_storage_t _##name##_storage; \
static ove_spi_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_spi_init(&name, &_##name##_storage, (cfg_ptr)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_spi_init(ove_spi_t *spi, ove_spi_storage_t *storage, const struct ove_spi_cfg *cfg)
Initialise an SPI bus controller with caller-provided storage.
struct ove_spi * ove_spi_t
Opaque handle for an SPI bus controller.
Definition types.h:265

Declare and auto-initialise a static SPI bus.

Parameters
nameVariable name for the resulting ove_spi_t handle.
cfg_ptrPointer to a struct ove_spi_cfg.

◆ OVE_UART_DEFINE_STATIC

#define OVE_UART_DEFINE_STATIC (   name,
  rx_buf_sz,
  cfg_ptr 
)
Value:
static ove_uart_storage_t _##name##_storage; \
static uint8_t _##name##_rx_buf[(rx_buf_sz)]; \
static ove_uart_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_uart_init(&name, &_##name##_storage, _##name##_rx_buf, (cfg_ptr)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_uart * ove_uart_t
Opaque handle for a UART peripheral.
Definition types.h:262
int ove_uart_init(ove_uart_t *uart, ove_uart_storage_t *storage, void *rx_buf, const struct ove_uart_cfg *cfg)
Initialise a UART using caller-provided static storage.

Declare and auto-initialise a static UART.

Parameters
nameVariable name for the resulting ove_uart_t handle.
rx_buf_szRX buffer size in bytes (must be compile-time constant).
cfg_ptrPointer to a struct ove_uart_cfg.

◆ OVE_I2S_DEFINE_STATIC

#define OVE_I2S_DEFINE_STATIC (   name,
  tx_dma_bytes,
  rx_dma_bytes,
  cfg_ptr 
)
Value:
static ove_i2s_storage_t _##name##_storage; \
static uint8_t __attribute__((aligned(4))) _##name##_tx_buf[(tx_dma_bytes)]; \
static uint8_t __attribute__((aligned(4))) _##name##_rx_buf[(rx_dma_bytes)]; \
static ove_i2s_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_i2s_init(&name, &_##name##_storage, _##name##_tx_buf, _##name##_rx_buf, \
(cfg_ptr)); \
OVE_DEFINE_STATIC_CTOR_END_(name)

Declare and auto-initialise a static I2S bus with caller-supplied DMA buffers.

Emits a storage object, two 4-byte-aligned DMA byte arrays (tx_dma_bytes and rx_dma_bytes), and a handle. The constructor calls ove_i2s_init with all of them.

For a unidirectional configuration, pass 1 for the unused buffer's size — ove_i2s_init does not touch a buffer whose direction is disabled in cfg_ptr. The 1-byte placeholder keeps the array declaration valid (C does not allow zero-length arrays).

Parameters
nameVariable name for the resulting ove_i2s_t handle.
tx_dma_bytesTX DMA buffer size in bytes (compile-time constant).
rx_dma_bytesRX DMA buffer size in bytes (compile-time constant).
cfg_ptrPointer to a struct ove_i2s_cfg.

◆ OVE_NETIF_DEFINE_STATIC

#define OVE_NETIF_DEFINE_STATIC (   name)
Value:
static ove_netif_storage_t _##name##_storage; \
static ove_netif_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_netif_init(&name, &_##name##_storage); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_netif_init(ove_netif_t *netif, ove_netif_storage_t *storage)
Initialise a network interface from caller-supplied storage.
struct ove_netif * ove_netif_t
Opaque handle for a network interface.
Definition types.h:250

Declare and auto-initialise a static network interface.

The constructor only allocates the ove_netif_t handle and its storage; ove_netif_up() with a config must still be called by the application to bring the link up (DHCP vs static IP is a runtime decision).

Parameters
nameVariable name for the resulting ove_netif_t handle.

◆ OVE_SOCKET_DEFINE

#define OVE_SOCKET_DEFINE (   name)    static ove_socket_storage_t name

Declare a static socket storage variable named name.

The socket family / type are decided at ove_socket_open() time, so this macro only produces the storage; the application supplies the handle and calls ove_socket_open(&handle, &storage, af, type).

◆ OVE_TLS_DEFINE_STATIC

#define OVE_TLS_DEFINE_STATIC (   name)
Value:
static ove_tls_storage_t _##name##_storage; \
static ove_tls_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_tls_init(&name, &_##name##_storage); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_tls_init(ove_tls_t *tls, ove_tls_storage_t *storage)
Initialise a TLS session from caller-supplied storage.
struct ove_tls * ove_tls_t
Opaque handle for a TLS session.
Definition types.h:253

Declare and auto-initialise a static TLS session.

The mbedTLS context structures are embedded in the storage; their internal allocations come from the CONFIG_OVE_NET_TLS_HEAP_SIZE static buffer (zero-heap mode) or the system allocator (heap mode).

Parameters
nameVariable name for the resulting ove_tls_t handle.

◆ OVE_HTTP_CLIENT_DEFINE_STATIC

#define OVE_HTTP_CLIENT_DEFINE_STATIC (   name)
Value:
static ove_http_client_storage_t _##name##_storage; \
static ove_http_client_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_http_client_init(&name, &_##name##_storage); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_http_client_init(ove_http_client_t *client, ove_http_client_storage_t *storage)
Initialise an HTTP client from caller-supplied storage.
struct ove_http_client * ove_http_client_t
Opaque handle for an HTTP client.
Definition types.h:256

Declare and auto-initialise a static HTTP client.

Response body and headers borrow into a buffer of CONFIG_OVE_NET_HTTP_MAX_RESPONSE bytes embedded in the storage (zero-heap mode); the borrow is valid until the next request.

Parameters
nameVariable name for the resulting ove_http_client_t handle.

◆ OVE_MQTT_CLIENT_DEFINE_STATIC

#define OVE_MQTT_CLIENT_DEFINE_STATIC (   name)
Value:
static ove_mqtt_client_storage_t _##name##_storage; \
static ove_mqtt_client_t name; \
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_mqtt_client_init(&name, &_##name##_storage); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_mqtt_client_init(ove_mqtt_client_t *client, ove_mqtt_client_storage_t *storage)
Initialise an MQTT client from caller-supplied storage.
struct ove_mqtt_client * ove_mqtt_client_t
Opaque handle for an MQTT client.
Definition types.h:259

Declare and auto-initialise a static MQTT client.

Per-connection RX/TX buffers (CONFIG_OVE_NET_MQTT_RX_BUF / CONFIG_OVE_NET_MQTT_TX_BUF) are embedded in the storage.

Parameters
nameVariable name for the resulting ove_mqtt_client_t handle.