]> git.leonardobizzoni.com Git - pioneer-stm32/commitdiff
add c++ style guide
authorFederica Di Lauro <federicadilauro1998@gmail.com>
Thu, 19 Sep 2019 11:25:24 +0000 (13:25 +0200)
committerFederica Di Lauro <federicadilauro1998@gmail.com>
Thu, 19 Sep 2019 11:25:24 +0000 (13:25 +0200)
README.md
otto_controller_source/.settings/org.eclipse.cdt.core.prefs
otto_controller_source/.settings/org.eclipse.cdt.ui.prefs
otto_controller_source/Src/main.cpp

index 5fe22a18223b126da31eee73451d5393f5dfddfc..b8f739f8c12d2fd9ec7ce77d1d713e43dab51206 100644 (file)
--- a/README.md
+++ b/README.md
@@ -2,3 +2,8 @@
 Material regarding my stage with Iralab, designing and realizing a 2 wheeled robot
 
 See the [wiki](https://github.com/iralabdisco/otto/wiki) for more info about this projects
+
+Follow [Google C++ guideline](https://github.com/google/styleguide) while working on the project
+
+Eclipse's formatting configuration file can be found [here](https://github.com/google/styleguide/blob/gh-pages/eclipse-cpp-google-style.xml)
+
index f2d65127be4b13f09828af1fd1c9c5a425036adb..cfb80d513c320c2332ef79a4b8bc8761d0111680 100644 (file)
@@ -1,18 +1,18 @@
 eclipse.preferences.version=1
 org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=18
 org.eclipse.cdt.core.formatter.alignment_for_assignment=16
-org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
+org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=16
 org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.cdt.core.formatter.alignment_for_compact_if=0
 org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
 org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
-org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
+org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=83
 org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
-org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
+org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=51
 org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
 org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.cdt.core.formatter.alignment_for_member_access=0
-org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
+org.eclipse.cdt.core.formatter.alignment_for_member_access=16
+org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=18
 org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=18
 org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
 org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
@@ -23,7 +23,7 @@ org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_l
 org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
 org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
 org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
-org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
+org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=2
 org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
 org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
 org.eclipse.cdt.core.formatter.comment_formatter_off_tag=@formatter\:off
@@ -33,11 +33,11 @@ org.eclipse.cdt.core.formatter.continuation_indentation=2
 org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
 org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
 org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
-org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
+org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=1
 org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
-org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=true
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
 org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=true
+org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
 org.eclipse.cdt.core.formatter.indent_empty_lines=false
 org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
 org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
@@ -45,14 +45,14 @@ org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
 org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=true
 org.eclipse.cdt.core.formatter.indentation.size=2
 org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
 org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
 org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
-org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
-org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=insert
-org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
 org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
 org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
 org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
@@ -137,8 +137,8 @@ org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
 org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
 org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
 org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
 org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
 org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
 org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
index a16bf7dc76f44352daedbeec12e0a8fd8439c72b..d5d807621dca085a07e69b7d737007b01432e017 100644 (file)
@@ -1,3 +1,3 @@
 eclipse.preferences.version=1
-formatter_profile=_GoogleC++
+formatter_profile=_Google C++
 formatter_settings_version=1
index 4f03abf610b236f0769bddc271a9af6220679994..35512fad19f993cae03f188c682db6c48e72aa6e 100644 (file)
@@ -53,13 +53,13 @@ DMA_HandleTypeDef hdma_usart3_tx;
 \r
 /* Private function prototypes -----------------------------------------------*/\r
 void\r
-SystemClock_Config (void);\r
+SystemClock_Config(void);\r
 static void\r
-MX_GPIO_Init (void);\r
+MX_GPIO_Init(void);\r
 static void\r
-MX_DMA_Init (void);\r
+MX_DMA_Init(void);\r
 static void\r
-MX_USART3_UART_Init (void);\r
+MX_USART3_UART_Init(void);\r
 /* USER CODE BEGIN PFP */\r
 \r
 /* USER CODE END PFP */\r
@@ -73,8 +73,7 @@ MX_USART3_UART_Init (void);
  * @brief  The application entry point.\r
  * @retval int\r
  */\r
-int\r
-main (void) {\r
+int main(void) {\r
   /* USER CODE BEGIN 1 */\r
 \r
   /* USER CODE END 1 */\r
@@ -82,23 +81,23 @@ main (void) {
   /* MCU Configuration--------------------------------------------------------*/\r
 \r
   /* Reset of all peripherals, Initializes the Flash interface and the Systick. */\r
-  HAL_Init ();\r
+  HAL_Init();\r
 \r
   /* USER CODE BEGIN Init */\r
 \r
   /* USER CODE END Init */\r
 \r
   /* Configure the system clock */\r
-  SystemClock_Config ();\r
+  SystemClock_Config();\r
 \r
   /* USER CODE BEGIN SysInit */\r
 \r
   /* USER CODE END SysInit */\r
 \r
   /* Initialize all configured peripherals */\r
-  MX_GPIO_Init ();\r
-  MX_DMA_Init ();\r
-  MX_USART3_UART_Init ();\r
+  MX_GPIO_Init();\r
+  MX_DMA_Init();\r
+  MX_USART3_UART_Init();\r
   /* USER CODE BEGIN 2 */\r
 \r
   /* USER CODE END 2 */\r
@@ -117,8 +116,7 @@ main (void) {
  * @brief System Clock Configuration\r
  * @retval None\r
  */\r
-void\r
-SystemClock_Config (void) {\r
+void SystemClock_Config(void) {\r
   RCC_OscInitTypeDef RCC_OscInitStruct = { 0 };\r
   RCC_ClkInitTypeDef RCC_ClkInitStruct = { 0 };\r
   RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = { 0 };\r
@@ -134,8 +132,8 @@ SystemClock_Config (void) {
   RCC_OscInitStruct.HSIState = RCC_HSI_ON;\r
   RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;\r
   RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;\r
-  if (HAL_RCC_OscConfig (&RCC_OscInitStruct) != HAL_OK) {\r
-    Error_Handler ();\r
+  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {\r
+    Error_Handler();\r
   }\r
   /** Initializes the CPU, AHB and APB busses clocks \r
    */\r
@@ -146,13 +144,13 @@ SystemClock_Config (void) {
   RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;\r
   RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;\r
 \r
-  if (HAL_RCC_ClockConfig (&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) {\r
-    Error_Handler ();\r
+  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) {\r
+    Error_Handler();\r
   }\r
   PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART3;\r
   PeriphClkInitStruct.Usart3ClockSelection = RCC_USART3CLKSOURCE_PCLK1;\r
-  if (HAL_RCCEx_PeriphCLKConfig (&PeriphClkInitStruct) != HAL_OK) {\r
-    Error_Handler ();\r
+  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {\r
+    Error_Handler();\r
   }\r
 }\r
 \r
@@ -161,8 +159,7 @@ SystemClock_Config (void) {
  * @param None\r
  * @retval None\r
  */\r
-static void\r
-MX_USART3_UART_Init (void) {\r
+static void MX_USART3_UART_Init(void) {\r
 \r
   /* USER CODE BEGIN USART3_Init 0 */\r
 \r
@@ -181,8 +178,8 @@ MX_USART3_UART_Init (void) {
   huart3.Init.OverSampling = UART_OVERSAMPLING_16;\r
   huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;\r
   huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;\r
-  if (HAL_UART_Init (&huart3) != HAL_OK) {\r
-    Error_Handler ();\r
+  if (HAL_UART_Init(&huart3) != HAL_OK) {\r
+    Error_Handler();\r
   }\r
   /* USER CODE BEGIN USART3_Init 2 */\r
 \r
@@ -193,8 +190,7 @@ MX_USART3_UART_Init (void) {
 /** \r
  * Enable DMA controller clock\r
  */\r
-static void\r
-MX_DMA_Init (void) {\r
+static void MX_DMA_Init(void) {\r
 \r
   /* DMA controller clock enable */\r
   __HAL_RCC_DMA1_CLK_ENABLE()\r
@@ -202,11 +198,11 @@ MX_DMA_Init (void) {
 \r
   /* DMA interrupt init */\r
   /* DMA1_Stream1_IRQn interrupt configuration */\r
-  HAL_NVIC_SetPriority (DMA1_Stream1_IRQn, 0, 0);\r
-  HAL_NVIC_EnableIRQ (DMA1_Stream1_IRQn);\r
+  HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 0, 0);\r
+  HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn);\r
   /* DMA1_Stream3_IRQn interrupt configuration */\r
-  HAL_NVIC_SetPriority (DMA1_Stream3_IRQn, 0, 0);\r
-  HAL_NVIC_EnableIRQ (DMA1_Stream3_IRQn);\r
+  HAL_NVIC_SetPriority(DMA1_Stream3_IRQn, 0, 0);\r
+  HAL_NVIC_EnableIRQ(DMA1_Stream3_IRQn);\r
 \r
 }\r
 \r
@@ -215,8 +211,7 @@ MX_DMA_Init (void) {
  * @param None\r
  * @retval None\r
  */\r
-static void\r
-MX_GPIO_Init (void) {\r
+static void MX_GPIO_Init(void) {\r
 \r
   /* GPIO Ports Clock Enable */\r
   __HAL_RCC_GPIOD_CLK_ENABLE()\r
@@ -232,8 +227,7 @@ MX_GPIO_Init (void) {
  * @brief  This function is executed in case of error occurrence.\r
  * @retval None\r
  */\r
-void\r
-Error_Handler (void) {\r
+void Error_Handler(void) {\r
   /* USER CODE BEGIN Error_Handler_Debug */\r
   /* User can add his own implementation to report the HAL error return state */\r
 \r