Esempio n. 1
0
extern void nRF24L01_interrupt () 
{
        // Read nRF24L01 status 
	uint8_t status;
        nRF24L01_CSN_lo;			// Pull down chip select
        status = spi_transmit_byte(NOP);	// Read status register
        nRF24L01_CSN_hi;			// Pull up chip select
	
	//based upon the status register decide what to do


	//if TX sucess
	if ( status & (1<<TX_DS) )
	{
		nRF24L01_powerdown();		// Return to low power state
	}
	//maximum retrys reached
	else if ( status & (1<<MAX_RT) )
	{
		//set some flag
		nRF24L01_powerdown();		// Return to low power state
	}
	//recieved a packet
	else if ( status & (1<<RX_DR) )
	{
		nRF24L01_get_data(buffer);
		nRF24L01_powerdown();
	}


        // Reset status register for further interaction
        nRF24L01_config_register(STATUS,( (1<<RX_DR) | (1<<TX_DS) | (1<<MAX_RT) ) ); // Reset status register

}
Esempio n. 2
0
/// \brief .
/// 
/// 
void radioRxDataAvailable(void)
{
	uint8_t rxData[32];
	uint8_t readLen;
	readLen = nRF24L01_get_data(rxData);
}