40 lines
959 B
C
40 lines
959 B
C
#include "interrupts.h"
|
|
|
|
#include <stddef.h>
|
|
|
|
void (*spi1_user_handler) (void* args) = NULL;
|
|
void * spi1_user_args = NULL;
|
|
|
|
void (*spi2_user_handler) (void* args) = NULL;
|
|
void * spi2_user_args = NULL;
|
|
|
|
void assign_spi_user_handler(SpiBus spi_idx, user_handler_t user_handler, user_args_t user_args) {
|
|
if(spi_idx == SPI_1) {
|
|
spi1_user_handler = user_handler;
|
|
spi1_user_args = user_args;
|
|
}
|
|
else {
|
|
spi2_user_handler = user_handler;
|
|
spi2_user_args = user_args;
|
|
}
|
|
}
|
|
|
|
/* Do not change these function names! They need to be exactly equal to the name of the functions
|
|
defined in the startup_stm32h743xx.s files! */
|
|
|
|
void SPI1_IRQHandler() {
|
|
if(spi1_user_handler != NULL) {
|
|
spi1_user_handler(spi1_user_args);
|
|
return;
|
|
}
|
|
Default_Handler();
|
|
}
|
|
|
|
void SPI2_IRQHandler() {
|
|
if(spi2_user_handler != NULL) {
|
|
spi2_user_handler(spi2_user_args);
|
|
return;
|
|
}
|
|
Default_Handler();
|
|
}
|