Add .clang-format and .editorconfig
This commit is contained in:
parent
b28ff29f45
commit
ec9fa4bb0f
137
.clang-format
Normal file
137
.clang-format
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
# BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveMacros: false
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignEscapedNewlines: Right
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: MultiLine
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: true
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: false
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakBeforeInheritanceComma: false
|
||||||
|
BreakInheritanceList: BeforeColon
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakConstructorInitializers: BeforeColon
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 80
|
||||||
|
CommentPragmas: "^ IWYU pragma:"
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DeriveLineEnding: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: true
|
||||||
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
IncludeBlocks: Regroup
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^[<"]stm'
|
||||||
|
Priority: 2
|
||||||
|
SortPriority: 0
|
||||||
|
- Regex: "^<std"
|
||||||
|
Priority: 4
|
||||||
|
SortPriority: 0
|
||||||
|
- Regex: ".*"
|
||||||
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
IncludeIsMainRegex: "(Test)?$"
|
||||||
|
IncludeIsMainSourceRegex: ""
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentGotoLabels: true
|
||||||
|
IndentPPDirectives: None
|
||||||
|
IndentWidth: 2
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
MacroBlockBegin: ""
|
||||||
|
MacroBlockEnd: ""
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBinPackProtocolList: Auto
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PointerAlignment: Left
|
||||||
|
ReflowComments: true
|
||||||
|
SortIncludes: true
|
||||||
|
SortUsingDeclarations: true
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
Standard: Latest
|
||||||
|
StatementMacros:
|
||||||
|
- Q_UNUSED
|
||||||
|
- QT_REQUIRE_VERSION
|
||||||
|
TabWidth: 8
|
||||||
|
UseCRLF: false
|
||||||
|
UseTab: Never
|
||||||
|
---
|
||||||
|
|
8
.editorconfig
Normal file
8
.editorconfig
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
charset = utf-8
|
||||||
|
|
||||||
|
[*.{h,c}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
@ -2,6 +2,7 @@
|
|||||||
#define __FT_USER_INPUTS_H
|
#define __FT_USER_INPUTS_H
|
||||||
|
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
|
|
||||||
#include "stm32g4xx_hal.h"
|
#include "stm32g4xx_hal.h"
|
||||||
|
|
||||||
void handle_button_press(const ButtonPressEvent* ev);
|
void handle_button_press(const ButtonPressEvent* ev);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define __VEHICLE_H
|
#define __VEHICLE_H
|
||||||
|
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
|
|
||||||
#include "stm32g4xx_hal.h"
|
#include "stm32g4xx_hal.h"
|
||||||
#include "stm32g4xx_hal_fdcan.h"
|
#include "stm32g4xx_hal_fdcan.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "events.h"
|
#include "events.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "user_inputs.h"
|
#include "user_inputs.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
static volatile EventQueue event_queue = {.read_idx = 0, .write_idx = 0};
|
static volatile EventQueue event_queue = {.read_idx = 0, .write_idx = 0};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "leds.h"
|
#include "leds.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#include "stm32g4xx_hal.h"
|
#include "stm32g4xx_hal.h"
|
||||||
#include "stm32g4xx_hal_gpio.h"
|
#include "stm32g4xx_hal_gpio.h"
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ int main(void) {
|
|||||||
|
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
/* USER CODE BEGIN WHILE */
|
/* USER CODE BEGIN WHILE */
|
||||||
uint32_t rpi_active_since = 0;
|
uint32_t last_can = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
/* USER CODE END WHILE */
|
/* USER CODE END WHILE */
|
||||||
|
|
||||||
@ -126,6 +126,10 @@ int main(void) {
|
|||||||
HAL_GPIO_WritePin(DISP_RESET_GPIO_Port, DISP_RESET_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(DISP_RESET_GPIO_Port, DISP_RESET_Pin, GPIO_PIN_SET);
|
||||||
}
|
}
|
||||||
handle_events();
|
handle_events();
|
||||||
|
if (now - last_can > 100) {
|
||||||
|
// vehicle_send_mission_select(MISSION_ACCELERATION);
|
||||||
|
last_can = now;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* USER CODE END 3 */
|
/* USER CODE END 3 */
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
#include "rpi.h"
|
#include "rpi.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
|
|
||||||
#include "stm32g4xx_hal_def.h"
|
#include "stm32g4xx_hal_def.h"
|
||||||
#include "stm32g4xx_hal_gpio.h"
|
#include "stm32g4xx_hal_gpio.h"
|
||||||
#include "stm32g4xx_hal_i2c.h"
|
#include "stm32g4xx_hal_i2c.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
uint8_t i2c_rx_buf[I2C_RX_BUF_SIZE];
|
uint8_t i2c_rx_buf[I2C_RX_BUF_SIZE];
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "stm32g4xx_hal_gpio.h"
|
|
||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
|
|
||||||
|
#include "stm32g4xx_hal_gpio.h"
|
||||||
|
|
||||||
void HAL_GPIO_EXTI_Callback(uint16_t pin) {
|
void HAL_GPIO_EXTI_Callback(uint16_t pin) {
|
||||||
Event ev;
|
Event ev;
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
|
|
||||||
#include "stm32g4xx_hal_def.h"
|
#include "stm32g4xx_hal_def.h"
|
||||||
#include "stm32g4xx_hal_fdcan.h"
|
#include "stm32g4xx_hal_fdcan.h"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user