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

Alias gpio pin datatype #898

Merged
merged 6 commits into from
Apr 22, 2023
Merged

Alias gpio pin datatype #898

merged 6 commits into from
Apr 22, 2023

Conversation

2bndy5
Copy link
Member

@2bndy5 2bndy5 commented Feb 17, 2023

resolves #896

@github-actions
Copy link
Contributor

Memory usage change @ ea66839

Board flash % RAM for global variables %
ATTinyCore:avr:attinyx5 💚 -88 - 0 -1.07 - 0.0 💚 -2 - 0 -0.39 - 0.0
arduino:avr:nano 💚 -56 - -48 -0.18 - -0.16 💚 -2 - -2 -0.1 - -0.1
arduino:samd:mkrzero 💚 -48 - -44 -0.02 - -0.02 0 - 0 0.0 - 0.0
Click for full report table
Board examples/rf24_ATTiny/rf24ping85
flash
% examples/rf24_ATTiny/rf24ping85
RAM for global variables
% examples/rf24_ATTiny/timingSearch3pin
flash
% examples/rf24_ATTiny/timingSearch3pin
RAM for global variables
% examples/GettingStarted
flash
% examples/GettingStarted
RAM for global variables
% examples/AcknowledgementPayloads
flash
% examples/AcknowledgementPayloads
RAM for global variables
% examples/ManualAcknowledgements
flash
% examples/ManualAcknowledgements
RAM for global variables
% examples/StreamingData
flash
% examples/StreamingData
RAM for global variables
% examples/MulticeiverDemo
flash
% examples/MulticeiverDemo
RAM for global variables
% examples/InterruptConfigure
flash
% examples/InterruptConfigure
RAM for global variables
% examples/scanner
flash
% examples/scanner
RAM for global variables
% examples/encodeRadioDetails
flash
% examples/encodeRadioDetails
RAM for global variables
%
ATTinyCore:avr:attinyx5 -88 -1.07 -2 -0.39 0 0.0 0 0.0
arduino:avr:nano -48 -0.16 -2 -0.1 -48 -0.16 -2 -0.1 -48 -0.16 -2 -0.1 -48 -0.16 -2 -0.1 -50 -0.16 -2 -0.1 -48 -0.16 -2 -0.1 -48 -0.16 -2 -0.1 -56 -0.18 -2 -0.1
arduino:samd:mkrzero -48 -0.02 0 0.0 -48 -0.02 0 0.0 -48 -0.02 0 0.0 -48 -0.02 0 0.0 -48 -0.02 0 0.0 -48 -0.02 0 0.0 -44 -0.02 0 0.0 -44 -0.02 0 0.0
Click for full report CSV
Board,examples/rf24_ATTiny/rf24ping85<br>flash,%,examples/rf24_ATTiny/rf24ping85<br>RAM for global variables,%,examples/rf24_ATTiny/timingSearch3pin<br>flash,%,examples/rf24_ATTiny/timingSearch3pin<br>RAM for global variables,%,examples/GettingStarted<br>flash,%,examples/GettingStarted<br>RAM for global variables,%,examples/AcknowledgementPayloads<br>flash,%,examples/AcknowledgementPayloads<br>RAM for global variables,%,examples/ManualAcknowledgements<br>flash,%,examples/ManualAcknowledgements<br>RAM for global variables,%,examples/StreamingData<br>flash,%,examples/StreamingData<br>RAM for global variables,%,examples/MulticeiverDemo<br>flash,%,examples/MulticeiverDemo<br>RAM for global variables,%,examples/InterruptConfigure<br>flash,%,examples/InterruptConfigure<br>RAM for global variables,%,examples/scanner<br>flash,%,examples/scanner<br>RAM for global variables,%,examples/encodeRadioDetails<br>flash,%,examples/encodeRadioDetails<br>RAM for global variables,%
ATTinyCore:avr:attinyx5,-88,-1.07,-2,-0.39,0,0.0,0,0.0
arduino:avr:nano,,,,,,,,,-48,-0.16,-2,-0.1,-48,-0.16,-2,-0.1,-48,-0.16,-2,-0.1,-48,-0.16,-2,-0.1,-50,-0.16,-2,-0.1,-48,-0.16,-2,-0.1,-48,-0.16,-2,-0.1,-56,-0.18,-2,-0.1
arduino:samd:mkrzero,,,,,,,,,-48,-0.02,0,0.0,-48,-0.02,0,0.0,-48,-0.02,0,0.0,-48,-0.02,0,0.0,-48,-0.02,0,0.0,-48,-0.02,0,0.0,-44,-0.02,0,0.0,-44,-0.02,0,0.0

@2bndy5
Copy link
Member Author

2bndy5 commented Feb 17, 2023

I'm assuming that report is measured in bytes. Didn't expect the ATTiny to have that much improvement!

@TMRh20
Copy link
Member

TMRh20 commented Feb 19, 2023

Nice

@2bndy5
Copy link
Member Author

2bndy5 commented Mar 3, 2023

I hardware tested this on Pico SDK (while I still had the HW setup for addressing #899); test went well. I also added a follow up to the 557d165 that removed a useless RF24::spi member declared on the RP2040.

I also fixed compiler warnings about the magic numbers used when the pin numbers are not passed to the RF24 c'tor.

includes a follow up from
557d165
in which a useless RF24::spi member was declared for RP2040 platform.
This will fix RF24::isValid() and
prevents overflow from using the old 0xFFFF value in the RF24 overloaded c'tor that accepts no args.

It also helps to avoid "magic numbers" as was previously used.
@2bndy5
Copy link
Member Author

2bndy5 commented Mar 16, 2023

I tested this on Arduino (Feather RP2040) and Linux (SPIDEV and MRAA drivers).

I'm going to modify the examples to replace the "magic numbers" passed to the c'tor with defines:

#define CSN_PIN 0
#ifdef MRAA
    #define CE_PIN 15 // GPIO22
#else
    #define CE_PIN 22
#endif
// Generic:
RF24 radio(CE_PIN, CSN_PIN);

This way it is explicit what the numbers represent in the c'tor args.

@2bndy5 2bndy5 requested a review from TMRh20 April 21, 2023 18:22
@TMRh20 TMRh20 merged commit 31e8e41 into master Apr 22, 2023
@2bndy5 2bndy5 deleted the alias-gpio-pin-datatype branch April 22, 2023 10:21
2bndy5 added a commit to nRF24/pyRF24 that referenced this pull request Dec 4, 2023
This is actually an overlooked follow up to nRF24/RF24#898

The problematic inconsistency was primarily affecting builds with the RPi driver.
2bndy5 added a commit to nRF24/pyRF24 that referenced this pull request Dec 5, 2023
This is actually an overlooked follow up to nRF24/RF24#898

The problematic inconsistency was primarily affecting builds with the RPi driver.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

typedef GPIO pin variables
2 participants