-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSPI.h
50 lines (42 loc) · 1.07 KB
/
SPI.h
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
/*! @file SPI.c
*
* @brief Serial Port Interface.
*
* This module is a HAL (Hardware abstraction Layer) for the SPI on the PIC.
* It facilitates communication between hardware and software for other modules
* such as SM and EEPROM (this EEPROM is on the CPLD).
*
* @author Andrew.P
* @date 02-08-2016
*/
#ifndef SPI_H
#define SPI_H
#ifdef __cplusplus
extern "C" {
#endif
#include "types.h"
typedef enum {
SPI_NONE = 0,
SPI_EEPROM = 2,
SPI_SM = 3
}TSPI_MODE; /* TSPI_MODE is used to select different SPI modes */
/*!@brief Sets up the SPI interface before first use.
*
* @return BOOL - true if the SPI was successfully initialized.
*/
bool SPI_Init(void);
/*!@brief Changes the module (mode) SPI is referencing.
*
* @param mode - The mode to change to
*/
void SPI_SelectMode(TSPI_MODE mode);
/*!@brief Sends data to the currently selected SPI module.
*
* @param txData - The data to transmit
* @return rxData - The data that is potentially received during this process
*/
uint8_t SPI_SendData(uint8_t txData);
#ifdef __cplusplus
}
#endif
#endif /* SPI_H */