convert usart.c to cpp class
This commit is contained in:
18
Core/Inc/pindef.hpp
Normal file
18
Core/Inc/pindef.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "stm32f401xe.h"
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
constexpr const uint16_t B1_Pin = GPIO_PIN_13;
|
||||
constexpr const uint16_t USART_TX_Pin = GPIO_PIN_2;
|
||||
constexpr const uint16_t USART_RX_Pin = GPIO_PIN_3;
|
||||
constexpr const uint16_t LD2_Pin = GPIO_PIN_5;
|
||||
constexpr const uint16_t TMS_Pin = GPIO_PIN_13;
|
||||
constexpr const uint16_t TCK_Pin = GPIO_PIN_14;
|
||||
constexpr const uint16_t SWO_Pin = GPIO_PIN_3;
|
||||
|
||||
inline GPIO_TypeDef* B1_GPIO_Port = GPIOC;
|
||||
inline GPIO_TypeDef* USART_TX_GPIO_Port = GPIOA;
|
||||
inline GPIO_TypeDef* USART_RX_GPIO_Port = GPIOA;
|
||||
inline GPIO_TypeDef* LD2_GPIO_Port = GPIOA;
|
||||
inline GPIO_TypeDef* TMS_GPIO_Port = GPIOA;
|
||||
inline GPIO_TypeDef* TCK_GPIO_Port = GPIOA;
|
||||
inline GPIO_TypeDef* SWO_GPIO_Port = GPIOB;
|
@@ -40,13 +40,8 @@ extern UART_HandleTypeDef huart2;
|
||||
|
||||
void MX_USART2_UART_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
void HAL_UART_Tx(void);
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USART_H__ */
|
||||
|
||||
|
@@ -20,6 +20,7 @@ class Usart {
|
||||
~Usart() = default;
|
||||
|
||||
bool init();
|
||||
void deinit();
|
||||
void print(const std::string_view str);
|
||||
void println(const std::string_view str);
|
||||
|
||||
|
Reference in New Issue
Block a user