/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : hal_stm32f4_spi.h
  * @brief          : STM32F4 specific SPI HAL header file
  ******************************************************************************
  */
/* USER CODE END Header */

#ifndef __HAL_STM32F4_SPI_H__
#define __HAL_STM32F4_SPI_H__

#include "hal.h"
#include "hal_spi.h"

/**
 * @brief STM32F4 specific SPI initialization
 * @param instance SPI instance identifier
 * @param config SPI configuration structure
 * @return true if initialization is successful, false otherwise
 */
bool hal_stm32f4_spi_init(hal_spi_instance_t instance, const hal_spi_config_t *config);

/**
 * @brief STM32F4 specific SPI deinitialization
 * @param instance SPI instance identifier
 * @return true if deinitialization is successful, false otherwise
 */
bool hal_stm32f4_spi_deinit(hal_spi_instance_t instance);

/**
 * @brief STM32F4 specific SPI transmit implementation
 * @param instance SPI instance identifier
 * @param p_data Pointer to data buffer to transmit
 * @param size Size of data to transmit
 * @return true if transmission is successful, false otherwise
 */
bool hal_stm32f4_spi_transmit(hal_spi_instance_t instance, const uint8_t *p_data, uint16_t size);

/**
 * @brief STM32F4 specific SPI receive implementation
 * @param instance SPI instance identifier
 * @param p_data Pointer to data buffer to receive
 * @param size Size of data to receive
 * @return true if reception is successful, false otherwise
 */
bool hal_stm32f4_spi_receive(hal_spi_instance_t instance, uint8_t *p_data, uint16_t size);

/**
 * @brief STM32F4 specific SPI transmit and receive implementation
 * @param instance SPI instance identifier
 * @param p_tx_data Pointer to data buffer to transmit
 * @param p_rx_data Pointer to data buffer to receive
 * @param size Size of data to transmit/receive
 * @return true if transmission and reception are successful, false otherwise
 */
bool hal_stm32f4_spi_transmit_receive(hal_spi_instance_t instance, const uint8_t *p_tx_data, uint8_t *p_rx_data, uint16_t size);

#endif /* __HAL_STM32F4_SPI_H__ */