void nRFAPI_SetTxPower(unsigned char power) { if(power>3) power=3; nRFCMD_RegWriteStatusRead(RF_SETUP | WRITE_REG,NRF_RFOPTIONS | (power<<1)); }
void nRFAPI_SetFeatures(unsigned char features) { unsigned const char ACTIVATE_SEQUENCE[] = {ACTIVATE, 0x73}; unsigned char dummy_buffer[sizeof(ACTIVATE_SEQUENCE)] = {0,0}; nRFCMD_ReadWriteBuffer(ACTIVATE_SEQUENCE, dummy_buffer, sizeof(ACTIVATE_SEQUENCE)); nRFCMD_RegWriteStatusRead(FEATURE, features); }
void nRFAPI_TxRetries(unsigned char count) { if(count>15) count=15; // setup delay of 500us+86us nRFCMD_RegWriteStatusRead(SETUP_RETR | WRITE_REG,0x10 | count); }
unsigned char nRFAPI_SetSizeMac(unsigned char addr_size) { if(addr_size>=3 && addr_size<=5) addr_size-=2; else addr_size=0; nRFCMD_RegWriteStatusRead(SETUP_AW | WRITE_REG,addr_size); return addr_size; }
void nRFAPI_SetPipeSizeRX(unsigned char pipe,unsigned char size) { if(pipe<=5) nRFCMD_RegWriteStatusRead((RX_PW_P0 + pipe) | WRITE_REG,size); }
unsigned char nRFAPI_ClearIRQ(unsigned char status) { return nRFCMD_RegWriteStatusRead(STATUS | WRITE_REG, status & MASK_IRQ_FLAGS); }
void nRFAPI_SetChannel(unsigned char channel) { nRFCMD_RegWriteStatusRead(RF_CH | WRITE_REG,channel&0x7f); }
void nRFAPI_PipesAck(unsigned char mask) { nRFCMD_RegWriteStatusRead(EN_AA | WRITE_REG,mask & 0x3F); }
void nRFAPI_PipesEnable(unsigned char mask) { nRFCMD_RegWriteStatusRead(EN_RXADDR | WRITE_REG,mask & 0x3F); }
void nRFAPI_PipesAck (uint8_t mask) { nRFCMD_RegWriteStatusRead (EN_AA | WRITE_REG, mask & 0x3F); }
void nRFAPI_PowerDown (void) { /* power don nRF24L01 */ nRFCMD_RegWriteStatusRead (CONFIG | WRITE_REG, 0x00); }
void nRFAPI_SetRxMode (uint8_t receive) { nRFCMD_RegWriteStatusRead (CONFIG | WRITE_REG, receive ? 0x3B : 0x3A); }
void nRFAPI_SetPipeSizeRX (uint8_t pipe, uint8_t size) { if (pipe <= 5) nRFCMD_RegWriteStatusRead ((RX_PW_P0 + pipe) | WRITE_REG, size); }
uint8_t nRFAPI_ClearIRQ (uint8_t status) { return nRFCMD_RegWriteStatusRead (STATUS | WRITE_REG, status & MASK_IRQ_FLAGS); }
void nRFAPI_SetChannel (uint8_t channel) { nRFCMD_RegWriteStatusRead (RF_CH | WRITE_REG, channel & 0x7f); }
void nRFAPI_SetRxMode(unsigned char receive) { nRFCMD_RegWriteStatusRead(CONFIG | WRITE_REG,receive ? 0x3B : 0x3A); }
void nRFAPI_PipesEnable (uint8_t mask) { nRFCMD_RegWriteStatusRead (EN_RXADDR | WRITE_REG, mask & 0x3F); }