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

added disableDynamicPayloads() #318

Merged
merged 2 commits into from
Jan 4, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
20 changes: 20 additions & 0 deletions RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,26 @@ void RF24::enableDynamicPayloads(void)
dynamic_payloads_enabled = true;
}

/****************************************************************************/
void RF24::disableDynamicPayloads(void)
{
// Disables dynamic payload throughout the system. Also disables Ack Payloads

//toggle_features();
write_register(FEATURE,read_register(FEATURE) & ~(_BV(EN_DPL) | _BV(EN_ACK_PAY)));


IF_SERIAL_DEBUG(printf("FEATURE=%i\r\n",read_register(FEATURE)));

// Disable dynamic payload on all pipes
//
// Not sure the use case of only having dynamic payload on certain
// pipes, so the library does not support it.
write_register(DYNPD,read_register(DYNPD) & ~( _BV(DPL_P5) | _BV(DPL_P4) | _BV(DPL_P3) | _BV(DPL_P2) | _BV(DPL_P1) | _BV(DPL_P0)));

dynamic_payloads_enabled = false;
}

/****************************************************************************/

void RF24::enableAckPayload(void)
Expand Down
9 changes: 9 additions & 0 deletions RF24.h
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,15 @@ s *
*/
void enableDynamicPayloads(void);

/**
* Disable dynamically-sized payloads
*
* This disables dynamic payloads on ALL pipes. Since Ack Payloads
* requires Dynamic Payloads, Ack Payloads are also disabled.
*
*/
void disableDynamicPayloads(void);

/**
* Enable dynamic ACKs (single write multicast or unicast) for chosen messages
*
Expand Down