2 Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 version 2 as published by the Free Software Foundation.
21 #define IF_SERIAL_DEBUG(x) ({x;})
23 #define IF_SERIAL_DEBUG(x)
26 // Avoid spurious warnings
29 #define PROGMEM __attribute__(( section(".progmem.data") ))
31 #define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];}))
34 /****************************************************************************/
36 void RF24::csn(int mode
)
38 // Minimum ideal SPI bus speed is 2x data rate
39 // If we assume 2Mbs data rate and 16Mhz clock, a
40 // divider of 4 is the minimum we want.
41 // CLK:BUS 8Mhz:2Mhz, 16Mhz:4Mhz, or 20Mhz:5Mhz
42 SPI
.setBitOrder(MSBFIRST
);
43 SPI
.setDataMode(SPI_MODE0
);
44 SPI
.setClockDivider(SPI_CLOCK_DIV4
);
45 digitalWrite(csn_pin
,mode
);
48 /****************************************************************************/
50 void RF24::ce(int level
)
52 digitalWrite(ce_pin
,level
);
55 /****************************************************************************/
57 uint8_t RF24::read_register(uint8_t reg
, uint8_t* buf
, uint8_t len
)
62 status
= SPI
.transfer( R_REGISTER
| ( REGISTER_MASK
& reg
) );
64 *buf
++ = SPI
.transfer(0xff);
71 /****************************************************************************/
73 uint8_t RF24::read_register(uint8_t reg
)
76 SPI
.transfer( R_REGISTER
| ( REGISTER_MASK
& reg
) );
77 uint8_t result
= SPI
.transfer(0xff);
83 /****************************************************************************/
85 uint8_t RF24::write_register(uint8_t reg
, const uint8_t* buf
, uint8_t len
)
90 status
= SPI
.transfer( W_REGISTER
| ( REGISTER_MASK
& reg
) );
99 /****************************************************************************/
101 uint8_t RF24::write_register(uint8_t reg
, uint8_t value
)
105 IF_SERIAL_DEBUG(printf_P(PSTR("write_register(%02x,%02x)\n\r"),reg
,value
));
108 status
= SPI
.transfer( W_REGISTER
| ( REGISTER_MASK
& reg
) );
115 /****************************************************************************/
117 uint8_t RF24::write_payload(const void* buf
, uint8_t len
)
121 const uint8_t* current
= reinterpret_cast<const uint8_t*>(buf
);
123 uint8_t data_len
= min(len
,payload_size
);
124 uint8_t blank_len
= dynamic_payloads_enabled
? 0 : payload_size
- data_len
;
126 //printf("[Writing %u bytes %u blanks]",data_len,blank_len);
129 status
= SPI
.transfer( W_TX_PAYLOAD
);
131 SPI
.transfer(*current
++);
132 while ( blank_len
-- )
139 /****************************************************************************/
141 uint8_t RF24::read_payload(void* buf
, uint8_t len
)
144 uint8_t* current
= reinterpret_cast<uint8_t*>(buf
);
146 uint8_t data_len
= min(len
,payload_size
);
147 uint8_t blank_len
= dynamic_payloads_enabled
? 0 : payload_size
- data_len
;
149 //printf("[Reading %u bytes %u blanks]",data_len,blank_len);
152 status
= SPI
.transfer( R_RX_PAYLOAD
);
154 *current
++ = SPI
.transfer(0xff);
155 while ( blank_len
-- )
162 /****************************************************************************/
164 uint8_t RF24::flush_rx(void)
169 status
= SPI
.transfer( FLUSH_RX
);
175 /****************************************************************************/
177 uint8_t RF24::flush_tx(void)
182 status
= SPI
.transfer( FLUSH_TX
);
188 /****************************************************************************/
190 uint8_t RF24::get_status(void)
195 status
= SPI
.transfer( NOP
);
201 /****************************************************************************/
203 void RF24::print_status(uint8_t status
)
205 printf_P(PSTR("STATUS\t\t = 0x%02x RX_DR=%x TX_DS=%x MAX_RT=%x RX_P_NO=%x TX_FULL=%x\n\r"),
207 (status
& _BV(RX_DR
))?1:0,
208 (status
& _BV(TX_DS
))?1:0,
209 (status
& _BV(MAX_RT
))?1:0,
210 ((status
>> RX_P_NO
) & B111
),
211 (status
& _BV(TX_FULL
))?1:0
215 /****************************************************************************/
217 void RF24::print_observe_tx(uint8_t value
)
219 printf_P(PSTR("OBSERVE_TX=%02x: POLS_CNT=%x ARC_CNT=%x\n\r"),
221 (value
>> PLOS_CNT
) & B1111
,
222 (value
>> ARC_CNT
) & B1111
226 /****************************************************************************/
228 void RF24::print_byte_register(prog_char
* name
, uint8_t reg
, uint8_t qty
)
230 char extra_tab
= strlen_P(name
) < 8 ? '\t' : 0;
231 printf_P(PSTR("%S\t%c ="),name
,extra_tab
);
233 printf_P(PSTR(" 0x%02x"),read_register(reg
++));
234 printf_P(PSTR("\n\r"));
237 /****************************************************************************/
239 void RF24::print_address_register(prog_char
* name
, uint8_t reg
, uint8_t qty
)
241 char extra_tab
= strlen_P(name
) < 8 ? '\t' : 0;
242 printf_P(PSTR("%S\t%c ="),name
,extra_tab
);
247 read_register(reg
++,buffer
,sizeof buffer
);
249 printf_P(PSTR(" 0x"));
250 uint8_t* bufptr
= buffer
+ sizeof buffer
;
251 while( --bufptr
>= buffer
)
252 printf_P(PSTR("%02x"),*bufptr
);
255 printf_P(PSTR("\n\r"));
258 /****************************************************************************/
260 RF24::RF24(uint8_t _cepin
, uint8_t _cspin
):
261 ce_pin(_cepin
), csn_pin(_cspin
), wide_band(true), p_variant(false),
262 payload_size(32), ack_payload_available(false), dynamic_payloads_enabled(false),
263 pipe0_reading_address(0)
267 /****************************************************************************/
269 void RF24::setChannel(uint8_t channel
)
271 // TODO: This method could take advantage of the 'wide_band' calculation
272 // done in setChannel() to require certain channel spacing.
274 const uint8_t max_channel
= 127;
275 write_register(RF_CH
,min(channel
,max_channel
));
278 /****************************************************************************/
280 void RF24::setPayloadSize(uint8_t size
)
282 const uint8_t max_payload_size
= 32;
283 payload_size
= min(size
,max_payload_size
);
286 /****************************************************************************/
288 uint8_t RF24::getPayloadSize(void)
293 /****************************************************************************/
295 void RF24::printDetails(void)
297 print_status(get_status());
299 print_address_register(PSTR("RX_ADDR_P0-1"),RX_ADDR_P0
,2);
300 print_byte_register(PSTR("RX_ADDR_P2-5"),RX_ADDR_P2
,4);
301 print_address_register(PSTR("TX_ADDR"),TX_ADDR
);
303 print_byte_register(PSTR("RX_PW_P0-6"),RX_PW_P0
,6);
304 print_byte_register(PSTR("EN_AA"),EN_AA
);
305 print_byte_register(PSTR("EN_RXADDR"),EN_RXADDR
);
306 print_byte_register(PSTR("RF_CH"),RF_CH
);
307 print_byte_register(PSTR("RF_SETUP"),RF_SETUP
);
308 print_byte_register(PSTR("CONFIG"),CONFIG
);
309 print_byte_register(PSTR("DYNPD/FEATURE"),DYNPD
,2);
311 const char * rf24_datarate_e_str
[] = { "1MBPS", "2MBPS", "250KBPS" };
312 const char * rf24_model_e_str
[] = { "nRF24L01", "nRF24L01+" } ;
313 const char * rf24_crclength_e_str
[] = { "Disabled", "8 bits", "16 bits" } ;
314 const char * rf24_pa_dbm_e_str
[] = { "PA_MIN", "PA_LOW", "LA_MED", "PA_HIGH"} ;
316 printf_P(PSTR("Data Rate\t = %s\n\r"),rf24_datarate_e_str
[getDataRate()]);
317 printf_P(PSTR("Model\t\t = %s\n\r"),rf24_model_e_str
[isPVariant()]);
318 printf_P(PSTR("CRC Length\t = %s\n\r"),rf24_crclength_e_str
[getCRCLength()]);
319 printf_P(PSTR("PA Power\t = %s\n\r"),rf24_pa_dbm_e_str
[getPALevel()]);
322 /****************************************************************************/
324 void RF24::begin(void)
327 pinMode(ce_pin
,OUTPUT
);
328 pinMode(csn_pin
,OUTPUT
);
330 // Initialize SPI bus
336 // Must allow the radio time to settle else configuration bits will not necessarily stick.
337 // This is actually only required following power up but some settling time also appears to
338 // be required after resets too. For full coverage, we'll always assume the worst.
339 // Enabling 16b CRC is by far the most obvious case if the wrong timing is used - or skipped.
340 // Technically we require 4.5ms + 14us as a worst case. We'll just call it 5ms for good measure.
341 // WARNING: Delay is based on P-variant whereby non-P *may* require different timing.
344 // Set 1500uS (minimum for 32B payload in ESB@250KBPS) timeouts, to make testing a little easier
345 // WARNING: If this is ever lowered, either 250KBS mode with AA is broken or maximum packet
346 // sizes must never be used. See documentation for a more complete explanation.
347 write_register(SETUP_RETR
,(B0100
<< ARD
) | (B1111
<< ARC
));
349 // Restore our default PA level
350 setPALevel( RF24_PA_MAX
) ;
352 // Determine if this is a p or non-p RF24 module and then
353 // reset our data rate back to default value. This works
354 // because a non-P variant won't allow the data rate to
355 // be set to 250Kbps.
356 if( setDataRate( RF24_250KBPS
) )
361 // Then set the data rate to the slowest (and most reliable) speed supported by all
363 setDataRate( RF24_1MBPS
) ;
365 // Initialize CRC and request 2-byte (16bit) CRC
366 setCRCLength( RF24_CRC_16
) ;
368 // Disable dynamic payloads, to match dynamic_payloads_enabled setting
369 write_register(DYNPD
,0);
371 // Reset current status
372 // Notice reset and flush is the last thing we do
373 write_register(STATUS
,_BV(RX_DR
) | _BV(TX_DS
) | _BV(MAX_RT
) );
375 // Set up default configuration. Callers can always change it later.
376 // This channel should be universally safe and not bleed over into adjacent
385 /****************************************************************************/
387 void RF24::startListening(void)
389 write_register(CONFIG
, read_register(CONFIG
) | _BV(PWR_UP
) | _BV(PRIM_RX
));
390 write_register(STATUS
, _BV(RX_DR
) | _BV(TX_DS
) | _BV(MAX_RT
) );
392 // Restore the pipe0 adddress, if exists
393 if (pipe0_reading_address
)
394 write_register(RX_ADDR_P0
, reinterpret_cast<const uint8_t*>(&pipe0_reading_address
), 5);
403 // wait for the radio to come up (130us actually only needed)
404 delayMicroseconds(130);
407 /****************************************************************************/
409 void RF24::stopListening(void)
416 /****************************************************************************/
418 void RF24::powerDown(void)
420 write_register(CONFIG
,read_register(CONFIG
) & ~_BV(PWR_UP
));
423 /****************************************************************************/
425 void RF24::powerUp(void)
427 write_register(CONFIG
,read_register(CONFIG
) | _BV(PWR_UP
));
430 /******************************************************************/
432 bool RF24::write( const void* buf
, uint8_t len
)
440 // At this point we could return from a non-blocking write, and then call
441 // the rest after an interrupt
443 // Instead, we are going to block here until we get TX_DS (transmission completed and ack'd)
444 // or MAX_RT (maximum retries, transmission failed). Also, we'll timeout in case the radio
445 // is flaky and we get neither.
447 // IN the end, the send should be blocking. It comes back in 60ms worst case, or much faster
448 // if I tighted up the retry logic. (Default settings will be 1500us.
452 uint32_t sent_at
= millis();
453 const uint32_t timeout
= 500; //ms to wait for timeout
456 status
= read_register(OBSERVE_TX
,&observe_tx
,1);
457 IF_SERIAL_DEBUG(Serial
.print(observe_tx
,HEX
));
459 while( ! ( status
& ( _BV(TX_DS
) | _BV(MAX_RT
) ) ) && ( millis() - sent_at
< timeout
) );
461 // The part above is what you could recreate with your own interrupt handler,
462 // and then call this when you got an interrupt
465 // Call this when you get an interrupt
466 // The status tells us three things
467 // * The send was successful (TX_DS)
468 // * The send failed, too many retries (MAX_RT)
469 // * There is an ack packet waiting (RX_DR)
471 whatHappened(tx_ok
,tx_fail
,ack_payload_available
);
473 //printf("%u%u%u\n\r",tx_ok,tx_fail,ack_payload_available);
476 IF_SERIAL_DEBUG(Serial
.print(result
?"...OK.":"...Failed"));
478 // Handle the ack packet
479 if ( ack_payload_available
)
481 ack_payload_length
= getDynamicPayloadSize();
482 IF_SERIAL_DEBUG(Serial
.print("[AckPacket]/"));
483 IF_SERIAL_DEBUG(Serial
.println(ack_payload_length
,DEC
));
491 // Flush buffers (Is this a relic of past experimentation, and not needed anymore??)
496 /****************************************************************************/
498 void RF24::startWrite( const void* buf
, uint8_t len
)
500 // Transmitter power-up
501 write_register(CONFIG
, ( read_register(CONFIG
) | _BV(PWR_UP
) ) & ~_BV(PRIM_RX
) );
505 write_payload( buf
, len
);
509 delayMicroseconds(15);
514 /****************************************************************************/
516 uint8_t RF24::getDynamicPayloadSize(void)
521 SPI
.transfer( R_RX_PL_WID
);
522 result
= SPI
.transfer(0xff);
528 /****************************************************************************/
530 bool RF24::available(void)
532 return available(NULL
);
535 /****************************************************************************/
537 bool RF24::available(uint8_t* pipe_num
)
539 uint8_t status
= get_status();
541 // Too noisy, enable if you really want lots o data!!
542 //IF_SERIAL_DEBUG(print_status(status));
544 bool result
= ( status
& _BV(RX_DR
) );
548 // If the caller wants the pipe number, include that
550 *pipe_num
= ( status
>> RX_P_NO
) & B111
;
552 // Clear the status bit
554 // ??? Should this REALLY be cleared now? Or wait until we
555 // actually READ the payload?
557 write_register(STATUS
,_BV(RX_DR
) );
559 // Handle ack payload receipt
560 if ( status
& _BV(TX_DS
) )
562 write_register(STATUS
,_BV(TX_DS
));
569 /****************************************************************************/
571 bool RF24::read( void* buf
, uint8_t len
)
574 read_payload( buf
, len
);
576 // was this the last of the data available?
577 return read_register(FIFO_STATUS
) & _BV(RX_EMPTY
);
580 /****************************************************************************/
582 void RF24::whatHappened(bool& tx_ok
,bool& tx_fail
,bool& rx_ready
)
584 // Read the status & reset the status in one easy call
585 // Or is that such a good idea?
586 uint8_t status
= write_register(STATUS
,_BV(RX_DR
) | _BV(TX_DS
) | _BV(MAX_RT
) );
588 // Report to the user what happened
589 tx_ok
= status
& _BV(TX_DS
);
590 tx_fail
= status
& _BV(MAX_RT
);
591 rx_ready
= status
& _BV(RX_DR
);
594 /****************************************************************************/
596 void RF24::openWritingPipe(uint64_t value
)
598 // Note that AVR 8-bit uC's store this LSB first, and the NRF24L01(+)
599 // expects it LSB first too, so we're good.
601 write_register(RX_ADDR_P0
, reinterpret_cast<uint8_t*>(&value
), 5);
602 write_register(TX_ADDR
, reinterpret_cast<uint8_t*>(&value
), 5);
604 const uint8_t max_payload_size
= 32;
605 write_register(RX_PW_P0
,min(payload_size
,max_payload_size
));
608 /****************************************************************************/
610 void RF24::openReadingPipe(uint8_t child
, uint64_t address
)
612 const uint8_t child_pipe
[] =
614 RX_ADDR_P0
, RX_ADDR_P1
, RX_ADDR_P2
, RX_ADDR_P3
, RX_ADDR_P4
, RX_ADDR_P5
616 const uint8_t child_payload_size
[] =
618 RX_PW_P0
, RX_PW_P1
, RX_PW_P2
, RX_PW_P3
, RX_PW_P4
, RX_PW_P5
620 const uint8_t child_pipe_enable
[] =
622 ERX_P0
, ERX_P1
, ERX_P2
, ERX_P3
, ERX_P4
, ERX_P5
625 // If this is pipe 0, cache the address. This is needed because
626 // openWritingPipe() will overwrite the pipe 0 address, so
627 // startListening() will have to restore it.
629 pipe0_reading_address
= address
;
633 // For pipes 2-5, only write the LSB
635 write_register(child_pipe
[child
], reinterpret_cast<const uint8_t*>(&address
), 5);
637 write_register(child_pipe
[child
], reinterpret_cast<const uint8_t*>(&address
), 1);
639 write_register(child_payload_size
[child
],payload_size
);
641 // Note it would be more efficient to set all of the bits for all open
642 // pipes at once. However, I thought it would make the calling code
643 // more simple to do it this way.
644 write_register(EN_RXADDR
,read_register(EN_RXADDR
) | _BV(child_pipe_enable
[child
]));
648 /****************************************************************************/
650 void RF24::toggle_features(void)
653 SPI
.transfer( ACTIVATE
);
654 SPI
.transfer( 0x73 );
658 /****************************************************************************/
660 void RF24::enableDynamicPayloads(void)
662 // Enable dynamic payload throughout the system
663 write_register(FEATURE
,read_register(FEATURE
) | _BV(EN_DPL
) );
665 // If it didn't work, the features are not enabled
666 if ( ! read_register(FEATURE
) )
668 // So enable them and try again
670 write_register(FEATURE
,read_register(FEATURE
) | _BV(EN_DPL
) );
673 IF_SERIAL_DEBUG(printf("FEATURE=%i\n\r",read_register(FEATURE
)));
675 // Enable dynamic payload on all pipes
677 // Not sure the use case of only having dynamic payload on certain
678 // pipes, so the library does not support it.
679 write_register(DYNPD
,read_register(DYNPD
) | _BV(DPL_P5
) | _BV(DPL_P4
) | _BV(DPL_P3
) | _BV(DPL_P2
) | _BV(DPL_P1
) | _BV(DPL_P0
));
681 dynamic_payloads_enabled
= true;
684 /****************************************************************************/
686 void RF24::enableAckPayload(void)
689 // enable ack payload and dynamic payload features
692 write_register(FEATURE
,read_register(FEATURE
) | _BV(EN_ACK_PAY
) | _BV(EN_DPL
) );
694 // If it didn't work, the features are not enabled
695 if ( ! read_register(FEATURE
) )
697 // So enable them and try again
699 write_register(FEATURE
,read_register(FEATURE
) | _BV(EN_ACK_PAY
) | _BV(EN_DPL
) );
702 IF_SERIAL_DEBUG(printf("FEATURE=%i\n\r",read_register(FEATURE
)));
705 // Enable dynamic payload on pipes 0 & 1
708 write_register(DYNPD
,read_register(DYNPD
) | _BV(DPL_P1
) | _BV(DPL_P0
));
711 /****************************************************************************/
713 void RF24::writeAckPayload(uint8_t pipe
, const void* buf
, uint8_t len
)
715 const uint8_t* current
= reinterpret_cast<const uint8_t*>(buf
);
718 SPI
.transfer( W_ACK_PAYLOAD
| ( pipe
& B111
) );
719 const uint8_t max_payload_size
= 32;
720 uint8_t data_len
= min(len
,max_payload_size
);
722 SPI
.transfer(*current
++);
727 /****************************************************************************/
729 bool RF24::isAckPayloadAvailable(void)
731 bool result
= ack_payload_available
;
732 ack_payload_available
= false;
736 /****************************************************************************/
738 bool RF24::isPVariant(void)
743 /****************************************************************************/
745 void RF24::setAutoAck(bool enable
)
748 write_register(EN_AA
, B111111
);
750 write_register(EN_AA
, 0);
753 /****************************************************************************/
755 void RF24::setAutoAck( uint8_t pipe
, bool enable
)
759 uint8_t en_aa
= read_register( EN_AA
) ;
766 en_aa
&= ~_BV(pipe
) ;
768 write_register( EN_AA
, en_aa
) ;
772 /****************************************************************************/
774 bool RF24::testCarrier(void)
776 return ( read_register(CD
) & 1 );
779 /****************************************************************************/
781 bool RF24::testRPD(void)
783 return ( read_register(RPD
) & 1 ) ;
786 /****************************************************************************/
788 void RF24::setPALevel(rf24_pa_dbm_e level
)
790 uint8_t setup
= read_register(RF_SETUP
) ;
791 setup
&= ~(_BV(RF_PWR_LOW
) | _BV(RF_PWR_HIGH
)) ;
796 setup
|= (_BV(RF_PWR_LOW
) | _BV(RF_PWR_HIGH
)) ;
800 setup
|= _BV(RF_PWR_HIGH
) ;
804 setup
|= _BV(RF_PWR_LOW
) ;
811 // On error, go to maximum PA
812 setup
|= (_BV(RF_PWR_LOW
) | _BV(RF_PWR_HIGH
)) ;
816 write_register( RF_SETUP
, setup
) ;
819 /****************************************************************************/
821 rf24_pa_dbm_e
RF24::getPALevel(void)
823 rf24_pa_dbm_e result
= RF24_PA_ERROR
;
824 uint8_t power
= read_register(RF_SETUP
) & (_BV(RF_PWR_LOW
) | _BV(RF_PWR_HIGH
)) ;
828 case (_BV(RF_PWR_LOW
) | _BV(RF_PWR_HIGH
)):
829 result
= RF24_PA_MAX
;
832 case _BV(RF_PWR_HIGH
):
833 result
= RF24_PA_HIGH
;
836 case _BV(RF_PWR_LOW
):
837 result
= RF24_PA_LOW
;
841 result
= RF24_PA_MIN
;
848 /****************************************************************************/
850 bool RF24::setDataRate(rf24_datarate_e speed
)
853 uint8_t setup
= read_register(RF_SETUP
) ;
855 // HIGH and LOW '00' is 1Mbs - our default
857 setup
&= ~(_BV(RF_DR_LOW
) | _BV(RF_DR_HIGH
)) ;
858 if( speed
== RF24_250KBPS
)
860 // Must set the RF_DR_LOW to 1; RF_DR_HIGH (used to be RF_DR) is already 0
863 setup
|= _BV( RF_DR_LOW
) ;
867 // Set 2Mbs, RF_DR (RF_DR_HIGH) is set 1
869 if ( speed
== RF24_2MBPS
)
872 setup
|= _BV(RF_DR_HIGH
);
880 write_register(RF_SETUP
,setup
);
883 if ( read_register(RF_SETUP
) == setup
)
895 /****************************************************************************/
897 rf24_datarate_e
RF24::getDataRate( void )
899 rf24_datarate_e result
;
900 uint8_t setup
= read_register(RF_SETUP
) ;
902 // Order matters in our case below
903 switch( setup
& (_BV(RF_DR_LOW
) | _BV(RF_DR_HIGH
)) )
907 result
= RF24_250KBPS
;
910 case _BV(RF_DR_HIGH
):
912 result
= RF24_2MBPS
;
917 result
= RF24_1MBPS
;
924 /****************************************************************************/
926 void RF24::setCRCLength(rf24_crclength_e length
)
928 uint8_t config
= read_register(CONFIG
) & ~( _BV(CRCO
) | _BV(EN_CRC
)) ;
932 case RF24_CRC_DISABLED
:
936 config
|= _BV(EN_CRC
);
941 config
|= _BV(EN_CRC
);
942 config
|= _BV( CRCO
);
946 write_register( CONFIG
, config
) ;
949 /****************************************************************************/
951 rf24_crclength_e
RF24::getCRCLength(void)
953 rf24_crclength_e result
= RF24_CRC_DISABLED
;
954 uint8_t config
= read_register(CONFIG
) & ( _BV(CRCO
) | _BV(EN_CRC
)) ;
956 if ( config
& _BV(EN_CRC
) )
958 if ( config
& _BV(CRCO
) )
959 result
= RF24_CRC_16
;
967 /****************************************************************************/
969 void RF24::disableCRC( void )
971 uint8_t disable
= read_register(CONFIG
) & ~_BV(EN_CRC
) ;
972 write_register( CONFIG
, disable
) ;
975 /****************************************************************************/
976 void RF24::setRetries(uint8_t delay
, uint8_t count
)
978 write_register(SETUP_RETR
,(delay
&0xf)<<ARD
| (count
&0xf)<<ARC
);
981 // vim:ai:cin:sts=2 sw=2 ft=cpp