Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcb3531e

Browse files
authored
Merge pull request#175 from iabdalkader/add_format_check
workflows: Add format check.
2 parents018b231 +cd681be commitcb3531e

37 files changed

+2524
-2277
lines changed

‎.clang-format‎

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Note: The list of ForEachMacros can be obtained using:
4+
#
5+
# git grep -h '^#define [^[:space:]]*FOR_EACH[^[:space:]]*(' include/ \
6+
# | sed "s,^#define \([^[:space:]]*FOR_EACH[^[:space:]]*\)(.*$, - '\1'," \
7+
# | sort | uniq
8+
#
9+
# References:
10+
# - https://clang.llvm.org/docs/ClangFormatStyleOptions.html
11+
12+
---
13+
BasedOnStyle:LLVM
14+
AlignOperands:Align
15+
BreakBeforeTernaryOperators:false
16+
EmptyLineBeforeAccessModifier:LogicalBlock
17+
AlignConsecutiveMacros:AcrossComments
18+
AllowShortBlocksOnASingleLine:Never
19+
AllowShortCaseLabelsOnASingleLine:false
20+
AllowShortEnumsOnASingleLine:false
21+
AllowShortFunctionsOnASingleLine:None
22+
AllowShortIfStatementsOnASingleLine:false
23+
AllowShortLoopsOnASingleLine:false
24+
AttributeMacros:
25+
-__aligned
26+
-__deprecated
27+
-__packed
28+
-__printf_like
29+
-__syscall
30+
-__syscall_always_inline
31+
-__subsystem
32+
BitFieldColonSpacing:After
33+
BreakBeforeBraces:Attach
34+
ColumnLimit:100
35+
ConstructorInitializerIndentWidth:4
36+
ContinuationIndentWidth:4
37+
ForEachMacros:
38+
-'ARRAY_FOR_EACH'
39+
-'ARRAY_FOR_EACH_PTR'
40+
-'FOR_EACH'
41+
-'FOR_EACH_FIXED_ARG'
42+
-'FOR_EACH_IDX'
43+
-'FOR_EACH_IDX_FIXED_ARG'
44+
-'FOR_EACH_NONEMPTY_TERM'
45+
-'FOR_EACH_FIXED_ARG_NONEMPTY_TERM'
46+
-'RB_FOR_EACH'
47+
-'RB_FOR_EACH_CONTAINER'
48+
-'SYS_DLIST_FOR_EACH_CONTAINER'
49+
-'SYS_DLIST_FOR_EACH_CONTAINER_SAFE'
50+
-'SYS_DLIST_FOR_EACH_NODE'
51+
-'SYS_DLIST_FOR_EACH_NODE_SAFE'
52+
-'SYS_SEM_LOCK'
53+
-'SYS_SFLIST_FOR_EACH_CONTAINER'
54+
-'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE'
55+
-'SYS_SFLIST_FOR_EACH_NODE'
56+
-'SYS_SFLIST_FOR_EACH_NODE_SAFE'
57+
-'SYS_SLIST_FOR_EACH_CONTAINER'
58+
-'SYS_SLIST_FOR_EACH_CONTAINER_SAFE'
59+
-'SYS_SLIST_FOR_EACH_NODE'
60+
-'SYS_SLIST_FOR_EACH_NODE_SAFE'
61+
-'_WAIT_Q_FOR_EACH'
62+
-'Z_FOR_EACH'
63+
-'Z_FOR_EACH_ENGINE'
64+
-'Z_FOR_EACH_EXEC'
65+
-'Z_FOR_EACH_FIXED_ARG'
66+
-'Z_FOR_EACH_FIXED_ARG_EXEC'
67+
-'Z_FOR_EACH_IDX'
68+
-'Z_FOR_EACH_IDX_EXEC'
69+
-'Z_FOR_EACH_IDX_FIXED_ARG'
70+
-'Z_FOR_EACH_IDX_FIXED_ARG_EXEC'
71+
-'Z_GENLIST_FOR_EACH_CONTAINER'
72+
-'Z_GENLIST_FOR_EACH_CONTAINER_SAFE'
73+
-'Z_GENLIST_FOR_EACH_NODE'
74+
-'Z_GENLIST_FOR_EACH_NODE_SAFE'
75+
-'STRUCT_SECTION_FOREACH'
76+
-'STRUCT_SECTION_FOREACH_ALTERNATE'
77+
-'TYPE_SECTION_FOREACH'
78+
-'K_SPINLOCK'
79+
-'COAP_RESOURCE_FOREACH'
80+
-'COAP_SERVICE_FOREACH'
81+
-'COAP_SERVICE_FOREACH_RESOURCE'
82+
-'HTTP_RESOURCE_FOREACH'
83+
-'HTTP_SERVER_CONTENT_TYPE_FOREACH'
84+
-'HTTP_SERVICE_FOREACH'
85+
-'HTTP_SERVICE_FOREACH_RESOURCE'
86+
-'I3C_BUS_FOR_EACH_I3CDEV'
87+
-'I3C_BUS_FOR_EACH_I2CDEV'
88+
-'MIN_HEAP_FOREACH'
89+
IfMacros:
90+
-'CHECKIF'
91+
IncludeCategories:
92+
-Regex:'^".*\.h"$'
93+
Priority:0
94+
-Regex:'^<(assert|complex|ctype|errno|fenv|float|inttypes|limits|locale|math|setjmp|signal|stdarg|stdbool|stddef|stdint|stdio|stdlib|string|tgmath|time|wchar|wctype)\.h>$'
95+
Priority:1
96+
-Regex:'^\<zephyr/.*\.h\>$'
97+
Priority:2
98+
-Regex:'.*'
99+
Priority:3
100+
IndentCaseLabels:false
101+
IndentGotoLabels:true
102+
IndentAccessModifiers:false
103+
AccessModifierOffset:-4
104+
IndentWidth:4
105+
InsertBraces:true
106+
InsertNewlineAtEOF:true
107+
SpaceBeforeInheritanceColon:true
108+
SpaceBeforeParens:ControlStatements
109+
SortIncludes:Never
110+
SeparateDefinitionBlocks:Always
111+
UseTab:ForContinuationAndIndentation
112+
TabWidth:4
113+
WhitespaceSensitiveMacros:
114+
-COND_CODE_0
115+
-COND_CODE_1
116+
-IF_DISABLED
117+
-IF_ENABLED
118+
-LISTIFY
119+
-STRINGIFY
120+
-Z_STRINGIFY
121+
-DT_FOREACH_PROP_ELEM_SEP

