feat:添加格式规则

master
lidong 2 months ago
parent 4062a507d9
commit e49054ec71

@ -0,0 +1,58 @@
# Generated from CLion C/C++ Code Style settings
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignOperands: true
AlignTrailingComments: false
AlwaysBreakTemplateDeclarations: Yes
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBraces: Custom
BreakConstructorInitializers: AfterColon
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ContinuationIndentWidth: 8
IncludeCategories:
- Regex: '^<.*'
Priority: 1
- Regex: '^".*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 4
InsertNewlineAtEOF: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
TabWidth: 4
...

@ -3,6 +3,7 @@
// //
#include "usart.h" #include "usart.h"
#ifdef HAL_UART_MODULE_ENABLED #ifdef HAL_UART_MODULE_ENABLED
UART_HandleTypeDef DebugUartHandle; UART_HandleTypeDef DebugUartHandle;
/** /**
@ -12,49 +13,49 @@ UART_HandleTypeDef DebugUartHandle;
*/ */
void USART_Config(void) void USART_Config(void)
{ {
GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitTypeDef GPIO_InitStruct;
#if defined(__GNUC__) #if defined(__GNUC__)
setvbuf(stdout, NULL, _IONBF, 0 ); setvbuf(stdout, NULL, _IONBF, 0 );
#endif #endif
__HAL_RCC_USART2_CLK_ENABLE(); __HAL_RCC_USART2_CLK_ENABLE();
DebugUartHandle.Instance = DEBUG_USART; DebugUartHandle.Instance = DEBUG_USART;
DebugUartHandle.Init.BaudRate = USART_BAUDRATE; DebugUartHandle.Init.BaudRate = USART_BAUDRATE;
DebugUartHandle.Init.WordLength = UART_WORDLENGTH_8B; DebugUartHandle.Init.WordLength = UART_WORDLENGTH_8B;
DebugUartHandle.Init.StopBits = UART_STOPBITS_1; DebugUartHandle.Init.StopBits = UART_STOPBITS_1;
DebugUartHandle.Init.Parity = UART_PARITY_NONE; DebugUartHandle.Init.Parity = UART_PARITY_NONE;
DebugUartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; DebugUartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
DebugUartHandle.Init.Mode = UART_MODE_TX_RX; DebugUartHandle.Init.Mode = UART_MODE_TX_RX;
DebugUartHandle.Init.OverSampling = UART_OVERSAMPLING_16; DebugUartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
DebugUartHandle.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; DebugUartHandle.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
HAL_UART_Init(&DebugUartHandle); HAL_UART_Init(&DebugUartHandle);
USART_RX_GPIO_CLK_ENABLE(); USART_RX_GPIO_CLK_ENABLE();
USART_TX_GPIO_CLK_ENABLE(); USART_TX_GPIO_CLK_ENABLE();
/**USART GPIO Configuration /**USART GPIO Configuration
PA2 ------> USART1_TX PA2 ------> USART1_TX
PA3 ------> USART1_RX PA3 ------> USART1_RX
*/ */
GPIO_InitStruct.Pin = USART_TX_PIN; GPIO_InitStruct.Pin = USART_TX_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = USART_TX_AF; GPIO_InitStruct.Alternate = USART_TX_AF;
HAL_GPIO_Init(USART_TX_GPIO_PORT, &GPIO_InitStruct); HAL_GPIO_Init(USART_TX_GPIO_PORT, &GPIO_InitStruct);
GPIO_InitStruct.Pin = USART_RX_PIN; GPIO_InitStruct.Pin = USART_RX_PIN;
GPIO_InitStruct.Alternate = USART_RX_AF; GPIO_InitStruct.Alternate = USART_RX_AF;
HAL_GPIO_Init(USART_RX_GPIO_PORT, &GPIO_InitStruct); HAL_GPIO_Init(USART_RX_GPIO_PORT, &GPIO_InitStruct);
/* ENABLE NVIC */ /* ENABLE NVIC */
HAL_NVIC_SetPriority(USART_IRQ,0,1); HAL_NVIC_SetPriority(USART_IRQ,0,1);
HAL_NVIC_EnableIRQ(USART_IRQ ); HAL_NVIC_EnableIRQ(USART_IRQ );
} }
#if (defined (__CC_ARM)) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) #if (defined (__CC_ARM)) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))

@ -6,14 +6,14 @@
#define VERSION_H #define VERSION_H
#define __PY32F030xx_STK_BSP_VERSION_MAIN (0x01U) /*!< [31:24] main version */ #define VERSION_MAIN (0x01U) /*!< [31:24] main version */
#define __PY32F030xx_STK_BSP_VERSION_SUB1 (0x00U) /*!< [23:16] sub1 version */ #define VERSION_SUB1 (0x00U) /*!< [23:16] sub1 version */
#define __PY32F030xx_STK_BSP_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ #define VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
#define __PY32F030xx_STK_BSP_VERSION_RC (0x00U) /*!< [7:0] release candidate */ #define VERSION_RC (0x00U) /*!< [7:0] release candidate */
#define __PY32F030xx_STK_BSP_VERSION ((__PY32F030xx_STK_BSP_VERSION_MAIN << 24) \ #define VERSION ((VERSION_MAIN << 24) \
|(__PY32F030xx_STK_BSP_VERSION_SUB1 << 16) \ |(VERSION_SUB1 << 16) \
|(__PY32F030xx_STK_BSP_VERSION_SUB2 << 8 ) \ |(VERSION_SUB2 << 8 ) \
|(__PY32F030xx_STK_BSP_VERSION_RC)) |(VERSION_RC))
/** /**
* @brief This method returns the PY32F030 STK BSP Driver revision. * @brief This method returns the PY32F030 STK BSP Driver revision.
@ -21,7 +21,7 @@
*/ */
static inline uint32_t BSP_GetVersion(void) static inline uint32_t BSP_GetVersion(void)
{ {
return __PY32F030xx_STK_BSP_VERSION; return VERSION;
} }
#endif //VERSION_H #endif //VERSION_H

Loading…
Cancel
Save