diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-11-20 16:53:33 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-11-20 16:53:33 +0100 |
commit | 87feae8a58bcda71b2e60a9156f678f3c4cec6d7 (patch) | |
tree | d0fb3837d45088dc0758eb27b8c575c2e6b2870c | |
parent | 4413a40440a48aa0f79ae4bec0adf3a68408a0e3 (diff) |
add clang-tidy and clang-format
-rw-r--r-- | .clang-format | 17 | ||||
-rw-r--r-- | .clang-tidy | 19 | ||||
-rw-r--r-- | .editorconfig | 12 | ||||
-rw-r--r-- | nrf528xx/main.c | 16 | ||||
-rw-r--r-- | nrf528xx/makefile | 10 | ||||
-rw-r--r-- | nrf528xx/readme.md | 2 | ||||
-rw-r--r-- | readme.md | 2 |
7 files changed, 69 insertions, 9 deletions
diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..2f7e218 --- /dev/null +++ b/.clang-format @@ -0,0 +1,17 @@ +--- +AccessModifierOffset: 0 +AlignConsecutiveAssignments: true +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLoopsOnASingleLine: true +BasedOnStyle: LLVM +BreakBeforeBraces: Attach +ColumnLimit: 100 +IndentCaseLabels: true +IndentWidth: '4' +Language: Cpp +Standard: Cpp11 +TabWidth: '4' +UseTab: Always +... + +# vim: ft=yaml diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..2cca939 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,19 @@ +Checks: '-*,readability-identifier-naming' +CheckOptions: + - { key: readability-identifier-naming.EnumCase, value: lower_case } + - { key: readability-identifier-naming.EnumPrefix, value: cd_e_ } + - { key: readability-identifier-naming.FunctionCase, value: lower_case } + - { key: readability-identifier-naming.FunctionPrefix, value: cd_ } + - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.GlobalConstantIgnoredRegexp, value: _.* } + - { key: readability-identifier-naming.GlobalConstantPrefix, value: CD_ } + - { key: readability-identifier-naming.GlobalVariableCase, value: lower_case } + - { key: readability-identifier-naming.GlobalVariableIgnoredRegexp, value: _.* } + - { key: readability-identifier-naming.GlobalVariablePrefix, value: g_cd_ } + - { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE } + - { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: _.* } + - { key: readability-identifier-naming.MacroDefinitionPrefix, value: CD_ } + - { key: readability-identifier-naming.StructCase, value: lower_case } + - { key: readability-identifier-naming.StructPrefix, value: cd_s_ } + +# vim: ft=yaml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ec90e12 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = tab +indent_size = 2 +end_of_line = lf +insert_final_newline = true + +[*.md] +indent_style = space +indent_size = 2 + diff --git a/nrf528xx/main.c b/nrf528xx/main.c index 22777f9..c85a6c1 100644 --- a/nrf528xx/main.c +++ b/nrf528xx/main.c @@ -1,13 +1,13 @@ -#include <zephyr/zephyr.h> #include <zephyr/drivers/gpio.h> +#include <zephyr/zephyr.h> -static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); +static const struct gpio_dt_spec CD_LED = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); -void main() { - gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE); +void main() { // NOLINT + gpio_pin_configure_dt(&CD_LED, GPIO_OUTPUT_ACTIVE); - while (1) { - gpio_pin_toggle_dt(&led); - k_msleep(500); - } + while (1) { + gpio_pin_toggle_dt(&CD_LED); + k_msleep(500); + } } diff --git a/nrf528xx/makefile b/nrf528xx/makefile new file mode 100644 index 0000000..ab7d624 --- /dev/null +++ b/nrf528xx/makefile @@ -0,0 +1,10 @@ +.PHONY: format + +SRCS := + +SRCS += $(wildcard *.c) +SRCS += $(wildcard *.h) + +format: + clang-format -i $(SRCS) + clang-tidy --fix-errors $(SRCS) diff --git a/nrf528xx/readme.md b/nrf528xx/readme.md index 3cd3f02..dda17b9 100644 --- a/nrf528xx/readme.md +++ b/nrf528xx/readme.md @@ -1,5 +1,7 @@ # nrf528xx subdirectory +> the makefile in this folder isn't used for building but for auxiliary rules + ## building ```bash @@ -1,4 +1,4 @@ -# project domotica +# casa domotica still WIP |