‎.github/workflows/checkpatch.yml‎

Lines changed: 0 additions & 31 deletions
This file was deleted.

‎.github/workflows/commit_check.yml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name:'Check Commit Message'
2+
3+
on:
4+
pull_request:
5+
types:
6+
-opened
7+
-edited
8+
-reopened
9+
-synchronize
10+
branches:
11+
-'main'
12+
13+
jobs:
14+
check-commit-messages:
15+
runs-on:ubuntu-latest
16+
steps:
17+
-name:'Check commit messages format'
18+
uses:gsactions/commit-message-checker@v2
19+
with:
20+
pattern:'^[^!]+: [A-Za-z]+.+ .+$'
21+
flags:'gm'
22+
error:'Commit subject line must match the following pattern: <scope>: <description>'
23+
excludeTitle:'false'
24+
excludeDescription:'true'
25+
checkAllCommitMessages:'true'
26+
accessToken:${{ secrets.GITHUB_TOKEN }}
27+
-name:'Check commit messages length'
28+
uses:gsactions/commit-message-checker@v2
29+
with:
30+
pattern:'^[^#].{10,80}$'
31+
error:'Commit subject line maximum line length of 80 characters is exceeded.'
32+
excludeTitle:'false'
33+
excludeDescription:'true'
34+
checkAllCommitMessages:'true'
35+
accessToken:${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/format_check.yml‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name:'Format Check'
2+
3+
on:
4+
push:
5+
branches:
6+
-'main'
7+
paths:
8+
-'**/*.c'
9+
-'**/*.cpp'
10+
-'**/*.h'
11+
-'**/*.hpp'
12+
13+
pull_request:
14+
types:
15+
-opened
16+
-edited
17+
-reopened
18+
-synchronize
19+
branches:
20+
-'main'
21+
paths:
22+
-'**/*.c'
23+
-'**/*.cpp'
24+
-'**/*.h'
25+
-'**/*.hpp'
26+
27+
workflow_dispatch:
28+
inputs:
29+
logLevel:
30+
description:'Log level'
31+
required:true
32+
default:'warning'
33+
34+
jobs:
35+
format-check:
36+
runs-on:ubuntu-latest
37+
strategy:
38+
matrix:
39+
path:
40+
-check:'cores/arduino/'
41+
exclude:'cores/arduino/api/'
42+
-check:'loader/'
43+
exclude:'loader/llext_exports\.c$'
44+
-check:'libraries/'
45+
exclude:'examples'
46+
exclude:'extras'
47+
exclude:'ea_malloc'
48+
fail-fast:false
49+
50+
steps:
51+
-name:Checkout code
52+
uses:actions/checkout@v4
53+
with:
54+
submodules:false
55+
persist-credentials:false
56+
57+
-name:Run clang-format check
58+
uses:jidicula/clang-format-action@v4.15.0
59+
with:
60+
clang-format-version:'19'
61+
check-path:${{ matrix.path['check'] }}
62+
exclude-regex:${{ matrix.path['exclude'] }}

‎cores/arduino/Arduino.h‎

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
/* Check all pins are defined only once*/
2727
#defineDIGITAL_PIN_CHECK_UNIQUE(i, _) \
28-
((DT_FOREACH_PROP_ELEM_SEP_VARGS( \
29-
DT_PATH(zephyr_user), digital_pin_gpios, DIGITAL_PIN_EXISTS, (+), \
30-
DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), digital_pin_gpios, i)), \
28+
((DT_FOREACH_PROP_ELEM_SEP_VARGS(\
29+
DT_PATH(zephyr_user), digital_pin_gpios, DIGITAL_PIN_EXISTS, (+),\
30+
DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), digital_pin_gpios, i)),\
3131
DT_PHA_BY_IDX(DT_PATH(zephyr_user), digital_pin_gpios, i, pin))) == 1)
3232

