Implement dynamic payloads, with an example

This commit is contained in:
maniacbug
2011-07-10 08:00:58 -07:00
parent 98fbd44111
commit 63eb62ebc3
3 changed files with 96 additions and 34 deletions

34
RF24.h
View File

@@ -112,16 +112,6 @@ protected:
*/
uint8_t read_payload(void* buf, uint8_t len);
/**
* Read the payload length
*
* For dynamic payloads, this pulls the size of the payload off
* the chip
*
* @return Payload length of last-received dynamic payload
*/
uint8_t read_payload_length(void);
/**
* Empty the receive buffer
*
@@ -352,7 +342,7 @@ public:
void setChannel(uint8_t channel);
/**
* Set Payload Size
* Set Static Payload Size
*
* This implementation uses a pre-stablished fixed payload size for all
* transmissions. If this method is never called, the driver will always
@@ -366,7 +356,7 @@ public:
void setPayloadSize(uint8_t size);
/**
* Get Payload Size
* Get Static Payload Size
*
* @see setPayloadSize()
*
@@ -374,6 +364,16 @@ public:
*/
uint8_t getPayloadSize(void);
/**
* Get Dynamic Payload Size
*
* For dynamic payloads, this pulls the size of the payload off
* the chip
*
* @return Payload length of last-received dynamic payload
*/
uint8_t getDynamicPayloadSize(void);
/**
* Print a giant block of debugging information to stdout
*
@@ -425,6 +425,16 @@ public:
*/
void enableAckPayload(void);
/**
* Enable dynamically-sized payloads
*
* This way you don't always have to send large packets just to send them
* once in a while. This enables dynamic payloads on ALL pipes.
*
* @see examples/pingpair_pl/pingpair_dyn.pde
*/
void enableDynamicPayloads(void);
/**
* Write an ack payload for the specified pipe
*