Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update clang format #940

Merged
merged 8 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@ DeriveLineEnding: false
DerivePointerAlignment: false
DisableFormat: false
EmptyLineBeforeAccessModifier: Always
# ---
# only in v13+
# EmptyLineAfterAccessModifier: Leave
# ---
EmptyLineAfterAccessModifier: Leave
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
IncludeBlocks: Preserve
Expand All @@ -89,10 +86,7 @@ IncludeCategories:
CaseSensitive: false
IncludeIsMainRegex: "(Test)?$"
IncludeIsMainSourceRegex: ""
# ---
# only in v13+
# IndentAccessModifiers: false
# ---
IndentAccessModifiers: false
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: false
Expand All @@ -117,15 +111,12 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
# ---
# only in v13+
# ReferenceAlignment: Right
# ---
ReferenceAlignment: Pointer
ReflowComments: true
# ---
# only in v13+
# ShortNamespaceLines: 0
# ---
SpacesInLineCommentPrefix:
Maximum: -1
Minimum: 0
ShortNamespaceLines: 0
# Sort**** is about sorting include/using statements alphabetically
SortIncludes: false
SortUsingDeclarations: false
Expand Down
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "weekly"
105 changes: 50 additions & 55 deletions .github/workflows/build_arduino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,21 @@ name: Arduino CLI build

on:
pull_request:
types: [opened, reopened]
branches: [master]
paths:
- ".github/workflows/build_arduino.yml"
- "examples/**"
- "!examples/old_backups/**"
- "RF24.*"
push:
branches: [master]
paths:
- ".github/workflows/build_arduino.yml"
- "examples/**"
- "!examples/old_backups/**"

jobs:
check_formatting:
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
with:
ignore: examples/old_backups
extensions: ino

build:
needs: check_formatting
uses: nRF24/.github/.github/workflows/build_arduino.yaml@main
with:
sketch-paths: |
Expand Down Expand Up @@ -114,55 +108,56 @@ jobs:
- fqbn: arduino:samd:mkrzero # InterruptConfigure.ino uses pin 2
enable-deltas-report: true

attiny:
needs: check_formatting
uses: nRF24/.github/.github/workflows/build_arduino.yaml@main
with:
platforms: |
- source-url: "http://drazzy.com/package_drazzy.com_index.json"
name: "ATTinyCore:avr"
- name: "arduino:avr"
sketch-paths: |
- examples/rf24_ATTiny/rf24ping85
- examples/rf24_ATTiny/timingSearch3pin
fqbn: ${{ matrix.fqbn }}
enable-deltas-report: ${{ matrix.enable-deltas-report }}
strategy:
fail-fast: false
matrix:
fqbn:
- ATTinyCore:avr:attinyx4
- ATTinyCore:avr:attinyx4opti
- ATTinyCore:avr:attinyx4micr
- ATTinyCore:avr:attinyx5
- ATTinyCore:avr:attinyx5micr
- ATTinyCore:avr:attinyx8
- ATTinyCore:avr:attinyx8opti
- ATTinyCore:avr:attinyx8micr
- ATTinyCore:avr:attinyx7
- ATTinyCore:avr:attinyx7opti
- ATTinyCore:avr:attinyx7micr
- ATTinyCore:avr:attinyx61
- ATTinyCore:avr:attinyx61opti
- ATTinyCore:avr:attinyx41
- ATTinyCore:avr:attinyx41opti
- ATTinyCore:avr:attinyx41micr
# - ATTinyCore:avr:attiny43 # doesn't seem to support USI implementation of SPI
- ATTinyCore:avr:attiny828
- ATTinyCore:avr:attiny828opti
- ATTinyCore:avr:attiny1634
- ATTinyCore:avr:attiny1634opti
- ATTinyCore:avr:attinyx313
# By default, don't generate size deltas data.
enable-deltas-report:
- false
# Generate size deltas data for this board
include:
- fqbn: ATTinyCore:avr:attinyx5
enable-deltas-report: true
#### NOTE installing ATTinyCore has become too problematic for various reasons
#### I'll have to revisit this later when the Arduino CLI tool gets their act together
Comment on lines +111 to +112
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is disappointing, but I can't keep waiting for Arduino CLI to fix problems with installing third-party cores. Lately, if it isn't one problem then it is another problem.

Hopefully in a few months (or before our next release) I'll remember to check up on this. From what I can tell, the problem(s) can be reproduced locally without a CI runner...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change basically mens we won't be getting compile size delta summary for our ATTiny examples.

# attiny:
# uses: nRF24/.github/.github/workflows/build_arduino.yaml@main
# with:
# platforms: |
# - source-url: "http://drazzy.com/package_drazzy.com_index.json"
# name: "ATTinyCore:avr"
# - name: "arduino:avr"
# sketch-paths: |
# - examples/rf24_ATTiny/rf24ping85
# - examples/rf24_ATTiny/timingSearch3pin
# fqbn: ${{ matrix.fqbn }}
# enable-deltas-report: ${{ matrix.enable-deltas-report }}
# strategy:
# fail-fast: false
# matrix:
# fqbn:
# - ATTinyCore:avr:attinyx4
# - ATTinyCore:avr:attinyx4opti
# - ATTinyCore:avr:attinyx4micr
# - ATTinyCore:avr:attinyx5
# - ATTinyCore:avr:attinyx5micr
# - ATTinyCore:avr:attinyx8
# - ATTinyCore:avr:attinyx8opti
# - ATTinyCore:avr:attinyx8micr
# - ATTinyCore:avr:attinyx7
# - ATTinyCore:avr:attinyx7opti
# - ATTinyCore:avr:attinyx7micr
# - ATTinyCore:avr:attinyx61
# - ATTinyCore:avr:attinyx61opti
# - ATTinyCore:avr:attinyx41
# - ATTinyCore:avr:attinyx41opti
# - ATTinyCore:avr:attinyx41micr
# # - ATTinyCore:avr:attiny43 # doesn't seem to support USI implementation of SPI
# - ATTinyCore:avr:attiny828
# - ATTinyCore:avr:attiny828opti
# - ATTinyCore:avr:attiny1634
# - ATTinyCore:avr:attiny1634opti
# - ATTinyCore:avr:attinyx313
# # By default, don't generate size deltas data.
# enable-deltas-report:
# - false
# # Generate size deltas data for this board
# include:
# - fqbn: ATTinyCore:avr:attinyx5
# enable-deltas-report: true

