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 #219

Merged
merged 5 commits into from
Feb 20, 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
31 changes: 11 additions & 20 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Always
AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
Expand Down 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"
10 changes: 2 additions & 8 deletions .github/workflows/build_arduino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,19 @@ name: Arduino CLI build

on:
pull_request:
types: [opened, reopened]
branches: [master, v1.x]
paths:
- ".github/workflows/build_arduino.yml"
- "examples/**"

push:
branches: [master, v1.x]
paths:
- ".github/workflows/build_arduino.yml"
- "examples/**"

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

build:
needs: check_formatting
uses: nRF24/.github/.github/workflows/build_arduino.yaml@main
with:
sketch-paths: |
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Linux build

on:
pull_request:
types: [opened, reopened]
branches: [master, v1.x]
paths:
- "*.h"
- "*.cpp"
Expand All @@ -15,6 +15,7 @@ on:
- "**pyRF24Network/*.cpp"
- ".github/workflows/linux_build.yml"
push:
branches: [master, v1.x]
paths:
- "*.h"
- "*.cpp"
Expand All @@ -30,13 +31,7 @@ on:
types: [created]

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

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

on:
pull_request:
types: [opened, reopened]
branches: [master, v1.x]
paths:
- ".github/workflows/build_platformIO.yml"
- "library.json"
- "examples/**"
- "!examples/*.zip"
push:
branches: [master, v1.x]
paths:
- ".github/workflows/build_platformIO.yml"
- "library.json"
Expand All @@ -24,13 +25,8 @@ jobs:
with:
deploy-release: ${{ github.event_name == 'release' }}

check_formatting:
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
with:
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
8 changes: 2 additions & 6 deletions .github/workflows/build_rp2xxx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Pico SDK build

on:
push:
branches: [master, v1.x]
paths:
- ".github/workflows/build_rp2xxx.yml"
- "*.h"
Expand All @@ -10,7 +11,7 @@ on:
- "cmake/"
- "examples_pico/*"
pull_request:
types: [opened, reopened]
branches: [master, v1.x]
paths:
- ".github/workflows/build_rp2xxx.yml"
- "*.h"
Expand All @@ -20,13 +21,8 @@ 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
13 changes: 13 additions & 0 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: check code formatting

on:
push:
branches: [master, v1.x]
pull_request:
branches: [master, v1.x]

jobs:
check_formatting:
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
with:
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, v1.x]
paths:
- "*.h"
- "docs/**"
Expand All @@ -13,6 +13,7 @@ on:
- "Doxyfile"
- "library.properties" # get lib version from here
push:
branches: [master, v1.x]
paths:
- "*.h"
- "docs/**"
Expand All @@ -23,7 +24,6 @@ on:
- "Doxyfile"
- "library.properties" # get lib version from here
release:
branches: [master]
types: [published, edited]
workflow_dispatch:

Expand Down
2 changes: 1 addition & 1 deletion RF24Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ bool ESBNetwork<radio_t>::write(uint16_t to_node, uint8_t sendType)
isAckType = true;

/*if( ( (frame_buffer[7] % 2) && frame_buffer[6] == NETWORK_MORE_FRAGMENTS) ){
isAckType = 0;
isAckType = 0;
}*/

// Throw it away if it's not a valid address
Expand Down
28 changes: 14 additions & 14 deletions RF24Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ struct RF24NetworkFrame
uint16_t message_size;

/**
* On Arduino, the message buffer is just a pointer, and can be pointed to any memory location.
* On Linux the message buffer is a standard byte array, equal in size to the defined MAX_PAYLOAD_SIZE
*/
* On Arduino, the message buffer is just a pointer, and can be pointed to any memory location.
* On Linux the message buffer is a standard byte array, equal in size to the defined MAX_PAYLOAD_SIZE
*/
#if defined(RF24_LINUX)
uint8_t message_buffer[MAX_PAYLOAD_SIZE]; // Array to store the message
#else
Expand All @@ -334,15 +334,15 @@ struct RF24NetworkFrame
RF24NetworkFrame() {}

/**
* **Constructor for Linux platforms** - create a network frame with data
* Frames are constructed and handled differently on Arduino/AVR and Linux devices (`#if defined RF24_LINUX`)
*
* @param _header The RF24Network header to be stored in the frame
* @param _message The 'message' or data.
* @param _len The size of the 'message' or data.
*
* Frames are used internally and by external systems. See RF24NetworkHeader.
*/
* **Constructor for Linux platforms** - create a network frame with data
* Frames are constructed and handled differently on Arduino/AVR and Linux devices (`#if defined RF24_LINUX`)
*
* @param _header The RF24Network header to be stored in the frame
* @param _message The 'message' or data.
* @param _len The size of the 'message' or data.
*
* Frames are used internally and by external systems. See RF24NetworkHeader.
*/
#if defined(RF24_LINUX) || defined(DOXYGEN_FORCED)
RF24NetworkFrame(RF24NetworkHeader& _header, const void* _message = NULL, uint16_t _len = 0) : header(_header), message_size(_len)
{
Expand Down Expand Up @@ -402,10 +402,10 @@ class ESBNetwork
* nrf_to_nrf radio1;
* RF52Network network(radio1); // for nRF52xxx family
* @endcode
*
*
* @see v2.0 supports [nrf_to_nrf Arduino library](https://github.com/TMRh20/nrf_to_nrf)
* for nrf52 chips' internal radio.
*
*
* @param _radio The underlying radio driver instance
*/
ESBNetwork(radio_t& _radio);
Expand Down