NHAL Interface v0.5.0
Hardware Abstraction Layer Interface for Embedded Systems
Loading...
Searching...
No Matches
Functions
nhal_uart_basic.h File Reference

Hardware Abstraction Layer (HAL) for synchronous UART communication. More...

#include <stddef.h>
#include <stdint.h>
#include "nhal_common.h"
#include "nhal_uart_types.h"

Go to the source code of this file.

Functions

nhal_result_t nhal_uart_init (struct nhal_uart_context *ctx)
 Initialize UART context in basic mode.
 
nhal_result_t nhal_uart_deinit (struct nhal_uart_context *ctx)
 Deinitialize UART context.
 
nhal_result_t nhal_uart_set_config (struct nhal_uart_context *ctx, struct nhal_uart_config *cfg)
 Set UART configuration.
 
nhal_result_t nhal_uart_get_config (struct nhal_uart_context *ctx, struct nhal_uart_config *cfg)
 Get current UART configuration.
 
nhal_result_t nhal_uart_write (struct nhal_uart_context *ctx, const uint8_t *data, size_t len)
 Write data to UART (blocking)
 
nhal_result_t nhal_uart_read (struct nhal_uart_context *ctx, uint8_t *data, size_t len)
 Read data from UART (blocking)
 

Detailed Description

Hardware Abstraction Layer (HAL) for synchronous UART communication.

This header defines the public interface for synchronous (blocking) UART operations. It provides functions for initializing, deinitializing, configuring, writing to, and reading from UART instances in blocking mode.

Synchronous mode provides blocking operations with automatic transfer optimization. All operations block until completion or timeout.

Note
For asynchronous operations, see nhal_uart_async.h

Definition in file nhal_uart_basic.h.

Function Documentation

◆ nhal_uart_deinit()

nhal_result_t nhal_uart_deinit ( struct nhal_uart_context ctx)

Deinitialize UART context.

Parameters
ctxPointer to UART context structure
Returns
NHAL_OK on success, error code otherwise

◆ nhal_uart_get_config()

nhal_result_t nhal_uart_get_config ( struct nhal_uart_context ctx,
struct nhal_uart_config cfg 
)

Get current UART configuration.

Parameters
ctxPointer to UART context structure
cfgPointer to configuration structure to fill
Returns
NHAL_OK on success, error code otherwise

◆ nhal_uart_init()

nhal_result_t nhal_uart_init ( struct nhal_uart_context ctx)

Initialize UART context in basic mode.

Parameters
ctxPointer to UART context structure
Returns
NHAL_OK on success, error code otherwise

◆ nhal_uart_read()

nhal_result_t nhal_uart_read ( struct nhal_uart_context ctx,
uint8_t *  data,
size_t  len 
)

Read data from UART (blocking)

Parameters
ctxPointer to UART context structure
dataPointer to buffer for received data
lenNumber of bytes to read
timeoutTimeout in milliseconds
Returns
NHAL_OK on success, error code otherwise

◆ nhal_uart_set_config()

nhal_result_t nhal_uart_set_config ( struct nhal_uart_context ctx,
struct nhal_uart_config cfg 
)

Set UART configuration.

Parameters
ctxPointer to UART context structure
cfgPointer to configuration structure
Returns
NHAL_OK on success, error code otherwise

◆ nhal_uart_write()

nhal_result_t nhal_uart_write ( struct nhal_uart_context ctx,
const uint8_t *  data,
size_t  len 
)

Write data to UART (blocking)

Parameters
ctxPointer to UART context structure
dataPointer to data to transmit
lenNumber of bytes to transmit
timeoutTimeout in milliseconds
Returns
NHAL_OK on success, error code otherwise