refactor!: namespace nRF24L01.h defines to avoid name collisions#1066
Merged
refactor!: namespace nRF24L01.h defines to avoid name collisions#1066
Conversation
Copilot
AI
changed the title
[WIP] [WIP] Address feedback from PR #1065 by creating separate patch for master branch
refactor: namespace nRF24L01.h register defines to avoid name collisions
Apr 3, 2026
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
092a00c to
38e42c7
Compare
Agent-Logs-Url: https://github.com/nRF24/RF24/sessions/7ca3a7e2-a935-43a4-a67e-446bff9a6255 Co-authored-by: 2bndy5 <14963867+2bndy5@users.noreply.github.com>
…revert #1065 changes Agent-Logs-Url: https://github.com/nRF24/RF24/sessions/f6f20af3-c294-4719-be64-cc4df041d703 Co-authored-by: 2bndy5 <14963867+2bndy5@users.noreply.github.com>
38e42c7 to
2bd5fa1
Compare
Contributor
Memory usage change @ 7c2159a
Click for full report per board
|
| Sketch | Flash | % | RAM for global variables | % |
|---|---|---|---|---|
| examples/GettingStarted | 0 | 0 | 0 | 0 |
| examples/AcknowledgementPayloads | 0 | 0 | 0 | 0 |
| examples/ManualAcknowledgements | 0 | 0 | 0 | 0 |
| examples/StreamingData | 0 | 0 | 0 | 0 |
| examples/MulticeiverDemo | 0 | 0 | 0 | 0 |
| examples/InterruptConfigure | 0 | 0 | 0 | 0 |
| examples/scanner | 0 | 0 | 0 | 0 |
| examples/encodeRadioDetails | 0 | 0 | 0 | 0 |
arduino:samd:mkrzero
| Sketch | Flash | % | RAM for global variables | % |
|---|---|---|---|---|
| examples/GettingStarted | 0 | 0 | 0 | 0 |
| examples/AcknowledgementPayloads | 0 | 0 | 0 | 0 |
| examples/ManualAcknowledgements | 0 | 0 | 0 | 0 |
| examples/StreamingData | 0 | 0 | 0 | 0 |
| examples/MulticeiverDemo | 0 | 0 | 0 | 0 |
| examples/InterruptConfigure | 0 | 0 | 0 | 0 |
| examples/scanner | 0 | 0 | 0 | 0 |
| examples/encodeRadioDetails | 0 | 0 | 0 | 0 |
2bndy5
requested changes
Apr 4, 2026
Agent-Logs-Url: https://github.com/nRF24/RF24/sessions/ca2acbf8-daff-4e5d-b930-c66d3b024bc4 Co-authored-by: 2bndy5 <14963867+2bndy5@users.noreply.github.com>
Member
|
@TMRh20 What do you think? This should prevent further name collisions in the global namespace. I also reverted patches that were done to fix previously discovered collisions. As for breaking user code, I don't think nRF24L01.h serves any real utility for users. It would seem as though most 3rd-party tutorials still |
Member
|
I think this is a great idea instead of renaming things every time there is a naming conflict. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Converts all
#definemacros innRF24L01.hto typed constants under anamespace nRF24L01to eliminate global namespace pollution and prevent name collisions (e.g.,CD,TX_DS,RX_DR).Changes
nRF24L01.h:#include <stdint.h>; replaced all#definemacros withconstexpr uint8_tconstants insidenamespace nRF24L01NRF_CONFIG→CONFIGNRF_STATUS→STATUSRF24_NOP→NOPRF24.h:#include "nRF24L01.h"from inside atypedef enumblock to top-levelnRF24L01::prefixRF24.cpp:using namespace nRF24L01;to keep the implementation unchangedNRF_CONFIG→CONFIGNRF_STATUS→STATUSRF24_NOP→NOPMigration
User code that includes
nRF24L01.hand uses these constants directly must either add ausingdirective or qualify with the namespace prefix: