1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
/**
* SPI0 Generated Driver API Header File
*
* @file spi0.h
*
* @defgroup spi0 SPI0
*
* @brief This header file provides API prototypes for the SPI0 driver.
*
* @version SPI0 Driver Version 3.1.0
*
* @version SPI0 Package Version 5.1.0
*/
/*
© [2025] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef SPI0_H
#define SPI0_H
#include <stdbool.h>
#include "../system/utils/compiler.h"
#include "spi_interface.h"
/**
* @ingroup spi0
* @struct SPI_INTERFACE SPI0
* @brief SPI driver interface object.
*/
extern const struct SPI_INTERFACE SPI0_s;
/**
* @ingroup spi0
* @typedef enum SPI0_configuration_name_t
* @brief Enumeration for the different configurations supported by the driver.
* A configuration is specified as parameter to SPI0_Open()
* and is used by the function to set SPI parameters as specified by the configuration.
*/
typedef enum
{
SPI0_DEFAULT
} SPI0_configuration_name_t;
/**
* @ingroup spi0
* @brief Initializes the SPI0 module.
* @param None.
* @return None.
*/
void SPI0_Initialize(void);
/**
* @ingroup spi0
* @brief Deinitializes the SPI0 module
* @param None.
* @return None.
*/
void SPI0_Deinitialize(void);
/**
* @ingroup spi0
* @brief Enables the SPI0 module with the configurations passed as the parameter.
* See spi0_configuration_name_t for the available configurations.
* @param spiConfigIndex The Configuration index
* @retval True SPI0 module is enabled successfully with the chosen configuration
* @retval False SPI0 module is already open with another configuration
*/
bool SPI0_Open(uint8_t spiConfigIndex);
/**
* @ingroup spi0
* @brief Closes the active configuration of the SPI0 module.
* @param None.
* @return None.
*/
void SPI0_Close(void);
/**
* @ingroup spi0
* @brief Exchanges one byte using the SPI protocol. This function is blocking.
* @param byteData The byte to be written
* @return Received data byte
*/
uint8_t SPI0_ByteExchange(uint8_t byteData);
/**
* @ingroup spi0
* @brief Exchanges the buffer using the SPI protocol with separate transmit and receive buffer locations. This function is blocking in Polling mode.
* @param [in] *txBuffer Buffer address of the data to be transmitted during exchange
* @param [in] *rxBuffer Buffer address of the data to be received during exchange
* @param [in] bufferSize Size of the data in bytes
* @return None.
*/
void SPI0_Transfer(const void * txBuffer, void * rxBuffer, size_t bufferSize);
/**
* @ingroup spi0
* @brief Exchanges the buffer using the SPI protocol. This function is blocking in Polling mode.
* @param [in,out] *bufferData Buffer address of the data to be exchanged
* @param [in] bufferSize Size of the data in bytes
* @return None.
*/
void SPI0_BufferExchange(void * bufferData, size_t bufferSize);
/**
* @ingroup spi0
* @brief Writes a buffer using the SPI protocol. This function is blocking in Polling mode.
* @param [in] *bufferData Buffer address of the data to be written
* @param [in] bufferSize Size of the data in bytes
* @return None.
*/
void SPI0_BufferWrite(void * bufferData, size_t bufferSize);
/**
* @ingroup spi0
* @brief Reads a buffer using the SPI protocol. This function is blocking in Polling mode.
* @param [out] *bufferData Buffer address of the data to be read
* @param [in] bufferSize Size of the data in bytes
* @return None.
*/
void SPI0_BufferRead(void * bufferData, size_t bufferSize);
/**
* @ingroup spi0
* @brief Writes one byte using the SPI protocol. This function is blocking in Polling mode.
* @param byteData The byte to be written
* @return None.
*/
void SPI0_ByteWrite(uint8_t byteData);
/**
* @ingroup spi0
* @brief Receives one byte using SPI protocol. This function is blocking.
* @param None.
* @return Received data byte
*/
uint8_t SPI0_ByteRead(void);
/**
* @ingroup spi0
* @brief Checks if the SPI0 module is ready to read data.
* @param None.
* @retval True SPI0 module has data ready in buffer
* @retval False SPI0 module is not ready to read data
*/
bool SPI0_IsRxReady(void);
/**
* @ingroup spi0
* @brief Checks if the SPI0 module is ready to write data.
* @param None.
* @retval True SPI0 module is ready to write data
* @retval False SPI0 module is not ready to write data
*/
bool SPI0_IsTxReady(void);
#endif /* SPI0_H */
|