-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSPIcallbacks.cpp
52 lines (42 loc) · 1.01 KB
/
SPIcallbacks.cpp
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
/*
* spi_callbacks.cpp
*
* Created on: Nov 17, 2024
* Author: admin
*/
#include "main.h"
#ifdef HAL_SPI_MODULE_ENABLED
#if __has_include("spi_settings.h")
# include "spi_settings.h"
#else
# include "spi_settings_test.h"
#endif
extern "C" void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
{
if constexpr (SPIslave_t::elements > 0) {
SPIslave_t::handleTxRxComplete(hspi);
}
if constexpr (SPImaster_t::elements > 0) {
SPImaster_t::handleTxRxComplete(hspi);
}
}
extern "C" void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi)
{
if constexpr (SPIslave_t::elements > 0) {
SPIslave_t::handleError(hspi);
}
if constexpr (SPImaster_t::elements > 0) {
SPImaster_t::handleError(hspi);
}
}
extern "C" void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if constexpr (SPIslave_t::elements > 0) {
SPIslave_t::handleNSS(GPIO_Pin);
}
// // no need for master ------------------------
// if constexpr (SPImaster_t::elements > 0) {
// SPImaster_t::handleNSS(GPIO_Pin);
// }
}
#endif /* HAL_SPI_MODULE_ENABLED */