ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_modem_at.h
Go to the documentation of this file.
1
62
63#pragma once
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69#include <stddef.h>
70#include <stdint.h>
71
72#include "ra8_err.h"
73
86
90typedef enum : uint16_t {
93
109typedef struct {
117 ra8_err_t (*tx_byte)(void* ctx, uint8_t byte);
118
127 ra8_err_t (*rx_byte)(void* ctx, uint8_t* out_byte);
128
139 uint32_t (*now_ms)(void* ctx);
140
144 void* ctx;
146
160
168typedef void (*ra8_modem_at_urc_fn_t)(const char* line, void* ctx);
169
213[[nodiscard]] ra8_err_t ra8_modem_at_init(const ra8_modem_at_cfg_t* cfg);
214
257[[nodiscard]] ra8_err_t
258ra8_modem_at_send_cmd(const char* cmd, const char* expected_response, uint16_t timeout_ms);
259
291[[nodiscard]] ra8_err_t
292ra8_modem_at_send_cmd_capture(const char* cmd, char* out_buf, size_t buf_len, uint16_t timeout_ms);
293
323[[nodiscard]] ra8_err_t
325
344[[nodiscard]] ra8_err_t ra8_modem_at_poll(void);
345
346#ifdef __cplusplus
347}
348#endif
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_err_t ra8_modem_at_poll(void)
Pump the RX path without sending a command.
ra8_err_t ra8_modem_at_send_cmd_capture(const char *cmd, char *out_buf, size_t buf_len, uint16_t timeout_ms)
Send an AT command and capture the response payload.
ra8_err_t ra8_modem_at_register_unsolicited_handler(const char *prefix, ra8_modem_at_urc_fn_t fn, void *ctx)
Register a URC (unsolicited result code) handler.
ra8_err_t ra8_modem_at_send_cmd(const char *cmd, const char *expected_response, uint16_t timeout_ms)
Send an AT command and wait for OK/ERROR/expected.
void(* ra8_modem_at_urc_fn_t)(const char *line, void *ctx)
Unsolicited result-code (URC) handler signature.
ra8_modem_at_timeouts_t
Default per-command timeout when caller passes 0 ms.
@ k_ra8_modem_at_default_timeout_ms
RA8 modem at default timeout ms.
ra8_modem_at_limits_t
Compile-time tunables.
@ k_ra8_modem_at_max_prefix_len
Maximum bytes of a URC prefix (including + and :).
@ k_ra8_modem_at_max_unsolicited
Maximum number of registered URC handlers.
ra8_err_t ra8_modem_at_init(const ra8_modem_at_cfg_t *cfg)
Bind transport, buffer and timeout policy.
Configuration handed to ra8_modem_at_init.
uint16_t line_buf_len
Bytes in line_buf (>= 16).
uint8_t * line_buf
Caller-owned line accumulator buffer.
uint16_t default_timeout_ms
0 means use compiled default.
ra8_modem_at_io_t io
Byte transport (must be fully populated).
Byte-level transport injected into the AT driver (DIP).
uint32_t(* now_ms)(void *ctx)
Return monotonic time in milliseconds.
ra8_err_t(* rx_byte)(void *ctx, uint8_t *out_byte)
Try to receive a single byte without blocking.
ra8_err_t(* tx_byte)(void *ctx, uint8_t byte)
Transmit a single byte (blocking).
void * ctx
Opaque context passed to tx_byte/rx_byte/now_ms.