# When using a matrix to compile for multiple boards, it's necessary to use a separate job for the deltas report
report:
needs: [build, attiny]
needs: [build] # , attiny]
if: github.event_name == 'pull_request'
uses: nRF24/.github/.github/workflows/arduino_size_deltas.yaml@main
10 changes: 2 additions & 8 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Linux build

on:
pull_request_target:
pull_request:
types: [opened, reopened]
branches: [master]
paths:
- "*.h"
- "*.cpp"
Expand All @@ -25,6 +24,7 @@ on:
- "pyRF24/pyRF24.cpp"
- ".github/workflows/build_linux.yml"
push:
branches: [master]
paths:
- "*.h"
- "*.cpp"
Expand Down Expand Up @@ -53,14 +53,9 @@ env:
BUILD_TYPE: Release

jobs:
check_formatting:
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
with:
ignore: 'examples|examples_pico|utility/RPi/bcm2835.h|utility/RPi/bcm2835.c'

####################### using Makefile #############################
build:
needs: check_formatting
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -150,7 +145,6 @@ jobs:

####################### using CMake ################################
using_cmake:
needs: check_formatting
uses: nRF24/.github/.github/workflows/build_linux_cmake.yaml@main
with:
rf24-ref: ${{ github.sha }}
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/build_platformIO.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ name: PlatformIO build

on:
pull_request:
types: [opened, reopened]
branches: [master]
paths:
- ".github/workflows/build_platformIO.yml"
- "library.json"
- "examples/**"
- "!examples/old_backups/**"
- "!examples/rf24_ATTiny/**"
push:
branches: [master]
paths:
- ".github/workflows/build_platformIO.yml"
- "library.json"
Expand All @@ -26,14 +27,8 @@ jobs:
with:
deploy-release: ${{ github.event_name == 'release' }}

check_formatting:
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
with:
ignore: examples/old_backups
extensions: ino

build:
needs: [check_formatting, validate_lib_json]
needs: [validate_lib_json]
uses: nRF24/.github/.github/workflows/build_platformio.yaml@main
with:
example-path: ${{ matrix.example }}
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/build_rp2xxx.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Pico SDK build

on:
pull_request_target:
push:
branches: [master]
paths:
- ".github/workflows/build_rp2xxx.yml"
- "*.h"
Expand All @@ -13,7 +13,7 @@ on:
- "utility/rp2/*"
- "examples_pico/*"
pull_request:
types: [opened, reopened]
branches: [master]
paths:
- ".github/workflows/build_rp2xxx.yml"
- "*.h"
Expand All @@ -25,13 +25,7 @@ on:
- "examples_pico/*"

jobs:
check_formatting:
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
with:
ignore: '!examples_pico|'

build:
needs: check_formatting
uses: nRF24/.github/.github/workflows/build_pico_sdk.yaml@main
with:
board-id: ${{ matrix.board }}
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: check code formatting

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
check_formatting:
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
with:
ignore: examples/old_backups|utility/RPi/bcm2835.h|utility/RPi/bcm2835.c
extensions: ino,c,cpp,h
4 changes: 2 additions & 2 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build Docs

on:
pull_request:
types: [opened, reopened]
branches: [master]
paths:
- "*.h"
- "docs/**"
Expand All @@ -17,6 +17,7 @@ on:
- "Doxyfile"
- "library.properties" # get lib version from here
push:
branches: [master]
paths:
- "*.h"
- "docs/**"
Expand All @@ -32,7 +33,6 @@ on:
- "library.properties" # get lib version from here
release:
types: [published, edited]
branches: [master]
workflow_dispatch:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion RF24.h
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ class RF24
* to clear by issuing txStandBy() or ensure appropriate time between transmissions.
*
* Use txStandBy() when this function returns `false`.
*
*
* Example (Partial blocking):
* @code
* radio.writeFast(&buf,32); // Writes 1 payload to the buffers
Expand Down
2 changes: 1 addition & 1 deletion examples_linux/scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

03/17/2013 : Charles-Henri Hallard (http://hallard.me)
Modified to use with Arduipi board http://hallard.me/arduipi
Changed to use modified bcm2835 and RF24 library
Changed to use modified bcm2835 and RF24 library

*/

Expand Down
5 changes: 3 additions & 2 deletions examples_linux/streamingData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,11 @@ void master()
cout << "Aborting at payload " << buffer[0];
break;
}
} // while
} // while

uint32_t elapsedTime = getMicros(); // end the timer
cout << "Time to transmit data = ";
cout << elapsedTime; // print the timer result
cout << elapsedTime; // print the timer result
cout << " us. " << failures; // print number of retries
cout << " failures detected. Leaving TX role." << endl;
} // master
Expand Down
2 changes: 1 addition & 1 deletion nRF24L01.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2007 Stefan Engelke <mbox@stefanengelke.de>
Portions Copyright (C) 2011 Greg Copeland
Portions Copyright (C) 2011 Greg Copeland

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
Loading
Loading