优化实现串口驱动,SPI驱动 W25QXX还需要初始化验证修复
This commit is contained in:
26
HAL/Inc/arch/stm32f4/hal_stm32f4.h
Normal file
26
HAL/Inc/arch/stm32f4/hal_stm32f4.h
Normal file
@ -0,0 +1,26 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : hal_stm32f4.h
|
||||
* @brief : STM32F4 architecture specific HAL header file
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef HAL_STM32F4_H
|
||||
#define HAL_STM32F4_H
|
||||
|
||||
/* Include STM32F4 HAL headers */
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
/* Include common HAL headers */
|
||||
#include "../../hal_gpio.h"
|
||||
#include "../../hal_uart.h"
|
||||
#include "../../hal_delay.h"
|
||||
|
||||
/**
|
||||
* @brief STM32F4 specific initialization
|
||||
*/
|
||||
void hal_stm32f4_init(void);
|
||||
|
||||
#endif /* HAL_STM32F4_H */
|
||||
59
HAL/Inc/arch/stm32f4/hal_stm32f4_spi.h
Normal file
59
HAL/Inc/arch/stm32f4/hal_stm32f4_spi.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* 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__ */
|
||||
Reference in New Issue
Block a user