3333
#if !LISTIFY(DT_PROP_LEN(DT_PATH(zephyr_user), digital_pin_gpios), DIGITAL_PIN_CHECK_UNIQUE, (&&))
@@ -44,36 +44,37 @@
4444
(DIGITAL_PIN_EXISTS(n, p, i, dev, num) ? i :0)
4545

4646
/* Only matched pin returns non-zero value, so the sum is matched pin's index*/
47-
#defineDIGITAL_PIN_GPIOS_FIND_PIN(dev, pin) \
48-
DT_FOREACH_PROP_ELEM_SEP_VARGS(DT_PATH(zephyr_user), digital_pin_gpios, \
49-
LED_BUILTIN_INDEX_BY_REG_AND_PINNUM, (+), dev, pin)
47+
#defineDIGITAL_PIN_GPIOS_FIND_PIN(dev, pin)\
48+
DT_FOREACH_PROP_ELEM_SEP_VARGS(DT_PATH(zephyr_user), digital_pin_gpios,\
49+
LED_BUILTIN_INDEX_BY_REG_AND_PINNUM, (+), dev, pin)
5050

5151
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), builtin_led_gpios) && \
5252
(DT_PROP_LEN(DT_PATH(zephyr_user), builtin_led_gpios) >0)
5353

54-
#if !(DT_FOREACH_PROP_ELEM_SEP_VARGS(\
55-
DT_PATH(zephyr_user), digital_pin_gpios, DIGITAL_PIN_EXISTS, (+), \
56-
DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0)), \
57-
DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0, pin)) > 0)
54+
#if !(DT_FOREACH_PROP_ELEM_SEP_VARGS( \
55+
DT_PATH(zephyr_user), digital_pin_gpios, DIGITAL_PIN_EXISTS, (+), \
56+
DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0)), \
57+
DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0, pin)) > 0)
5858
#warning "pin not found in digital_pin_gpios"
5959
#else
6060
#defineLED_BUILTIN \
61-
DIGITAL_PIN_GPIOS_FIND_PIN( \
62-
DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0)), \
61+
DIGITAL_PIN_GPIOS_FIND_PIN(\
62+
DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0)),\
6363
DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0, pin))
6464
#endif
6565

