Skip to content

File syn_port_serial.h

File List > port > syn_port_serial.h

Go to the documentation of this file

#ifndef SYN_PORT_SERIAL_H
#define SYN_PORT_SERIAL_H

#include "../common/syn_defs.h"

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

SYN_Status syn_port_serial_init(uint32_t baudrate);

int syn_port_serial_write(const uint8_t *data, size_t len);

int syn_port_serial_read(uint8_t *buf, size_t max_len);

/* ── Inline convenience helpers (not port obligations) ─────────────────── */

static inline int syn_port_serial_write_byte(uint8_t byte)
{
    return syn_port_serial_write(&byte, 1);
}

static inline int syn_port_serial_read_byte(uint8_t *byte)
{
    return syn_port_serial_read(byte, 1);
}

#ifdef __cplusplus
}
#endif

#endif /* SYN_PORT_SERIAL_H */