Solaris Software
Toggle main menu visibility
Loading...
Searching...
No Matches
spiPort.h
Go to the documentation of this file.
1
/**
2
* @file spiPort.h
3
* @brief ESP32-S3 SPI port implementation.
4
*/
5
6
#ifndef SPP_PORTS_HAL_ESP32_SPI_PORT_H
7
#define SPP_PORTS_HAL_ESP32_SPI_PORT_H
8
9
#include "
spp/core/types.h
"
10
#include "
spp/core/returnTypes.h
"
11
12
/* ----------------------------------------------------------------
13
* PUBLIC FUNCTIONS
14
* ---------------------------------------------------------------- */
15
16
SPP_RetVal_t
SPP_PORTS_HAL_ESP32_spiBusInit
(
void
);
17
18
/**
19
* @brief Returns the storage location of an SPI device handle.
20
* @param deviceIdx Index of the SPI device.
21
* @return Pointer to the static handle, or NULL if the index is invalid.
22
*/
23
void
*
SPP_PORTS_HAL_ESP32_spiGetHandle
(
spp_uint8_t
deviceIdx);
24
SPP_RetVal_t
SPP_PORTS_HAL_ESP32_spiDeviceInit
(
void
*p_handle);
25
26
/**
27
* @brief Performs register-based SPI transactions.
28
*
29
* Uses bit 7 of each command byte to distinguish reads (3 bytes)
30
* from writes (2 bytes). Read responses overwrite the input buffer.
31
*
32
* @param p_handle Pointer to the SPI device handle.
33
* @param p_data Transaction buffer.
34
* @param length Total buffer length in bytes.
35
* @return K_SPP_OK on success, error code otherwise.
36
*/
37
SPP_RetVal_t
SPP_PORTS_HAL_ESP32_spiTransmit
(
void
*p_handle,
spp_uint8_t
*p_data,
spp_uint8_t
length);
38
39
/**
40
* @brief Reconfigures an SPI device with a new clock frequency.
41
*
42
* Removes and re-adds the device using the SD card CS pin.
43
*
44
* @param p_handle Pointer to the SPI device handle.
45
* @param speedHz New SPI clock frequency in Hz.
46
* @return K_SPP_OK on success, error code otherwise.
47
*/
48
SPP_RetVal_t
SPP_PORTS_HAL_ESP32_spiDeviceSetSpeed
(
void
*p_handle,
spp_uint32_t
speedHz);
49
50
/**
51
* @brief Performs a raw full-duplex SPI transaction.
52
*
53
* Transmitted data is overwritten by the received data.
54
*
55
* @param p_handle Pointer to the SPI device handle.
56
* @param p_data Transmission and reception buffer.
57
* @param length Number of bytes to transfer.
58
* @return K_SPP_OK on success, error code otherwise.
59
*/
60
SPP_RetVal_t
SPP_PORTS_HAL_ESP32_spiTransmitRaw
(
void
*p_handle,
spp_uint8_t
*p_data,
spp_uint8_t
length);
61
62
/**
63
* @brief Check whether the SPI bus has been initialised.
64
* @return true if @ref SPP_PORTS_HAL_ESP32_spiBusInit succeeded.
65
*/
66
spp_bool_t
SPP_PORTS_HAL_ESP32_spiIsBusInitialized
(
void
);
67
68
#endif
/* SPP_PORTS_HAL_ESP32_SPI_PORT_H */
returnTypes.h
Standard return-value type used across all SPP modules.
SPP_RetVal_t
SPP_RetVal_t
Unified return type for all SPP API functions.
Definition
returnTypes.h:24
SPP_PORTS_HAL_ESP32_spiBusInit
SPP_RetVal_t SPP_PORTS_HAL_ESP32_spiBusInit(void)
Definition
spiPort.c:32
SPP_PORTS_HAL_ESP32_spiGetHandle
void * SPP_PORTS_HAL_ESP32_spiGetHandle(spp_uint8_t deviceIdx)
Returns the storage location of an SPI device handle.
Definition
spiPort.c:70
SPP_PORTS_HAL_ESP32_spiDeviceSetSpeed
SPP_RetVal_t SPP_PORTS_HAL_ESP32_spiDeviceSetSpeed(void *p_handle, spp_uint32_t speedHz)
Reconfigures an SPI device with a new clock frequency.
Definition
spiPort.c:191
SPP_PORTS_HAL_ESP32_spiTransmit
SPP_RetVal_t SPP_PORTS_HAL_ESP32_spiTransmit(void *p_handle, spp_uint8_t *p_data, spp_uint8_t length)
Performs register-based SPI transactions.
Definition
spiPort.c:144
SPP_PORTS_HAL_ESP32_spiDeviceInit
SPP_RetVal_t SPP_PORTS_HAL_ESP32_spiDeviceInit(void *p_handle)
Definition
spiPort.c:79
SPP_PORTS_HAL_ESP32_spiTransmitRaw
SPP_RetVal_t SPP_PORTS_HAL_ESP32_spiTransmitRaw(void *p_handle, spp_uint8_t *p_data, spp_uint8_t length)
Performs a raw full-duplex SPI transaction.
Definition
spiPort.c:223
SPP_PORTS_HAL_ESP32_spiIsBusInitialized
spp_bool_t SPP_PORTS_HAL_ESP32_spiIsBusInitialized(void)
Check whether the SPI bus has been initialised.
Definition
spiPort.c:218
types.h
Portable integer types and SPI/storage configuration types for SPP.
spp_uint32_t
uint32_t spp_uint32_t
Definition
types.h:31
spp_uint8_t
uint8_t spp_uint8_t
Definition
types.h:27
spp_bool_t
bool spp_bool_t
Definition
types.h:36
solaris-v2
spp
ports
hal
esp32
spi
spiPort.h
Generated by
1.18.0