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

use enum to return precise FIFO state #1009

Merged
merged 1 commit into from
Jan 10, 2025
Merged

use enum to return precise FIFO state #1009

merged 1 commit into from
Jan 10, 2025

Conversation

2bndy5
Copy link
Member

@2bndy5 2bndy5 commented Nov 19, 2024

I got this idea from developing rf24-rs project.

This has the advantage of accurately describing a FIFO's state (including data corruption over SPI) when using RF24::isFifo().

I also deprecated the overloaded RF24::isFifo(bool about_tx, bool check_empty) because the data returned could be considered inaccurate.

Copy link
Contributor

Memory usage change @ fd90bc4

Board flash % RAM for global variables %
arduino:avr:nano 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board 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
%
arduino:avr:nano 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrzero 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
Click for full report CSV
Board,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,%
arduino:avr:nano,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:mkrzero,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0

@2bndy5
Copy link
Member Author

2bndy5 commented Jan 4, 2025

works fine with the py wrapper:

>>> from RF24 import RF24
>>> r = RF24(22, 0)
>>> r.begin()
True
>>> r.isFifo(1)
RF24.rf24_fifo_state_e.RF24_FIFO_EMPTY
>>> r.enableAckPayload()
>>> r.writeAckPayload(1, b"bla")
True
>>> r.isFifo(1)
RF24.rf24_fifo_state_e.RF24_FIFO_OCCUPIED
>>> r.writeAckPayload(1, b"bla")
True
>>> r.writeAckPayload(1, b"bla")
True
>>> r.writeAckPayload(1, b"bla")
False
>>> r.isFifo(1)
RF24.rf24_fifo_state_e.RF24_FIFO_FULL
>>> r.flush_tx()
15
>>> r.isFifo(1)
RF24.rf24_fifo_state_e.RF24_FIFO_EMPTY

@2bndy5 2bndy5 requested a review from TMRh20 January 10, 2025 11:11
@2bndy5 2bndy5 merged commit e811d5c into master Jan 10, 2025
81 checks passed
@2bndy5 2bndy5 deleted the fifo-state-enum branch January 10, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants