Skip to content

Commit 4b7ab9c

Browse files
authored
Update clang format (#940)
* satisfy nRF24/.github#9 * ran clang-format * use a separate workflow to check code format * disable ATTinyCore in Arduino CI currently too much headache from upstream problems (namely in Arduino CLI tool) * reduce duplicate CI triggers * add dependabot to update CI dependencies
1 parent 638095e commit 4b7ab9c

25 files changed

+174
-177
lines changed

.clang-format

+7-16
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ DeriveLineEnding: false
6767
DerivePointerAlignment: false
6868
DisableFormat: false
6969
EmptyLineBeforeAccessModifier: Always
70-
# ---
71-
# only in v13+
72-
# EmptyLineAfterAccessModifier: Leave
73-
# ---
70+
EmptyLineAfterAccessModifier: Leave
7471
ExperimentalAutoDetectBinPacking: false
7572
FixNamespaceComments: true
7673
IncludeBlocks: Preserve
@@ -89,10 +86,7 @@ IncludeCategories:
8986
CaseSensitive: false
9087
IncludeIsMainRegex: "(Test)?$"
9188
IncludeIsMainSourceRegex: ""
92-
# ---
93-
# only in v13+
94-
# IndentAccessModifiers: false
95-
# ---
89+
IndentAccessModifiers: false
9690
IndentCaseLabels: true
9791
IndentCaseBlocks: false
9892
IndentGotoLabels: false
@@ -117,15 +111,12 @@ PenaltyExcessCharacter: 1000000
117111
PenaltyReturnTypeOnItsOwnLine: 60
118112
PenaltyIndentedWhitespace: 0
119113
PointerAlignment: Left
120-
# ---
121-
# only in v13+
122-
# ReferenceAlignment: Right
123-
# ---
114+
ReferenceAlignment: Pointer
124115
ReflowComments: true
125-
# ---
126-
# only in v13+
127-
# ShortNamespaceLines: 0
128-
# ---
116+
SpacesInLineCommentPrefix:
117+
Maximum: -1
118+
Minimum: 0
119+
ShortNamespaceLines: 0
129120
# Sort**** is about sorting include/using statements alphabetically
130121
SortIncludes: false
131122
SortUsingDeclarations: false

.github/dependabot.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
# Workflow files stored in the
10+
# default location of `.github/workflows`
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"

.github/workflows/build_arduino.yml

+50-55
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,21 @@ name: Arduino CLI build
22

33
on:
44
pull_request:
5-
types: [opened, reopened]
5+
branches: [master]
66
paths:
77
- ".github/workflows/build_arduino.yml"
88
- "examples/**"
99
- "!examples/old_backups/**"
1010
- "RF24.*"
1111
push:
12+
branches: [master]
1213
paths:
1314
- ".github/workflows/build_arduino.yml"
1415
- "examples/**"
1516
- "!examples/old_backups/**"
1617

1718
jobs:
18-
check_formatting:
19-
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
20-
with:
21-
ignore: examples/old_backups
22-
extensions: ino
23-
2419
build:
25-
needs: check_formatting
2620
uses: nRF24/.github/.github/workflows/build_arduino.yaml@main
2721
with:
2822
sketch-paths: |
@@ -114,55 +108,56 @@ jobs:
114108
- fqbn: arduino:samd:mkrzero # InterruptConfigure.ino uses pin 2
115109
enable-deltas-report: true
116110

117-
attiny:
118-
needs: check_formatting
119-
uses: nRF24/.github/.github/workflows/build_arduino.yaml@main
120-
with:
121-
platforms: |
122-
- source-url: "http://drazzy.com/package_drazzy.com_index.json"
123-
name: "ATTinyCore:avr"
124-
- name: "arduino:avr"
125-
sketch-paths: |
126-
- examples/rf24_ATTiny/rf24ping85
127-
- examples/rf24_ATTiny/timingSearch3pin
128-
fqbn: ${{ matrix.fqbn }}
129-
enable-deltas-report: ${{ matrix.enable-deltas-report }}
130-
strategy:
131-
fail-fast: false
132-
matrix:
133-
fqbn:
134-
- ATTinyCore:avr:attinyx4
135-
- ATTinyCore:avr:attinyx4opti
136-
- ATTinyCore:avr:attinyx4micr
137-
- ATTinyCore:avr:attinyx5
138-
- ATTinyCore:avr:attinyx5micr
139-
- ATTinyCore:avr:attinyx8
140-
- ATTinyCore:avr:attinyx8opti
141-
- ATTinyCore:avr:attinyx8micr
142-
- ATTinyCore:avr:attinyx7
143-
- ATTinyCore:avr:attinyx7opti
144-
- ATTinyCore:avr:attinyx7micr
145-
- ATTinyCore:avr:attinyx61
146-
- ATTinyCore:avr:attinyx61opti
147-
- ATTinyCore:avr:attinyx41
148-
- ATTinyCore:avr:attinyx41opti
149-
- ATTinyCore:avr:attinyx41micr
150-
# - ATTinyCore:avr:attiny43 # doesn't seem to support USI implementation of SPI
151-
- ATTinyCore:avr:attiny828
152-
- ATTinyCore:avr:attiny828opti
153-
- ATTinyCore:avr:attiny1634
154-
- ATTinyCore:avr:attiny1634opti
155-
- ATTinyCore:avr:attinyx313
156-
# By default, don't generate size deltas data.
157-
enable-deltas-report:
158-
- false
159-
# Generate size deltas data for this board
160-
include:
161-
- fqbn: ATTinyCore:avr:attinyx5
162-
enable-deltas-report: true
111+
#### NOTE installing ATTinyCore has become too problematic for various reasons
112+
#### I'll have to revisit this later when the Arduino CLI tool gets their act together
113+
# attiny:
114+
# uses: nRF24/.github/.github/workflows/build_arduino.yaml@main
115+
# with:
116+
# platforms: |
117+
# - source-url: "http://drazzy.com/package_drazzy.com_index.json"
118+
# name: "ATTinyCore:avr"
119+
# - name: "arduino:avr"
120+
# sketch-paths: |
121+
# - examples/rf24_ATTiny/rf24ping85
122+
# - examples/rf24_ATTiny/timingSearch3pin
123+
# fqbn: ${{ matrix.fqbn }}
124+
# enable-deltas-report: ${{ matrix.enable-deltas-report }}
125+
# strategy:
126+
# fail-fast: false
127+
# matrix:
128+
# fqbn:
129+
# - ATTinyCore:avr:attinyx4
130+
# - ATTinyCore:avr:attinyx4opti
131+
# - ATTinyCore:avr:attinyx4micr
132+
# - ATTinyCore:avr:attinyx5
133+
# - ATTinyCore:avr:attinyx5micr
134+
# - ATTinyCore:avr:attinyx8
135+
# - ATTinyCore:avr:attinyx8opti
136+
# - ATTinyCore:avr:attinyx8micr
137+
# - ATTinyCore:avr:attinyx7
138+
# - ATTinyCore:avr:attinyx7opti
139+
# - ATTinyCore:avr:attinyx7micr
140+
# - ATTinyCore:avr:attinyx61
141+
# - ATTinyCore:avr:attinyx61opti
142+
# - ATTinyCore:avr:attinyx41
143+
# - ATTinyCore:avr:attinyx41opti
144+
# - ATTinyCore:avr:attinyx41micr
145+
# # - ATTinyCore:avr:attiny43 # doesn't seem to support USI implementation of SPI
146+
# - ATTinyCore:avr:attiny828
147+
# - ATTinyCore:avr:attiny828opti
148+
# - ATTinyCore:avr:attiny1634
149+
# - ATTinyCore:avr:attiny1634opti
150+
# - ATTinyCore:avr:attinyx313
151+
# # By default, don't generate size deltas data.
152+
# enable-deltas-report:
153+
# - false
154+
# # Generate size deltas data for this board
155+
# include:
156+
# - fqbn: ATTinyCore:avr:attinyx5
157+
# enable-deltas-report: true
163158

164159
# When using a matrix to compile for multiple boards, it's necessary to use a separate job for the deltas report
165160
report:
166-
needs: [build, attiny]
161+
needs: [build] # , attiny]
167162
if: github.event_name == 'pull_request'
168163
uses: nRF24/.github/.github/workflows/arduino_size_deltas.yaml@main

.github/workflows/build_linux.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Linux build
22

33
on:
4-
pull_request_target:
54
pull_request:
6-
types: [opened, reopened]
5+
branches: [master]
76
paths:
87
- "*.h"
98
- "*.cpp"
@@ -25,6 +24,7 @@ on:
2524
- "pyRF24/pyRF24.cpp"
2625
- ".github/workflows/build_linux.yml"
2726
push:
27+
branches: [master]
2828
paths:
2929
- "*.h"
3030
- "*.cpp"
@@ -53,14 +53,9 @@ env:
5353
BUILD_TYPE: Release
5454

5555
jobs:
56-
check_formatting:
57-
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
58-
with:
59-
ignore: 'examples|examples_pico|utility/RPi/bcm2835.h|utility/RPi/bcm2835.c'
6056

6157
####################### using Makefile #############################
6258
build:
63-
needs: check_formatting
6459
runs-on: ubuntu-latest
6560

6661
strategy:
@@ -150,7 +145,6 @@ jobs:
150145
151146
####################### using CMake ################################
152147
using_cmake:
153-
needs: check_formatting
154148
uses: nRF24/.github/.github/workflows/build_linux_cmake.yaml@main
155149
with:
156150
rf24-ref: ${{ github.sha }}

.github/workflows/build_platformIO.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ name: PlatformIO build
22

33
on:
44
pull_request:
5-
types: [opened, reopened]
5+
branches: [master]
66
paths:
77
- ".github/workflows/build_platformIO.yml"
88
- "library.json"
99
- "examples/**"
1010
- "!examples/old_backups/**"
1111
- "!examples/rf24_ATTiny/**"
1212
push:
13+
branches: [master]
1314
paths:
1415
- ".github/workflows/build_platformIO.yml"
1516
- "library.json"
@@ -26,14 +27,8 @@ jobs:
2627
with:
2728
deploy-release: ${{ github.event_name == 'release' }}
2829

29-
check_formatting:
30-
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
31-
with:
32-
ignore: examples/old_backups
33-
extensions: ino
34-
3530
build:
36-
needs: [check_formatting, validate_lib_json]
31+
needs: [validate_lib_json]
3732
uses: nRF24/.github/.github/workflows/build_platformio.yaml@main
3833
with:
3934
example-path: ${{ matrix.example }}

.github/workflows/build_rp2xxx.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Pico SDK build
22

33
on:
4-
pull_request_target:
54
push:
5+
branches: [master]
66
paths:
77
- ".github/workflows/build_rp2xxx.yml"
88
- "*.h"
@@ -13,7 +13,7 @@ on:
1313
- "utility/rp2/*"
1414
- "examples_pico/*"
1515
pull_request:
16-
types: [opened, reopened]
16+
branches: [master]
1717
paths:
1818
- ".github/workflows/build_rp2xxx.yml"
1919
- "*.h"
@@ -25,13 +25,7 @@ on:
2525
- "examples_pico/*"
2626

2727
jobs:
28-
check_formatting:
29-
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
30-
with:
31-
ignore: '!examples_pico|'
32-
3328
build:
34-
needs: check_formatting
3529
uses: nRF24/.github/.github/workflows/build_pico_sdk.yaml@main
3630
with:
3731
board-id: ${{ matrix.board }}

.github/workflows/clang_format.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: check code formatting
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
check_formatting:
11+
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
12+
with:
13+
ignore: examples/old_backups|utility/RPi/bcm2835.h|utility/RPi/bcm2835.c
14+
extensions: ino,c,cpp,h

.github/workflows/doxygen.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: build Docs
22

33
on:
44
pull_request:
5-
types: [opened, reopened]
5+
branches: [master]
66
paths:
77
- "*.h"
88
- "docs/**"
@@ -17,6 +17,7 @@ on:
1717
- "Doxyfile"
1818
- "library.properties" # get lib version from here
1919
push:
20+
branches: [master]
2021
paths:
2122
- "*.h"
2223
- "docs/**"
@@ -32,7 +33,6 @@ on:
3233
- "library.properties" # get lib version from here
3334
release:
3435
types: [published, edited]
35-
branches: [master]
3636
workflow_dispatch:
3737

3838
jobs:

RF24.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ class RF24
878878
* to clear by issuing txStandBy() or ensure appropriate time between transmissions.
879879
*
880880
* Use txStandBy() when this function returns `false`.
881-
*
881+
*
882882
* Example (Partial blocking):
883883
* @code
884884
* radio.writeFast(&buf,32); // Writes 1 payload to the buffers

examples_linux/scanner.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
03/17/2013 : Charles-Henri Hallard (http://hallard.me)
1010
Modified to use with Arduipi board http://hallard.me/arduipi
11-
Changed to use modified bcm2835 and RF24 library
11+
Changed to use modified bcm2835 and RF24 library
1212
1313
*/
1414

examples_linux/streamingData.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,11 @@ void master()
219219
cout << "Aborting at payload " << buffer[0];
220220
break;
221221
}
222-
} // while
222+
} // while
223+
223224
uint32_t elapsedTime = getMicros(); // end the timer
224225
cout << "Time to transmit data = ";
225-
cout << elapsedTime; // print the timer result
226+
cout << elapsedTime; // print the timer result
226227
cout << " us. " << failures; // print number of retries
227228
cout << " failures detected. Leaving TX role." << endl;
228229
} // master

nRF24L01.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2007 Stefan Engelke <[email protected]>
3-
Portions Copyright (C) 2011 Greg Copeland
3+
Portions Copyright (C) 2011 Greg Copeland
44
55
Permission is hereby granted, free of charge, to any person
66
obtaining a copy of this software and associated documentation

0 commit comments

Comments
 (0)