Пример #1
0
void Nrf24l::config() 
// Sets the important registers in the MiRF module and powers the module
// in receiving mode
// NB: channel and payload must be set now.
{
	// Set RF channel
	configRegister(RF_CH,channel);

	// Set length of incoming payload 
	configRegister(RX_PW_P0, payload);
	configRegister(RX_PW_P1, payload);

	// Start receiver 
	powerUpRx();
	flushRx();
}
Пример #2
0
bool Nrf24l::isSending() {
	uint8_t status;
	if(PTX){
		status = getStatus();
	    	
		/*
		 *  if sending successful (TX_DS) or max retries exceded (MAX_RT).
		 */

		if((status & ((1 << TX_DS)  | (1 << MAX_RT)))){
			powerUpRx();
			return false; 
		}

		return true;
	}
	return false;
}
Пример #3
0
void config_rf(){
	// Sets the important registers in the MiRF module and powers the module
	// in receiving mode
	// NB: channel and payload must be set now.

	/* set tranceiver address */
	setRADDR((uint8_t*)"robot");

	//uint8_t result = 0x07;
	uint8_t result = 0x27;
	writeRegister(RF_SETUP,&result,1);//1mbps

	// Set RF channel
	writeRegister(RF_CH,&channel,1);

	// Set length of incoming payload
	writeRegister(RX_PW_P0, &payload,1);
	writeRegister(RX_PW_P1, &payload,1);

	// Start receiver
	powerUpRx();
	flushRx();
}