RF24: Minor power optimization (#1069)
This commit is contained in:
@@ -302,13 +302,14 @@ LOCAL bool RF24_sendMessage(const uint8_t recipient, const void *buf, const uint
|
|||||||
RF24_CMD_WRITE_TX_PAYLOAD, (uint8_t *)buf, len, false );
|
RF24_CMD_WRITE_TX_PAYLOAD, (uint8_t *)buf, len, false );
|
||||||
// go, TX starts after ~10us, CE high also enables PA+LNA on supported HW
|
// go, TX starts after ~10us, CE high also enables PA+LNA on supported HW
|
||||||
RF24_ce(HIGH);
|
RF24_ce(HIGH);
|
||||||
|
delayMicroseconds(10); // datasheet: Pulse CE at least 10us
|
||||||
|
RF24_ce(LOW);
|
||||||
// timeout counter to detect HW issues
|
// timeout counter to detect HW issues
|
||||||
uint16_t timeout = 0xFFFF;
|
uint16_t timeout = 0xFFFF;
|
||||||
do {
|
do {
|
||||||
RF24_status = RF24_getStatus();
|
RF24_status = RF24_getStatus();
|
||||||
} while (!(RF24_status & ( _BV(RF24_MAX_RT) | _BV(RF24_TX_DS) )) && timeout--);
|
} while (!(RF24_status & ( _BV(RF24_MAX_RT) | _BV(RF24_TX_DS) )) && timeout--);
|
||||||
// timeout value after successful TX on 16Mhz AVR ~ 65500, i.e. msg is transmitted after ~36 loop cycles
|
// timeout value after successful TX on 16Mhz AVR ~ 65500, i.e. msg is transmitted after ~36 loop cycles
|
||||||
RF24_ce(LOW);
|
|
||||||
// reset interrupts
|
// reset interrupts
|
||||||
RF24_setStatus(_BV(RF24_TX_DS) | _BV(RF24_MAX_RT) );
|
RF24_setStatus(_BV(RF24_TX_DS) | _BV(RF24_MAX_RT) );
|
||||||
// Max retries exceeded
|
// Max retries exceeded
|
||||||
|
|||||||
Reference in New Issue
Block a user