51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
#ifndef FSFW_HAL_STM32H7_SPI_SPICORE_H_
|
|
#define FSFW_HAL_STM32H7_SPI_SPICORE_H_
|
|
|
|
#include "stm32h7xx_hal.h"
|
|
#include "stm32h7xx_hal_dma.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
using msp_func_t = void (*) (void* args);
|
|
|
|
/**
|
|
* Assign MSP init functions. Important for SPI configuration
|
|
* @param init_func
|
|
* @param init_args
|
|
* @param deinit_func
|
|
* @param deinit_args
|
|
*/
|
|
void set_spi_msp_functions(msp_func_t init_func, void* init_args, msp_func_t deinit_func,
|
|
void* deinit_args);
|
|
|
|
/**
|
|
* Assign DMA handles. Required to use DMA for SPI transfers.
|
|
* @param txHandle
|
|
* @param rxHandle
|
|
*/
|
|
void set_dma_handles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle);
|
|
|
|
void get_dma_handles(DMA_HandleTypeDef** txHandle, DMA_HandleTypeDef** rxHandle);
|
|
void get_msp_init_function(msp_func_t* init_func, void **args);
|
|
void get_msp_deinit_function(msp_func_t* deinit_func, void **args);
|
|
|
|
/**
|
|
* Assign SPI handle. Needs to be done before using the SPI
|
|
* @param spiHandle
|
|
*/
|
|
void assign_spi_handle(SPI_HandleTypeDef *spiHandle);
|
|
|
|
/**
|
|
* Get the assigned SPI handle.
|
|
* @return
|
|
*/
|
|
SPI_HandleTypeDef* get_spi_handle();
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* FSFW_HAL_STM32H7_SPI_SPICORE_H_ */
|