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
27 #if ! defined( NATIVE ) && defined( ARDUINO )
29 #define PROGMEM __attribute__(( section(".progmem.data") ))
31 #define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];}))
40 /****************************************************************************/
42 void RF24::csn(int mode
)
44 // Minimum ideal SPI bus speed is 2x data rate
45 // If we assume 2Mbs data rate and 16Mhz clock, a
46 // divider of 4 is the minimum we want.
47 // CLK:BUS 8Mhz:2Mhz, 16Mhz:4Mhz, or 20Mhz:5Mhz
49 SPI
.setBitOrder(MSBFIRST
);
50 SPI
.setDataMode(SPI_MODE0
);
51 SPI
.setClockDivider(SPI_CLOCK_DIV4
);
53 digitalWrite(csn_pin
,mode
);
56 /****************************************************************************/
58 void RF24::ce(int level
)
60 digitalWrite(ce_pin
,level
);
63 /****************************************************************************/
65 uint8_t RF24::read_register(uint8_t reg
, uint8_t* buf
, uint8_t len
)
70 status
= SPI
.transfer( R_REGISTER
| ( REGISTER_MASK
& reg
) );
72 *buf
++ = SPI
.transfer(0xff);
79 /****************************************************************************/
81 uint8_t RF24::read_register(uint8_t reg
)
84 SPI
.transfer( R_REGISTER
| ( REGISTER_MASK
& reg
) );
85 uint8_t result
= SPI
.transfer(0xff);
91 /****************************************************************************/
93 uint8_t RF24::write_register(uint8_t reg
, const uint8_t* buf
, uint8_t len
)
98 status
= SPI
.transfer( W_REGISTER
| ( REGISTER_MASK
& reg
) );
100 SPI
.transfer(*buf
++);
107 /****************************************************************************/
109 uint8_t RF24::write_register(uint8_t reg
, uint8_t value
)
113 IF_SERIAL_DEBUG(printf_P(PSTR("write_register(%02x,%02x)\r\n"),reg
,value
));
116 status
= SPI
.transfer( W_REGISTER
| ( REGISTER_MASK
& reg
) );
123 /****************************************************************************/
125 uint8_t RF24::write_payload(const void* buf
, uint8_t len
)
129 const uint8_t* current
= reinterpret_cast<const uint8_t*>(buf
);
131 uint8_t data_len
= min(len
,payload_size
);
132 uint8_t blank_len
= dynamic_payloads_enabled
? 0 : payload_size
- data_len
;
134 //printf("[Writing %u bytes %u blanks]",data_len,blank_len);
137 status
= SPI
.transfer( W_TX_PAYLOAD
);
139 SPI
.transfer(*current
++);
140 while ( blank_len
-- )
147 /****************************************************************************/
149 uint8_t RF24::read_payload(void* buf
, uint8_t len
)
152 uint8_t* current
= reinterpret_cast<uint8_t*>(buf
);
154 uint8_t data_len
= min(len
,payload_size
);
155 uint8_t blank_len
= dynamic_payloads_enabled
? 0 : payload_size
- data_len
;
157 //printf("[Reading %u bytes %u blanks]",data_len,blank_len);
160 status
= SPI
.transfer( R_RX_PAYLOAD
);
162 *current
++ = SPI
.transfer(0xff);
163 while ( blank_len
-- )
170 /****************************************************************************/
172 uint8_t RF24::flush_rx(void)
177 status
= SPI
.transfer( FLUSH_RX
);
183 /****************************************************************************/
185 uint8_t RF24::flush_tx(void)
190 status
= SPI
.transfer( FLUSH_TX
);
196 /****************************************************************************/
198 uint8_t RF24::get_status(void)
203 status
= SPI
.transfer( NOP
);
209 /****************************************************************************/
211 void RF24::print_status(uint8_t status
)
213 printf_P(PSTR("STATUS\t\t = 0x%02x RX_DR=%x TX_DS=%x MAX_RT=%x RX_P_NO=%x TX_FULL=%x\r\n"),
215 (status
& _BV(RX_DR
))?1:0,
216 (status
& _BV(TX_DS
))?1:0,
217 (status
& _BV(MAX_RT
))?1:0,
218 ((status
>> RX_P_NO
) & B111
),
219 (status
& _BV(TX_FULL
))?1:0
223 /****************************************************************************/
225 void RF24::print_observe_tx(uint8_t value
)
227 printf_P(PSTR("OBSERVE_TX=%02x: POLS_CNT=%x ARC_CNT=%x\r\n"),
229 (value
>> PLOS_CNT
) & B1111
,
230 (value
>> ARC_CNT
) & B1111
234 /****************************************************************************/
236 void RF24::print_byte_register(prog_char
* name
, uint8_t reg
, uint8_t qty
)
238 char extra_tab
= strlen_P(name
) < 8 ? '\t' : 0;
239 printf_P(PSTR(PRIPSTR
"\t%c ="),name
,extra_tab
);
241 printf_P(PSTR(" 0x%02x"),read_register(reg
++));
242 printf_P(PSTR("\r\n"));
245 /****************************************************************************/
247 void RF24::print_address_register(prog_char
* name
, uint8_t reg
, uint8_t qty
)
249 char extra_tab
= strlen_P(name
) < 8 ? '\t' : 0;
250 printf_P(PSTR(PRIPSTR
"\t%c ="),name
,extra_tab
);
255 read_register(reg
++,buffer
,sizeof buffer
);
257 printf_P(PSTR(" 0x"));
258 uint8_t* bufptr
= buffer
+ sizeof buffer
;
259 while( --bufptr
>= buffer
)
260 printf_P(PSTR("%02x"),*bufptr
);
263 printf_P(PSTR("\r\n"));
266 /****************************************************************************/
268 RF24::RF24(uint8_t _cepin
, uint8_t _cspin
):
269 ce_pin(_cepin
), csn_pin(_cspin
), wide_band(true), p_variant(false),
270 payload_size(32), ack_payload_available(false), dynamic_payloads_enabled(false),
271 pipe0_reading_address(0)
275 /****************************************************************************/
277 void RF24::setChannel(uint8_t channel
)
279 // TODO: This method could take advantage of the 'wide_band' calculation
280 // done in setChannel() to require certain channel spacing.
282 const uint8_t max_channel
= 127;
283 write_register(RF_CH
,min(channel
,max_channel
));
286 /****************************************************************************/
288 void RF24::setPayloadSize(uint8_t size
)
290 const uint8_t max_payload_size
= 32;
291 payload_size
= min(size
,max_payload_size
);
294 /****************************************************************************/
296 uint8_t RF24::getPayloadSize(void)
301 /****************************************************************************/
303 void RF24::printDetails(void)
305 print_status(get_status());
307 print_address_register(PSTR("RX_ADDR_P0-1"),RX_ADDR_P0
,2);
308 print_byte_register(PSTR("RX_ADDR_P2-5"),RX_ADDR_P2
,4);
309 print_address_register(PSTR("TX_ADDR"),TX_ADDR
);
311 print_byte_register(PSTR("RX_PW_P0-6"),RX_PW_P0
,6);
312 print_byte_register(PSTR("EN_AA"),EN_AA
);
313 print_byte_register(PSTR("EN_RXADDR"),EN_RXADDR
);
314 print_byte_register(PSTR("RF_CH"),RF_CH
);
315 print_byte_register(PSTR("RF_SETUP"),RF_SETUP
);
316 print_byte_register(PSTR("CONFIG"),CONFIG
);
317 print_byte_register(PSTR("DYNPD/FEATURE"),DYNPD
,2);
319 const char * rf24_datarate_e_str
[] = { "1MBPS", "2MBPS", "250KBPS" };
320 const char * rf24_model_e_str
[] = { "nRF24L01", "nRF24L01+" } ;
321 const char * rf24_crclength_e_str
[] = { "Disabled", "8 bits", "16 bits" } ;
322 const char * rf24_pa_dbm_e_str
[] = { "PA_MIN", "PA_LOW", "LA_MED", "PA_HIGH"} ;
324 printf_P(PSTR("Data Rate\t = %s\r\n"),rf24_datarate_e_str
[getDataRate()]);
325 printf_P(PSTR("Model\t\t = %s\r\n"),rf24_model_e_str
[isPVariant()]);
326 printf_P(PSTR("CRC Length\t = %s\r\n"),rf24_crclength_e_str
[getCRCLength()]);
327 printf_P(PSTR("PA Power\t = %s\r\n"),rf24_pa_dbm_e_str
[getPALevel()]);
330 /****************************************************************************/
332 void RF24::begin(void)
335 pinMode(ce_pin
,OUTPUT
);
336 pinMode(csn_pin
,OUTPUT
);
338 // Initialize SPI bus
344 // Must allow the radio time to settle else configuration bits will not necessarily stick.
345 // This is actually only required following power up but some settling time also appears to
346 // be required after resets too. For full coverage, we'll always assume the worst.
347 // Enabling 16b CRC is by far the most obvious case if the wrong timing is used - or skipped.
348 // Technically we require 4.5ms + 14us as a worst case. We'll just call it 5ms for good measure.
349 // WARNING: Delay is based on P-variant whereby non-P *may* require different timing.
352 // Set 1500uS (minimum for 32B payload in ESB@250KBPS) timeouts, to make testing a little easier
353 // WARNING: If this is ever lowered, either 250KBS mode with AA is broken or maximum packet
354 // sizes must never be used. See documentation for a more complete explanation.
355 write_register(SETUP_RETR
,(B0100
<< ARD
) | (B1111
<< ARC
));
357 // Restore our default PA level
358 setPALevel( RF24_PA_MAX
) ;
360 // Determine if this is a p or non-p RF24 module and then
361 // reset our data rate back to default value. This works
362 // because a non-P variant won't allow the data rate to
363 // be set to 250Kbps.
364 if( setDataRate( RF24_250KBPS
) )
369 // Then set the data rate to the slowest (and most reliable) speed supported by all
371 setDataRate( RF24_1MBPS
) ;
373 // Initialize CRC and request 2-byte (16bit) CRC
374 setCRCLength( RF24_CRC_16
) ;
376 // Disable dynamic payloads, to match dynamic_payloads_enabled setting
377 write_register(DYNPD
,0);
379 // Reset current status
380 // Notice reset and flush is the last thing we do
381 write_register(STATUS
,_BV(RX_DR
) | _BV(TX_DS
) | _BV(MAX_RT
) );
383 // Set up default configuration. Callers can always change it later.
384 // This channel should be universally safe and not bleed over into adjacent
393 /****************************************************************************/
395 void RF24::startListening(void)
397 write_register(CONFIG
, read_register(CONFIG
) | _BV(PWR_UP
) | _BV(PRIM_RX
));
398 write_register(STATUS
, _BV(RX_DR
) | _BV(TX_DS
) | _BV(MAX_RT
) );
400 // Restore the pipe0 adddress, if exists
401 if (pipe0_reading_address
)
402 write_register(RX_ADDR_P0
, reinterpret_cast<const uint8_t*>(&pipe0_reading_address
), 5);
411 // wait for the radio to come up (130us actually only needed)
412 delayMicroseconds(130);
415 /****************************************************************************/
417 void RF24::stopListening(void)
424 /****************************************************************************/
426 void RF24::powerDown(void)
428 write_register(CONFIG
,read_register(CONFIG
) & ~_BV(PWR_UP
));
431 /****************************************************************************/
433 void RF24::powerUp(void)
435 write_register(CONFIG
,read_register(CONFIG
) | _BV(PWR_UP
));
438 /******************************************************************/
440 bool RF24::write( const void* buf
, uint8_t len
)
448 // At this point we could return from a non-blocking write, and then call
449 // the rest after an interrupt
451 // Instead, we are going to block here until we get TX_DS (transmission completed and ack'd)
452 // or MAX_RT (maximum retries, transmission failed). Also, we'll timeout in case the radio
453 // is flaky and we get neither.
455 // IN the end, the send should be blocking. It comes back in 60ms worst case, or much faster
456 // if I tighted up the retry logic. (Default settings will be 1500us.
460 uint32_t sent_at
= millis();
461 const uint32_t timeout
= 500; //ms to wait for timeout
464 status
= read_register(OBSERVE_TX
,&observe_tx
,1);
465 IF_SERIAL_DEBUG(Serial
.print(observe_tx
,HEX
));
467 while( ! ( status
& ( _BV(TX_DS
) | _BV(MAX_RT
) ) ) && ( millis() - sent_at
< timeout
) );
469 // The part above is what you could recreate with your own interrupt handler,
470 // and then call this when you got an interrupt
473 // Call this when you get an interrupt
474 // The status tells us three things
475 // * The send was successful (TX_DS)
476 // * The send failed, too many retries (MAX_RT)
477 // * There is an ack packet waiting (RX_DR)
479 whatHappened(tx_ok
,tx_fail
,ack_payload_available
);
481 //printf("%u%u%u\r\n",tx_ok,tx_fail,ack_payload_available);
484 IF_SERIAL_DEBUG(Serial
.print(result
?"...OK.":"...Failed"));
486 // Handle the ack packet
487 if ( ack_payload_available
)
489 ack_payload_length
= getDynamicPayloadSize();
490 IF_SERIAL_DEBUG(Serial
.print("[AckPacket]/"));
491 IF_SERIAL_DEBUG(Serial
.println(ack_payload_length
,DEC
));
499 // Flush buffers (Is this a relic of past experimentation, and not needed anymore??)
504 /****************************************************************************/
506 void RF24::startWrite( const void* buf
, uint8_t len
)
508 // Transmitter power-up
509 write_register(CONFIG
, ( read_register(CONFIG
) | _BV(PWR_UP
) ) & ~_BV(PRIM_RX
) );
513 write_payload( buf
, len
);
517 delayMicroseconds(15);
522 /****************************************************************************/
524 uint8_t RF24::getDynamicPayloadSize(void)
529 SPI
.transfer( R_RX_PL_WID
);
530 result
= SPI
.transfer(0xff);
536 /****************************************************************************/
538 bool RF24::available(void)
540 return available(NULL
);
543 /****************************************************************************/
545 bool RF24::available(uint8_t* pipe_num
)
547 uint8_t status
= get_status();
549 // Too noisy, enable if you really want lots o data!!
550 //IF_SERIAL_DEBUG(print_status(status));
552 bool result
= ( status
& _BV(RX_DR
) );
556 // If the caller wants the pipe number, include that
558 *pipe_num
= ( status
>> RX_P_NO
) & B111
;
560 // Clear the status bit
562 // ??? Should this REALLY be cleared now? Or wait until we
563 // actually READ the payload?
565 write_register(STATUS
,_BV(RX_DR
) );
567 // Handle ack payload receipt
568 if ( status
& _BV(TX_DS
) )
570 write_register(STATUS
,_BV(TX_DS
));
577 /****************************************************************************/
579 bool RF24::read( void* buf
, uint8_t len
)
582 read_payload( buf
, len
);
584 // was this the last of the data available?
585 return read_register(FIFO_STATUS
) & _BV(RX_EMPTY
);
588 /****************************************************************************/
590 void RF24::whatHappened(bool& tx_ok
,bool& tx_fail
,bool& rx_ready
)
592 // Read the status & reset the status in one easy call
593 // Or is that such a good idea?
594 uint8_t status
= write_register(STATUS
,_BV(RX_DR
) | _BV(TX_DS
) | _BV(MAX_RT
) );
596 // Report to the user what happened
597 tx_ok
= status
& _BV(TX_DS
);
598 tx_fail
= status
& _BV(MAX_RT
);
599 rx_ready
= status
& _BV(RX_DR
);
602 /****************************************************************************/
604 void RF24::openWritingPipe(uint64_t value
)
606 // Note that AVR 8-bit uC's store this LSB first, and the NRF24L01(+)
607 // expects it LSB first too, so we're good.
609 write_register(RX_ADDR_P0
, reinterpret_cast<uint8_t*>(&value
), 5);
610 write_register(TX_ADDR
, reinterpret_cast<uint8_t*>(&value
), 5);
612 const uint8_t max_payload_size
= 32;
613 write_register(RX_PW_P0
,min(payload_size
,max_payload_size
));
616 /****************************************************************************/
618 void RF24::openReadingPipe(uint8_t child
, uint64_t address
)
620 const uint8_t child_pipe
[] =
622 RX_ADDR_P0
, RX_ADDR_P1
, RX_ADDR_P2
, RX_ADDR_P3
, RX_ADDR_P4
, RX_ADDR_P5
624 const uint8_t child_payload_size
[] =
626 RX_PW_P0
, RX_PW_P1
, RX_PW_P2
, RX_PW_P3
, RX_PW_P4
, RX_PW_P5
628 const uint8_t child_pipe_enable
[] =
630 ERX_P0
, ERX_P1
, ERX_P2
, ERX_P3
, ERX_P4
, ERX_P5
633 // If this is pipe 0, cache the address. This is needed because
634 // openWritingPipe() will overwrite the pipe 0 address, so
635 // startListening() will have to restore it.
637 pipe0_reading_address
= address
;
641 // For pipes 2-5, only write the LSB
643 write_register(child_pipe
[child
], reinterpret_cast<const uint8_t*>(&address
), 5);
645 write_register(child_pipe
[child
], reinterpret_cast<const uint8_t*>(&address
), 1);
647 write_register(child_payload_size
[child
],payload_size
);
649 // Note it would be more efficient to set all of the bits for all open
650 // pipes at once. However, I thought it would make the calling code
651 // more simple to do it this way.
652 write_register(EN_RXADDR
,read_register(EN_RXADDR
) | _BV(child_pipe_enable
[child
]));
656 /****************************************************************************/
658 void RF24::toggle_features(void)
661 SPI
.transfer( ACTIVATE
);
662 SPI
.transfer( 0x73 );
666 /****************************************************************************/
668 void RF24::enableDynamicPayloads(void)
670 // Enable dynamic payload throughout the system
671 write_register(FEATURE
,read_register(FEATURE
) | _BV(EN_DPL
) );
673 // If it didn't work, the features are not enabled
674 if ( ! read_register(FEATURE
) )
676 // So enable them and try again
678 write_register(FEATURE
,read_register(FEATURE
) | _BV(EN_DPL
) );
681 IF_SERIAL_DEBUG(printf("FEATURE=%i\r\n",read_register(FEATURE
)));
683 // Enable dynamic payload on all pipes
685 // Not sure the use case of only having dynamic payload on certain
686 // pipes, so the library does not support it.
687 write_register(DYNPD
,read_register(DYNPD
) | _BV(DPL_P5
) | _BV(DPL_P4
) | _BV(DPL_P3
) | _BV(DPL_P2
) | _BV(DPL_P1
) | _BV(DPL_P0
));
689 dynamic_payloads_enabled
= true;
692 /****************************************************************************/
694 void RF24::enableAckPayload(void)
697 // enable ack payload and dynamic payload features
700 write_register(FEATURE
,read_register(FEATURE
) | _BV(EN_ACK_PAY
) | _BV(EN_DPL
) );
702 // If it didn't work, the features are not enabled
703 if ( ! read_register(FEATURE
) )
705 // So enable them and try again
707 write_register(FEATURE
,read_register(FEATURE
) | _BV(EN_ACK_PAY
) | _BV(EN_DPL
) );
710 IF_SERIAL_DEBUG(printf("FEATURE=%i\r\n",read_register(FEATURE
)));
713 // Enable dynamic payload on pipes 0 & 1
716 write_register(DYNPD
,read_register(DYNPD
) | _BV(DPL_P1
) | _BV(DPL_P0
));
719 /****************************************************************************/
721 void RF24::writeAckPayload(uint8_t pipe
, const void* buf
, uint8_t len
)
723 const uint8_t* current
= reinterpret_cast<const uint8_t*>(buf
);
726 SPI
.transfer( W_ACK_PAYLOAD
| ( pipe
& B111
) );
727 const uint8_t max_payload_size
= 32;
728 uint8_t data_len
= min(len
,max_payload_size
);
730 SPI
.transfer(*current
++);
735 /****************************************************************************/
737 bool RF24::isAckPayloadAvailable(void)
739 bool result
= ack_payload_available
;
740 ack_payload_available
= false;
744 /****************************************************************************/
746 bool RF24::isPVariant(void)
751 /****************************************************************************/
753 void RF24::setAutoAck(bool enable
)
756 write_register(EN_AA
, B111111
);
758 write_register(EN_AA
, 0);
761 /****************************************************************************/
763 void RF24::setAutoAck( uint8_t pipe
, bool enable
)
767 uint8_t en_aa
= read_register( EN_AA
) ;
774 en_aa
&= ~_BV(pipe
) ;
776 write_register( EN_AA
, en_aa
) ;
780 /****************************************************************************/
782 bool RF24::testCarrier(void)
784 return ( read_register(CD
) & 1 );
787 /****************************************************************************/
789 bool RF24::testRPD(void)
791 return ( read_register(RPD
) & 1 ) ;
794 /****************************************************************************/
796 void RF24::setPALevel(rf24_pa_dbm_e level
)
798 uint8_t setup
= read_register(RF_SETUP
) ;
799 setup
&= ~(_BV(RF_PWR_LOW
) | _BV(RF_PWR_HIGH
)) ;
804 setup
|= (_BV(RF_PWR_LOW
) | _BV(RF_PWR_HIGH
)) ;
808 setup
|= _BV(RF_PWR_HIGH
) ;
812 setup
|= _BV(RF_PWR_LOW
) ;
819 // On error, go to maximum PA
820 setup
|= (_BV(RF_PWR_LOW
) | _BV(RF_PWR_HIGH
)) ;
824 write_register( RF_SETUP
, setup
) ;
827 /****************************************************************************/
829 rf24_pa_dbm_e
RF24::getPALevel(void)
831 rf24_pa_dbm_e result
= RF24_PA_ERROR
;
832 uint8_t power
= read_register(RF_SETUP
) & (_BV(RF_PWR_LOW
) | _BV(RF_PWR_HIGH
)) ;
836 case (_BV(RF_PWR_LOW
) | _BV(RF_PWR_HIGH
)):
837 result
= RF24_PA_MAX
;
840 case _BV(RF_PWR_HIGH
):
841 result
= RF24_PA_HIGH
;
844 case _BV(RF_PWR_LOW
):
845 result
= RF24_PA_LOW
;
849 result
= RF24_PA_MIN
;
856 /****************************************************************************/
858 bool RF24::setDataRate(rf24_datarate_e speed
)
861 uint8_t setup
= read_register(RF_SETUP
) ;
863 // HIGH and LOW '00' is 1Mbs - our default
865 setup
&= ~(_BV(RF_DR_LOW
) | _BV(RF_DR_HIGH
)) ;
866 if( speed
== RF24_250KBPS
)
868 // Must set the RF_DR_LOW to 1; RF_DR_HIGH (used to be RF_DR) is already 0
871 setup
|= _BV( RF_DR_LOW
) ;
875 // Set 2Mbs, RF_DR (RF_DR_HIGH) is set 1
877 if ( speed
== RF24_2MBPS
)
880 setup
|= _BV(RF_DR_HIGH
);
888 write_register(RF_SETUP
,setup
);
891 if ( read_register(RF_SETUP
) == setup
)
903 /****************************************************************************/
905 rf24_datarate_e
RF24::getDataRate( void )
907 rf24_datarate_e result
;
908 uint8_t setup
= read_register(RF_SETUP
) ;
910 // Order matters in our case below
911 switch( setup
& (_BV(RF_DR_LOW
) | _BV(RF_DR_HIGH
)) )
915 result
= RF24_250KBPS
;
918 case _BV(RF_DR_HIGH
):
920 result
= RF24_2MBPS
;
925 result
= RF24_1MBPS
;
932 /****************************************************************************/
934 void RF24::setCRCLength(rf24_crclength_e length
)
936 uint8_t config
= read_register(CONFIG
) & ~( _BV(CRCO
) | _BV(EN_CRC
)) ;
940 case RF24_CRC_DISABLED
:
944 config
|= _BV(EN_CRC
);
949 config
|= _BV(EN_CRC
);
950 config
|= _BV( CRCO
);
954 write_register( CONFIG
, config
) ;
957 /****************************************************************************/
959 rf24_crclength_e
RF24::getCRCLength(void)
961 rf24_crclength_e result
= RF24_CRC_DISABLED
;
962 uint8_t config
= read_register(CONFIG
) & ( _BV(CRCO
) | _BV(EN_CRC
)) ;
964 if ( config
& _BV(EN_CRC
) )
966 if ( config
& _BV(CRCO
) )
967 result
= RF24_CRC_16
;
975 /****************************************************************************/
977 void RF24::disableCRC( void )
979 uint8_t disable
= read_register(CONFIG
) & ~_BV(EN_CRC
) ;
980 write_register( CONFIG
, disable
) ;
983 /****************************************************************************/
984 void RF24::setRetries(uint8_t delay
, uint8_t count
)
986 write_register(SETUP_RETR
,(delay
&0xf)<<ARD
| (count
&0xf)<<ARC
);
989 // vim:ai:cin:sts=2 sw=2 ft=cpp