diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..6c3327e --- /dev/null +++ b/.clang-format @@ -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 +... diff --git a/Drivers/BSP/usart.c b/Drivers/BSP/usart.c index 7ffa7ef..3237876 100644 --- a/Drivers/BSP/usart.c +++ b/Drivers/BSP/usart.c @@ -3,6 +3,7 @@ // #include "usart.h" + #ifdef HAL_UART_MODULE_ENABLED UART_HandleTypeDef DebugUartHandle; /** @@ -12,49 +13,49 @@ UART_HandleTypeDef DebugUartHandle; */ void USART_Config(void) { - GPIO_InitTypeDef GPIO_InitStruct; + GPIO_InitTypeDef GPIO_InitStruct; #if defined(__GNUC__) - setvbuf(stdout, NULL, _IONBF, 0 ); + setvbuf(stdout, NULL, _IONBF, 0 ); #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.WordLength = UART_WORDLENGTH_8B; - DebugUartHandle.Init.StopBits = UART_STOPBITS_1; - DebugUartHandle.Init.Parity = UART_PARITY_NONE; - DebugUartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; - DebugUartHandle.Init.Mode = UART_MODE_TX_RX; - DebugUartHandle.Init.OverSampling = UART_OVERSAMPLING_16; - DebugUartHandle.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; + DebugUartHandle.Init.BaudRate = USART_BAUDRATE; + DebugUartHandle.Init.WordLength = UART_WORDLENGTH_8B; + DebugUartHandle.Init.StopBits = UART_STOPBITS_1; + DebugUartHandle.Init.Parity = UART_PARITY_NONE; + DebugUartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; + DebugUartHandle.Init.Mode = UART_MODE_TX_RX; + DebugUartHandle.Init.OverSampling = UART_OVERSAMPLING_16; + DebugUartHandle.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; - HAL_UART_Init(&DebugUartHandle); + HAL_UART_Init(&DebugUartHandle); - USART_RX_GPIO_CLK_ENABLE(); - USART_TX_GPIO_CLK_ENABLE(); + USART_RX_GPIO_CLK_ENABLE(); + USART_TX_GPIO_CLK_ENABLE(); - /**USART GPIO Configuration - PA2 ------> USART1_TX - PA3 ------> USART1_RX - */ - GPIO_InitStruct.Pin = USART_TX_PIN; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_PULLUP; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = USART_TX_AF; - HAL_GPIO_Init(USART_TX_GPIO_PORT, &GPIO_InitStruct); + /**USART GPIO Configuration + PA2 ------> USART1_TX + PA3 ------> USART1_RX + */ + GPIO_InitStruct.Pin = USART_TX_PIN; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_PULLUP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = USART_TX_AF; + HAL_GPIO_Init(USART_TX_GPIO_PORT, &GPIO_InitStruct); - GPIO_InitStruct.Pin = USART_RX_PIN; - GPIO_InitStruct.Alternate = USART_RX_AF; + GPIO_InitStruct.Pin = USART_RX_PIN; + 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 */ - HAL_NVIC_SetPriority(USART_IRQ,0,1); - HAL_NVIC_EnableIRQ(USART_IRQ ); + /* ENABLE NVIC */ + HAL_NVIC_SetPriority(USART_IRQ,0,1); + HAL_NVIC_EnableIRQ(USART_IRQ ); } #if (defined (__CC_ARM)) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) diff --git a/User/version.h b/User/version.h index d1dd41f..fa6736a 100644 --- a/User/version.h +++ b/User/version.h @@ -6,14 +6,14 @@ #define VERSION_H -#define __PY32F030xx_STK_BSP_VERSION_MAIN (0x01U) /*!< [31:24] main version */ -#define __PY32F030xx_STK_BSP_VERSION_SUB1 (0x00U) /*!< [23:16] sub1 version */ -#define __PY32F030xx_STK_BSP_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ -#define __PY32F030xx_STK_BSP_VERSION_RC (0x00U) /*!< [7:0] release candidate */ -#define __PY32F030xx_STK_BSP_VERSION ((__PY32F030xx_STK_BSP_VERSION_MAIN << 24) \ - |(__PY32F030xx_STK_BSP_VERSION_SUB1 << 16) \ - |(__PY32F030xx_STK_BSP_VERSION_SUB2 << 8 ) \ - |(__PY32F030xx_STK_BSP_VERSION_RC)) +#define VERSION_MAIN (0x01U) /*!< [31:24] main version */ +#define VERSION_SUB1 (0x00U) /*!< [23:16] sub1 version */ +#define VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ +#define VERSION_RC (0x00U) /*!< [7:0] release candidate */ +#define VERSION ((VERSION_MAIN << 24) \ + |(VERSION_SUB1 << 16) \ + |(VERSION_SUB2 << 8 ) \ + |(VERSION_RC)) /** * @brief This method returns the PY32F030 STK BSP Driver revision. @@ -21,7 +21,7 @@ */ static inline uint32_t BSP_GetVersion(void) { - return __PY32F030xx_STK_BSP_VERSION; + return VERSION; } #endif //VERSION_H