6666
/* If digital-pin-gpios is not defined, tries to use the led0 alias*/
6767
#elif DT_NODE_EXISTS(DT_ALIAS(led0))
6868

69-
#if !(DT_FOREACH_PROP_ELEM_SEP_VARGS(DT_PATH(zephyr_user), digital_pin_gpios, DIGITAL_PIN_EXISTS, \
70-
(+), DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_ALIAS(led0), gpios,0)), \
71-
DT_PHA_BY_IDX(DT_ALIAS(led0), gpios, 0, pin)) > 0)
69+
#if !(DT_FOREACH_PROP_ELEM_SEP_VARGS(DT_PATH(zephyr_user), digital_pin_gpios, DIGITAL_PIN_EXISTS, \
70+
(+), \
71+
DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_ALIAS(led0), gpios, 0)), \
72+
DT_PHA_BY_IDX(DT_ALIAS(led0), gpios, 0, pin)) > 0)
7273
#warning "pin not found in digital_pin_gpios"
7374
#else
7475
#defineLED_BUILTIN \
75-
DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_ALIAS(led0), gpios, 0)), \
76-
DT_PHA_BY_IDX(DT_ALIAS(led0), gpios, 0, pin))
76+
DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_ALIAS(led0), gpios, 0)),\
77+
DT_PHA_BY_IDX(DT_ALIAS(led0), gpios, 0, pin))
7778
#endif
7879

7980
#endif// builtin_led_gpios
@@ -95,11 +96,13 @@ enum digitalPins {
9596

9697
#ifdef CONFIG_ADC
9798

98-
#defineAN_ENUMS(n, p, i) A ## i = DIGITAL_PIN_GPIOS_FIND_PIN( \
99-
DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), p, i)), \
100-
DT_PHA_BY_IDX(DT_PATH(zephyr_user), p, i, pin)),
101-
enum analogPins {DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user),
102-
adc_pin_gpios, AN_ENUMS) };
99+
#defineAN_ENUMS(n, p, i) \
100+
A##i = DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), p, i)), \
101+
DT_PHA_BY_IDX(DT_PATH(zephyr_user), p, i, pin)),
102+
103+
enum analogPins {
104+
DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), adc_pin_gpios, AN_ENUMS)
105+
};
103106

104107
// We provide analogReadResolution APIs
105108
voidanalogReadResolution(int bits);
@@ -112,8 +115,11 @@ void analogReadResolution(int bits);
112115
#undef DAC1
113116
#undef DAC2
114117
#undef DAC3
115-
#defineDAC_ENUMS(n, p, i) DAC ## i = i,
116-
enum dacPins {DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), dac_channels, DAC_ENUMS) NUM_OF_DACS };
118+
#defineDAC_ENUMS(n, p, i) DAC##i = i,
119+
120+
enum dacPins {
121+
DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), dac_channels, DAC_ENUMS) NUM_OF_DACS
122+
};
117123

118124
#endif
119125

@@ -122,10 +128,10 @@ void noInterrupts(void);
122128

123129
intdigitalPinToInterrupt(pin_size_t pin);
124130

125-
#definedigitalPinToPort(x) (x)
131+
#definedigitalPinToPort(x)(x)
126132
#definedigitalPinToBitMask(x) (x)
127-
#defineportOutputRegister(x) (x)
128-
#defineportInputRegister(x) (x)
133+
#defineportOutputRegister(x)(x)
134+
#defineportInputRegister(x)(x)
129135

130136
voidanalogReadResolution(int bits);
131137
voidanalogWriteResolution(int bits);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp