优化实现串口驱动,SPI驱动 W25QXX还需要初始化验证修复
This commit is contained in:
107
BSP/Inc/bsp_board.h
Normal file
107
BSP/Inc/bsp_board.h
Normal file
@ -0,0 +1,107 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : bsp_board.h
|
||||
* @brief : Board support package board abstraction header file
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef BSP_BOARD_H
|
||||
#define BSP_BOARD_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_uart.h"
|
||||
|
||||
/**
|
||||
* @brief Board LED configuration structure
|
||||
*/
|
||||
typedef struct {
|
||||
hal_gpio_port_t port;
|
||||
hal_gpio_pin_t pin;
|
||||
hal_gpio_mode_t mode;
|
||||
hal_gpio_speed_t speed;
|
||||
hal_gpio_pull_t pull;
|
||||
} bsp_led_config_t;
|
||||
|
||||
/**
|
||||
* @brief Board button configuration structure
|
||||
*/
|
||||
typedef struct {
|
||||
hal_gpio_port_t port;
|
||||
hal_gpio_pin_t pin;
|
||||
hal_gpio_mode_t mode;
|
||||
hal_gpio_speed_t speed;
|
||||
hal_gpio_pull_t pull;
|
||||
} bsp_button_config_t;
|
||||
|
||||
/**
|
||||
* @brief UART instance identifier definitions
|
||||
*/
|
||||
typedef enum {
|
||||
BSP_UART_INSTANCE_1 = 0,
|
||||
BSP_UART_INSTANCE_2,
|
||||
BSP_UART_INSTANCE_3,
|
||||
BSP_UART_INSTANCE_4,
|
||||
BSP_UART_INSTANCE_5,
|
||||
BSP_UART_INSTANCE_6,
|
||||
BSP_UART_INSTANCE_MAX
|
||||
} bsp_uart_instance_t;
|
||||
|
||||
/**
|
||||
* @brief Board UART configuration structure
|
||||
*/
|
||||
typedef struct {
|
||||
bsp_uart_instance_t instance;
|
||||
uint32_t baudrate;
|
||||
hal_uart_parity_t parity;
|
||||
hal_uart_stopbits_t stopbits;
|
||||
hal_uart_databits_t databits;
|
||||
hal_gpio_port_t tx_port;
|
||||
hal_gpio_pin_t tx_pin;
|
||||
hal_gpio_port_t rx_port;
|
||||
hal_gpio_pin_t rx_pin;
|
||||
} bsp_uart_config_t;
|
||||
|
||||
/**
|
||||
* @brief Board peripheral initialization function type
|
||||
*/
|
||||
typedef void (*bsp_periph_init_func_t)(const void* config);
|
||||
|
||||
/**
|
||||
* @brief Board configuration structure
|
||||
*/
|
||||
typedef struct {
|
||||
const char* name;
|
||||
bsp_led_config_t led;
|
||||
bsp_button_config_t button;
|
||||
bsp_uart_config_t uart;
|
||||
|
||||
/* Initialization function pointers */
|
||||
bsp_periph_init_func_t led_init;
|
||||
bsp_periph_init_func_t button_init;
|
||||
bsp_periph_init_func_t uart_init;
|
||||
|
||||
/* Additional board-specific configuration */
|
||||
uint32_t clock_speed;
|
||||
uint8_t uart_count;
|
||||
} bsp_board_config_t;
|
||||
|
||||
/**
|
||||
* @brief STM32F407VET6 board configuration extern declaration
|
||||
*/
|
||||
extern const bsp_board_config_t stm32f407vet6_board_config;
|
||||
|
||||
/**
|
||||
* @brief Board hardware initialization
|
||||
*/
|
||||
void bsp_board_init(void);
|
||||
|
||||
/**
|
||||
* @brief Get board name
|
||||
* @retval Board name string
|
||||
*/
|
||||
const char* bsp_board_get_name(void);
|
||||
|
||||
#endif /* BSP_BOARD_H */
|
||||
Reference in New Issue
Block a user