Solaris Software
Loading...
Searching...
No Matches
spi.c File Reference

HAL SPI functions implementation. Calls the function pointer and returns the result. More...

#include "spp/core/returnTypes.h"
#include "spp/hal/hal.h"
#include "spp/hal/spi/spi.h"
Include dependency graph for spi.c:

Go to the source code of this file.

Functions

SPP_RetVal_t SPP_HAL_SPI_busInit (void)
 Initialise the SPI bus.
void * SPP_HAL_SPI_getHandle (spp_uint8_t deviceIdx)
 Obtain the SPI device handle for the given device index.
SPP_RetVal_t SPP_HAL_SPI_deviceInit (void *p_handle)
 Initialise a specific SPI device.
SPP_RetVal_t SPP_HAL_SPI_deviceSetSpeed (void *p_handle, spp_uint32_t speedHz)
 Remove and re-add a SPI device with a new clock speed.
SPP_RetVal_t SPP_HAL_SPI_transmit (void *p_handle, spp_uint8_t *p_data, spp_uint8_t length)
 Perform a full-duplex SPI transaction.

Detailed Description

HAL SPI functions implementation. Calls the function pointer and returns the result.

Definition in file spi.c.

Function Documentation

◆ SPP_HAL_SPI_busInit()

SPP_RetVal_t SPP_HAL_SPI_busInit ( void )

Initialise the SPI bus.

Safe to call multiple times; subsequent calls are no-ops.

Returns
K_SPP_OK on success.

Definition at line 19 of file spi.c.

References K_SPP_ERROR, K_SPP_ERROR_NULL_POINTER, K_SPP_OK, SPP_HalPort_t::spi, SPP_HALSpi_t::spiBusInit, SPP_HAL_getPort(), and SPP_HAL_SPI_busInit().

Referenced by SPP_HAL_init(), and SPP_HAL_SPI_busInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_HAL_SPI_getHandle()

void * SPP_HAL_SPI_getHandle ( spp_uint8_t deviceIdx)

Obtain the SPI device handle for the given device index.

Parameters
[in]deviceIdxZero-based device index (0 = first device, etc.).
Returns
Opaque handle on success, NULL if index is out of range.

Definition at line 39 of file spi.c.

References SPP_HalPort_t::spi, SPP_HALSpi_t::spiGetHandle, SPP_HAL_getPort(), and SPP_HAL_SPI_getHandle().

Referenced by SPP_HAL_SPI_getHandle(), SPP_SERVICES_BMP390_init(), and SPP_SERVICES_ICM20948_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_HAL_SPI_deviceInit()

SPP_RetVal_t SPP_HAL_SPI_deviceInit ( void * p_handle)

Initialise a specific SPI device.

Parameters
[in]p_handleHandle returned by SPP_HAL_SPI_getHandle().
Returns
K_SPP_OK on success, K_SPP_ERROR_NULL_POINTER if handle is NULL.

Definition at line 49 of file spi.c.

References K_SPP_ERROR, K_SPP_ERROR_NULL_POINTER, K_SPP_OK, SPP_HalPort_t::spi, SPP_HALSpi_t::spiDeviceInit, SPP_HAL_getPort(), and SPP_HAL_SPI_deviceInit().

Referenced by SPP_HAL_SPI_deviceInit(), SPP_SERVICES_BMP390_init(), and SPP_SERVICES_ICM20948_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_HAL_SPI_deviceSetSpeed()

SPP_RetVal_t SPP_HAL_SPI_deviceSetSpeed ( void * p_handle,
spp_uint32_t speedHz )

Remove and re-add a SPI device with a new clock speed.

Intended for devices that require a lower speed during initialisation and a higher speed for normal operation (e.g. SD cards: 400 kHz init, up to 25 MHz normal operation).

Parameters
[in]p_handleHandle returned by SPP_HAL_SPI_getHandle().
[in]speedHzNew clock frequency in Hz.
Returns
K_SPP_OK on success, K_SPP_ERROR on failure.

Definition at line 69 of file spi.c.

References K_SPP_ERROR_NULL_POINTER, SPP_HalPort_t::spi, SPP_HALSpi_t::spiDeviceSetSpeed, SPP_HAL_getPort(), and SPP_HAL_SPI_deviceSetSpeed().

Referenced by SPP_HAL_SPI_deviceSetSpeed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_HAL_SPI_transmit()

SPP_RetVal_t SPP_HAL_SPI_transmit ( void * p_handle,
spp_uint8_t * p_data,
spp_uint8_t length )

Perform a full-duplex SPI transaction.

Parameters
[in,out]p_handleSPI device handle.
[in,out]p_dataTX data in, RX data out (in-place).
[in]lengthNumber of bytes in the transaction.
Returns
K_SPP_OK on success, K_SPP_ERROR_ON_SPI_TRANSACTION on failure.

Definition at line 79 of file spi.c.

References K_SPP_ERROR, K_SPP_ERROR_NULL_POINTER, K_SPP_OK, SPP_HalPort_t::spi, SPP_HALSpi_t::spiTransmit, SPP_HAL_getPort(), and SPP_HAL_SPI_transmit().

Referenced by readFifoBurst(), SPP_HAL_SPI_transmit(), SPP_SERVICES_BMP390_configCheck(), SPP_SERVICES_BMP390_enableSpiMode(), SPP_SERVICES_BMP390_intEnableDrdy(), SPP_SERVICES_BMP390_prepareMeasure(), SPP_SERVICES_BMP390_readRawPress(), SPP_SERVICES_BMP390_readRawPressCoeffs(), SPP_SERVICES_BMP390_readRawTemp(), SPP_SERVICES_BMP390_readRawTempCoeffs(), SPP_SERVICES_BMP390_softReset(), SPP_SERVICES_ICM20948_checkFifoData(), SPP_SERVICES_ICM20948_readReg(), SPP_SERVICES_ICM20948_writeReg(), SX1262_CalibrateImage(), SX1262_ClearIrqStatus(), SX1262_SetBufferBaseAddress(), SX1262_SetDioIrqParams(), SX1262_SetModulationParams(), SX1262_SetPacketParams(), SX1262_SetPacketType(), SX1262_SetPaConfig(), SX1262_SetRfFrequency(), SX1262_SetStandby(), SX1262_SetTx(), SX1262_SetTxParams(), and SX1262_WriteBuffer().

Here is the call graph for this function:
Here is the caller graph for this function: