实现串口驱动,移植方便
This commit is contained in:
41
BSP/Inc/bsp_config.h
Normal file
41
BSP/Inc/bsp_config.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : bsp_config.h
|
||||
* @brief : Board support package configuration file
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef BSP_CONFIG_H
|
||||
#define BSP_CONFIG_H
|
||||
|
||||
#include "hal_gpio.h"
|
||||
|
||||
/**
|
||||
* @brief Board name definition
|
||||
*/
|
||||
#define BOARD_NAME "STM32F407VET6"
|
||||
|
||||
/**
|
||||
* @brief LED hardware configuration
|
||||
*/
|
||||
#define BSP_LED_PORT HAL_GPIO_PORT_A
|
||||
#define BSP_LED_PIN HAL_GPIO_PIN_6
|
||||
|
||||
/**
|
||||
* @brief Button hardware configuration (if available)
|
||||
*/
|
||||
/* #define BSP_BUTTON_PORT HAL_GPIO_PORT_X */
|
||||
/* #define BSP_BUTTON_PIN HAL_GPIO_PIN_X */
|
||||
|
||||
/**
|
||||
* @brief UART hardware configuration
|
||||
*/
|
||||
#define BSP_UART_INSTANCE USART1
|
||||
#define BSP_UART_BAUDRATE 115200
|
||||
#define BSP_UART_PARITY HAL_UART_PARITY_NONE
|
||||
#define BSP_UART_STOPBITS HAL_UART_STOPBITS_1
|
||||
#define BSP_UART_DATABITS HAL_UART_DATABITS_8
|
||||
|
||||
#endif /* BSP_CONFIG_H */
|
||||
29
BSP/Inc/bsp_init.h
Normal file
29
BSP/Inc/bsp_init.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : bsp_init.h
|
||||
* @brief : Board support package initialization header file
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef BSP_INIT_H
|
||||
#define BSP_INIT_H
|
||||
|
||||
/**
|
||||
* @brief Initialize board support package
|
||||
*/
|
||||
void bsp_init(void);
|
||||
|
||||
/**
|
||||
* @brief Initialize board GPIO
|
||||
*/
|
||||
void bsp_gpio_init(void);
|
||||
|
||||
/**
|
||||
* @brief Get board name
|
||||
* @retval Board name string
|
||||
*/
|
||||
const char* bsp_get_board_name(void);
|
||||
|
||||
#endif /* BSP_INIT_H */
|
||||
Reference in New Issue
Block a user