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

Hardware Abstraction Layer for SPI daisy chain communication. More...

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

Go to the source code of this file.

Functions

nhal_result_t nhal_spi_daisy_init (struct nhal_spi_daisy_context *daisy_ctx)
 Initialize SPI daisy chain context.
 
nhal_result_t nhal_spi_daisy_deinit (struct nhal_spi_daisy_context *daisy_ctx)
 Deinitialize SPI daisy chain context.
 
nhal_result_t nhal_spi_daisy_set_config (struct nhal_spi_daisy_context *daisy_ctx, struct nhal_spi_daisy_config *config)
 Set SPI daisy chain configuration.
 
nhal_result_t nhal_spi_daisy_get_config (struct nhal_spi_daisy_context *daisy_ctx, struct nhal_spi_daisy_config *config)
 Get current SPI daisy chain configuration.
 
nhal_result_t nhal_spi_daisy_write_chain (struct nhal_spi_daisy_context *daisy_ctx, const struct nhal_spi_daisy_device *devices, size_t num_devices)
 Write data to daisy chain with per-device data specification.
 
nhal_result_t nhal_spi_daisy_read_chain (struct nhal_spi_daisy_context *daisy_ctx, struct nhal_spi_daisy_device *devices, size_t num_devices)
 Read data from daisy chain with per-device data specification.
 
nhal_result_t nhal_spi_daisy_write_uniform (struct nhal_spi_daisy_context *daisy_ctx, const uint8_t *data, size_t data_per_device)
 Write uniform data to all devices in daisy chain.
 
nhal_result_t nhal_spi_daisy_read_uniform (struct nhal_spi_daisy_context *daisy_ctx, uint8_t *data, size_t data_per_device)
 Read uniform data from all devices in daisy chain.
 

Detailed Description

Hardware Abstraction Layer for SPI daisy chain communication.

This file defines the API for interacting with SPI devices connected in a daisy chain configuration. In daisy chain mode, devices are connected MOSI->Device1_MISO->Device2_MISO->... with a shared clock and chip select, forming a single large shift register.

Definition in file nhal_spi_daisy_chain.h.

Function Documentation

◆ nhal_spi_daisy_deinit()

nhal_result_t nhal_spi_daisy_deinit ( struct nhal_spi_daisy_context daisy_ctx)

Deinitialize SPI daisy chain context.

Parameters
daisy_ctxPointer to SPI daisy chain context structure
Returns
NHAL_OK on success, error code otherwise

◆ nhal_spi_daisy_get_config()

nhal_result_t nhal_spi_daisy_get_config ( struct nhal_spi_daisy_context daisy_ctx,
struct nhal_spi_daisy_config config 
)

Get current SPI daisy chain configuration.

Parameters
daisy_ctxPointer to SPI daisy chain context structure
configPointer to daisy chain configuration structure to fill
Returns
NHAL_OK on success, error code otherwise

◆ nhal_spi_daisy_init()

nhal_result_t nhal_spi_daisy_init ( struct nhal_spi_daisy_context daisy_ctx)

Initialize SPI daisy chain context.

Parameters
daisy_ctxPointer to SPI daisy chain context structure
Returns
NHAL_OK on success, error code otherwise

◆ nhal_spi_daisy_read_chain()

nhal_result_t nhal_spi_daisy_read_chain ( struct nhal_spi_daisy_context daisy_ctx,
struct nhal_spi_daisy_device devices,
size_t  num_devices 
)

Read data from daisy chain with per-device data specification.

Parameters
daisy_ctxPointer to SPI daisy chain context structure
devicesArray of device structures to receive data from each device
num_devicesNumber of devices in the chain
timeoutTimeout in milliseconds
Returns
NHAL_OK on success, error code otherwise

◆ nhal_spi_daisy_read_uniform()

nhal_result_t nhal_spi_daisy_read_uniform ( struct nhal_spi_daisy_context daisy_ctx,
uint8_t *  data,
size_t  data_per_device 
)

Read uniform data from all devices in daisy chain.

Parameters
daisy_ctxPointer to SPI daisy chain context structure
dataPointer to buffer for received data from all devices
data_per_deviceNumber of bytes to read from each device
timeoutTimeout in milliseconds
Returns
NHAL_OK on success, error code otherwise

◆ nhal_spi_daisy_set_config()

nhal_result_t nhal_spi_daisy_set_config ( struct nhal_spi_daisy_context daisy_ctx,
struct nhal_spi_daisy_config config 
)

Set SPI daisy chain configuration.

Parameters
daisy_ctxPointer to SPI daisy chain context structure
configPointer to daisy chain configuration structure
Returns
NHAL_OK on success, error code otherwise

◆ nhal_spi_daisy_write_chain()

nhal_result_t nhal_spi_daisy_write_chain ( struct nhal_spi_daisy_context daisy_ctx,
const struct nhal_spi_daisy_device devices,
size_t  num_devices 
)

Write data to daisy chain with per-device data specification.

Parameters
daisy_ctxPointer to SPI daisy chain context structure
devicesArray of device structures containing data for each device
num_devicesNumber of devices in the chain
timeoutTimeout in milliseconds
Returns
NHAL_OK on success, error code otherwise

◆ nhal_spi_daisy_write_uniform()

nhal_result_t nhal_spi_daisy_write_uniform ( struct nhal_spi_daisy_context daisy_ctx,
const uint8_t *  data,
size_t  data_per_device 
)

Write uniform data to all devices in daisy chain.

Parameters
daisy_ctxPointer to SPI daisy chain context structure
dataPointer to data to write to each device
data_per_deviceNumber of bytes to write to each device
timeoutTimeout in milliseconds
Returns
NHAL_OK on success, error code otherwise