-
Notifications
You must be signed in to change notification settings - Fork 118
Public Interface
Constructor. Creates a new instance of this driver. Before using, you create an instance and send in the unique pins that this chip is connected to.
Parameters:
- _cepin: The pin attached to Chip Enable on the RF module
- _cspin: The pin attached to Chip Select
Begin operation of the chip. Call this in setup(), before calling any other methods.
Set RF communication channel.
Parameters:
- channel: Which RF channel to communicate on, 0-127
Set Payload Size. This implementation uses a pre-stablished fixed payload size for all transmissions.
Parameters:
- size: The number of bytes in the payload
Get Payload Size.
Returns:
- The number of bytes in the payload
Print a giant block of debugging information to stdout.
Warning: Does nothing if stdout is not defined. See fdevopen in stdio.h
Start listening on the pipes opened for reading. Be sure to open some pipes for reading first. Do not call 'write' while in this mode, without first calling 'stopListening'.
Stop listening for incoming messages. Necessary to do this before writing.
Write to the open writing pipe. This blocks until the message is successfully acknowledged by the receiver or the timeout/retransmit maxima are reached. In the current configuration, the max delay here is 60ms.
Parameters:
- buf: Pointer to the data to be sent
- True if the payload was delivered successfully false if not
Test whether there are bytes available to be read.
Returns:
- True if there is a payload available, false if none is
Read the payload. Return the last payload received
Parameters:
- buf: Pointer to a buffer where the data should be written
- True if the payload was delivered successfully false if not
Open a pipe for writing. Addresses are 40-bit hex values, e.g.:
openWritingPipe(0xF0F0F0F0F0);
Parameters:
- address: The 40-bit address of the pipe to open. This can be any value whatsoever, as# long as you are the only one writing to it and only one other radio is listening to it. Coordinate these pipe addresses amongst nodes on the network.
Open a pipe for reading.
Warning: all 5 reading pipes should share the first 32 bits. Only the least significant byte should be unique, e.g.
openReadingPipe(0xF0F0F0F0AA); openReadingPipe(0xF0F0F0F066);
Parameters:
- number: Which pipe# to open, 1-5.
- address: The 40-bit address of the pipe to open.