mirror of
				https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
				synced 2025-10-31 19:41:04 +00:00 
			
		
		
		
	NRF init changed to most likely default
This commit is contained in:
		
							parent
							
								
									b41dccef67
								
							
						
					
					
						commit
						d66bf1a5b3
					
				| @ -36,16 +36,11 @@ enum { | ||||
| void ASSAN_RF_init() | ||||
| { | ||||
|     NRF24L01_Initialize(); | ||||
| 	//Specifics to ASSAN
 | ||||
|     NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x02);			// 4 bytes rx/tx address
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, (uint8_t *)"\x80\x80\x80\xB8", ASSAN_ADDRESS_LENGTH);		// Bind address
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR,    (uint8_t *)"\x80\x80\x80\xB8", ASSAN_ADDRESS_LENGTH);	// Bind address
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, (uint8_t *)"\x80\x80\x80\xB8", ASSAN_ADDRESS_LENGTH);	// Bind address
 | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
|     NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);			// Clear data ready, data sent, and retransmit
 | ||||
|     NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);				// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);			// Enable data pipe 0 only
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, ASSAN_PACKET_SIZE); | ||||
|     NRF24L01_SetPower(); | ||||
| } | ||||
| 
 | ||||
| void ASSAN_send_packet() | ||||
|  | ||||
| @ -60,19 +60,8 @@ enum { | ||||
| static void __attribute__((unused)) BUGSMINI_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  // Enable data pipe 0 only
 | ||||
| 
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, BUGSMINI_RX_PAYLOAD_SIZE); // bytes of data payload for rx pipe 1
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_06_RF_SETUP, 0x07); | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M); | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);                          // Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);       // Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x00);     // Set feature bits on
 | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) BUGSMINI_check_arming() | ||||
| @ -95,7 +84,7 @@ static void __attribute__((unused)) BUGSMINI_check_arming() | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) BUGSMINI_send_packet(uint8_t bind) | ||||
| static void __attribute__((unused)) BUGSMINI_send_packet() | ||||
| { | ||||
| 	BUGSMINI_check_arming();  // sets globals arm_flags and armed
 | ||||
| 
 | ||||
| @ -107,7 +96,7 @@ static void __attribute__((unused)) BUGSMINI_send_packet(uint8_t bind) | ||||
| 	packet[1] = BUGSMINI_txid[0]; | ||||
| 	packet[2] = BUGSMINI_txid[1]; | ||||
| 	packet[3] = BUGSMINI_txid[2]; | ||||
| 	if(bind) | ||||
| 	if(IS_BIND_IN_PROGRESS) | ||||
| 	{ | ||||
| 		packet[4] = 0x00; | ||||
| 		packet[5] = 0x7d; | ||||
| @ -159,7 +148,7 @@ static void __attribute__((unused)) BUGSMINI_send_packet(uint8_t bind) | ||||
| 		hopping_frequency_no++; | ||||
| 		if(hopping_frequency_no >= BUGSMINI_NUM_RF_CHANNELS) | ||||
| 			hopping_frequency_no = 0; | ||||
| 		NRF24L01_WriteReg(NRF24L01_05_RF_CH, bind ? hopping_frequency[hopping_frequency_no+BUGSMINI_NUM_RF_CHANNELS] : hopping_frequency[hopping_frequency_no]); | ||||
| 		NRF24L01_WriteReg(NRF24L01_05_RF_CH, IS_BIND_IN_PROGRESS ? hopping_frequency[hopping_frequency_no+BUGSMINI_NUM_RF_CHANNELS] : hopping_frequency[hopping_frequency_no]); | ||||
| 	} | ||||
| 
 | ||||
| 	// Power on, TX mode, 2byte CRC
 | ||||
| @ -286,7 +275,7 @@ uint16_t BUGSMINI_callback() | ||||
| 			} | ||||
| 			NRF24L01_SetTxRxMode(TXRX_OFF); | ||||
| 			NRF24L01_SetTxRxMode(TX_EN); | ||||
| 			BUGSMINI_send_packet(1); | ||||
| 			BUGSMINI_send_packet(); | ||||
| 			phase = BUGSMINI_BIND2; | ||||
| 			return BUGSMINI_WRITE_WAIT; | ||||
| 		case BUGSMINI_BIND2: | ||||
| @ -309,7 +298,7 @@ uint16_t BUGSMINI_callback() | ||||
| 			} | ||||
| 			NRF24L01_SetTxRxMode(TXRX_OFF); | ||||
| 			NRF24L01_SetTxRxMode(TX_EN); | ||||
| 			BUGSMINI_send_packet(0); | ||||
| 			BUGSMINI_send_packet(); | ||||
| 			phase = BUGSMINI_DATA2; | ||||
| 			return BUGSMINI_WRITE_WAIT; | ||||
| 		case BUGSMINI_DATA2: | ||||
|  | ||||
| @ -33,18 +33,8 @@ static void __attribute__((unused)) Bayang_Rx_init_nrf24l01() | ||||
| 	NRF24L01_Initialize(); | ||||
| 	XN297_SetTXAddr(bind_address, BAYANG_RX_ADDRESS_LENGTH); | ||||
| 	XN297_SetRXAddr(bind_address, BAYANG_RX_ADDRESS_LENGTH); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     	// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      	// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  	// Enable data pipe 0 only
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, BAYANG_RX_PACKET_SIZE + 2); // 2 extra bytes for xn297 crc
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, BAYANG_RX_RF_BIND_CHANNEL); | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);             	// 1Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);							// Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);			// Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01); | ||||
| 	NRF24L01_Activate(0x73); | ||||
| 	NRF24L01_SetTxRxMode(TXRX_OFF); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_SetTxRxMode(RX_EN); | ||||
|  | ||||
| @ -249,23 +249,9 @@ static void __attribute__((unused)) BAYANG_check_rx(void) | ||||
| static void __attribute__((unused)) BAYANG_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	XN297_SetTXAddr((uint8_t *)"\x00\x00\x00\x00\x00", BAYANG_ADDRESS_LENGTH); | ||||
| 
 | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     	// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      	// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  	// Enable data pipe 0 only
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, BAYANG_PACKET_SIZE); | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);             	// 1Mbps
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00);	// No retransmits
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);							// Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);			// Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01); | ||||
| 	NRF24L01_Activate(0x73); | ||||
| 	 | ||||
| 	switch (sub_protocol) | ||||
| 	{ | ||||
|  | ||||
| @ -255,7 +255,7 @@ static void __attribute__((unused)) CABELL_send_packet(uint8_t bindMode) | ||||
| 	*p |= (packet_count++)<<7;   // This causes the 8th bit of the first byte to toggle with each xmit so consecutive payloads are not identical.
 | ||||
| 	// This is a work around for a reported bug in clone NRF24L01 chips that mis-took this case for a re-transmit of the same packet.
 | ||||
| 
 | ||||
| 	CABELL_SetPower(); | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_WritePayload((uint8_t*)&TxPacket, packetSize); | ||||
| 
 | ||||
| 	#if defined CABELL_HUB_TELEMETRY  | ||||
| @ -359,45 +359,15 @@ static void __attribute__((unused)) CABELL_setAddress() | ||||
| static void __attribute__((unused)) CABELL_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	CABELL_SetPower(); | ||||
| 
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_250K);				// slower data rate gives better range/reliability
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);			// No Auto Acknowledgment on all data pipes  
 | ||||
| 	NRF24L01_SetTxRxMode(TX_EN);						//Power up and 16 bit CRC
 | ||||
| 
 | ||||
| 	CABELL_setAddress(); | ||||
| 
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01); | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, 0x20);		// 32 byte packet length
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_12_RX_PW_P1, 0x20);		// 32 byte packet length
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03); | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x5F);	// no retransmits
 | ||||
| 	NRF24L01_Activate(0x73);							// Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x3F);			// Enable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x04);		// Enable dynamic Payload Length
 | ||||
| 	NRF24L01_Activate(0x73); | ||||
| 	prev_power = NRF_POWER_0; | ||||
| } | ||||
| 
 | ||||
| //-----------------------------------------------------------------------------------------
 | ||||
| static void CABELL_SetPower()    // This over-ride the standard Set Power to allow an flag in option to indicate max power setting
 | ||||
|                           // Note that on many modules max power may actually be worse than the normal high power setting
 | ||||
|                           // test and only use max if it helps the range
 | ||||
| { | ||||
| 	if(IS_BIND_DONE && !IS_RANGE_FLAG_on && ((option & CABELL_OPTION_MASK_MAX_POWER_OVERRIDE) != 0)) | ||||
| 	{   // If we are not in range or bind mode and power setting override is in effect, then set max power, else standard power logic
 | ||||
| 		if(prev_power != NRF_POWER_3)   // prev_power is global variable for NRF24L01; NRF_POWER_3 is max power
 | ||||
| 		{ | ||||
| 			uint8_t rf_setup = NRF24L01_ReadReg(NRF24L01_06_RF_SETUP); | ||||
| 			rf_setup = (rf_setup & 0xF9) | (NRF_POWER_3 << 1); | ||||
| 			NRF24L01_WriteReg(NRF24L01_06_RF_SETUP, rf_setup); | ||||
| 			prev_power=NRF_POWER_3; | ||||
| 		}     | ||||
| 	} | ||||
| 	else | ||||
| 		NRF24L01_SetPower(); | ||||
| } | ||||
| 
 | ||||
| //-----------------------------------------------------------------------------------------
 | ||||
|  | ||||
| @ -649,29 +649,20 @@ static void CFLIE_RF_init() | ||||
|     NRF24L01_Initialize(); | ||||
| 
 | ||||
|     // CRC, radio on
 | ||||
|     NRF24L01_SetTxRxMode(TX_EN); | ||||
|     NRF24L01_WriteReg(NRF24L01_00_CONFIG, _BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP));  | ||||
|     NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x01);              // Auto Acknowledgement for data pipe 0
 | ||||
|     NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);          // Enable data pipe 0
 | ||||
|     NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, TX_ADDR_SIZE-2); // 5-byte RX/TX address
 | ||||
|     NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x13);         // 3 retransmits, 500us delay
 | ||||
| 
 | ||||
|     NRF24L01_WriteReg(NRF24L01_05_RF_CH, rf_ch_num);        // Defined in initialize_rx_tx_addr
 | ||||
|     NRF24L01_SetBitrate(data_rate);                          // Defined in initialize_rx_tx_addr
 | ||||
| 
 | ||||
|     NRF24L01_SetPower(); | ||||
|     NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);             // Clear data ready, data sent, and retransmit
 | ||||
| 
 | ||||
|     NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, rx_tx_addr, TX_ADDR_SIZE); | ||||
|     NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, rx_tx_addr, TX_ADDR_SIZE); | ||||
| 
 | ||||
|     // this sequence necessary for module from stock tx
 | ||||
|     NRF24L01_ReadReg(NRF24L01_1D_FEATURE); | ||||
|     NRF24L01_Activate(0x73);                          // Activate feature register
 | ||||
|     NRF24L01_ReadReg(NRF24L01_1D_FEATURE); | ||||
| 
 | ||||
|     NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x01);       // Enable Dynamic Payload Length on pipe 0
 | ||||
|     NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x06);     // Enable Dynamic Payload Length, enable Payload with ACK
 | ||||
| 	NRF24L01_Activate(0x73); | ||||
| } | ||||
| 
 | ||||
| // TODO: Fix telemetry
 | ||||
|  | ||||
| @ -49,7 +49,7 @@ enum YD829_FLAGS { | ||||
|     YD829_FLAG_STILL    = 0x80, | ||||
| }; | ||||
| 
 | ||||
| static void __attribute__((unused)) CG023_send_packet(uint8_t bind) | ||||
| static void __attribute__((unused)) CG023_send_packet() | ||||
| { | ||||
| 	// throttle : 0x00 - 0xFF
 | ||||
| 	throttle=convert_channel_8b(THROTTLE); | ||||
| @ -62,7 +62,7 @@ static void __attribute__((unused)) CG023_send_packet(uint8_t bind) | ||||
| 	// aileron : 0x43 - 0x7F - 0xBB
 | ||||
| 	aileron = convert_channel_16b_limit(AILERON, 0x43, 0xBB);  | ||||
| 	 | ||||
| 	if (bind) | ||||
| 	if (IS_BIND_IN_PROGRESS) | ||||
| 		packet[0]= 0xaa; | ||||
| 	else | ||||
| 		packet[0]= 0x55; | ||||
| @ -106,7 +106,7 @@ static void __attribute__((unused)) CG023_send_packet(uint8_t bind) | ||||
| 	// Power on, TX mode, 2byte CRC
 | ||||
| 	// Why CRC0? xn297 does not interpret it - either 16-bit CRC or nothing
 | ||||
| 	XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP)); | ||||
| 	if (bind) | ||||
| 	if (IS_BIND_IN_PROGRESS) | ||||
| 		NRF24L01_WriteReg(NRF24L01_05_RF_CH, CG023_RF_BIND_CHANNEL); | ||||
| 	else | ||||
| 		NRF24L01_WriteReg(NRF24L01_05_RF_CH, hopping_frequency_no); | ||||
| @ -121,18 +121,9 @@ static void __attribute__((unused)) CG023_send_packet(uint8_t bind) | ||||
| 
 | ||||
| static void __attribute__((unused)) CG023_RF_init() | ||||
| { | ||||
|     NRF24L01_Initialize(); | ||||
|     NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	XN297_SetTXAddr((uint8_t *)"\x26\xA8\x67\x35\xCC", 5); | ||||
| 	NRF24L01_Initialize(); | ||||
| 
 | ||||
|     NRF24L01_FlushTx(); | ||||
|     NRF24L01_FlushRx(); | ||||
|     NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
|     NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknowldgement on all data pipes
 | ||||
|     NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  // Enable data pipe 0 only
 | ||||
|     NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00); // no retransmits
 | ||||
|     NRF24L01_SetBitrate(NRF24L01_BR_1M);             // 1Mbps
 | ||||
|     NRF24L01_SetPower(); | ||||
| 	XN297_SetTXAddr((uint8_t *)"\x26\xA8\x67\x35\xCC", 5); | ||||
| } | ||||
| 
 | ||||
| uint16_t CG023_callback() | ||||
| @ -142,18 +133,15 @@ uint16_t CG023_callback() | ||||
| 		#ifdef MULTI_SYNC | ||||
| 			telemetry_set_input_sync(packet_period); | ||||
| 		#endif | ||||
| 		CG023_send_packet(0); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		if (bind_counter == 0) | ||||
| 			BIND_DONE; | ||||
| 		else | ||||
| 		{ | ||||
| 			CG023_send_packet(1); | ||||
| 			bind_counter--; | ||||
| 		} | ||||
| 	} | ||||
| 	CG023_send_packet(); | ||||
| 	return	packet_period; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -172,18 +172,11 @@ static void __attribute__((unused)) CX10_Write_Packet(uint8_t bind) | ||||
| static void __attribute__((unused)) CX10_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	XN297_SetTXAddr((uint8_t *)"\xcc\xcc\xcc\xcc\xcc",5); | ||||
| 	XN297_SetRXAddr((uint8_t *)"\xcc\xcc\xcc\xcc\xcc",5); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);			// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);				// No Auto Acknowledgment on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);			// Enable data pipe 0 only
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, packet_length);	// rx pipe 0 (used only for blue board)
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, CX10_RF_BIND_CHANNEL); | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);					// 1Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| } | ||||
| 
 | ||||
| uint16_t CX10_callback() | ||||
|  | ||||
| @ -98,16 +98,8 @@ static void __attribute__((unused)) DM002_send_packet(uint8_t bind) | ||||
| static void __attribute__((unused)) DM002_RF_init() | ||||
| { | ||||
|     NRF24L01_Initialize(); | ||||
|     NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	XN297_SetTXAddr((uint8_t *)"\x26\xA8\x67\x35\xCC", 5); | ||||
| 
 | ||||
|     NRF24L01_FlushTx(); | ||||
|     NRF24L01_FlushRx(); | ||||
|     NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
|     NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknowldgement on all data pipes
 | ||||
|     NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  // Enable data pipe 0 only
 | ||||
|     NRF24L01_SetBitrate(NRF24L01_BR_1M);             // 1Mbps
 | ||||
|     NRF24L01_SetPower(); | ||||
| 	XN297_SetTXAddr((uint8_t *)"\x26\xA8\x67\x35\xCC", 5); | ||||
| } | ||||
| 
 | ||||
| uint16_t DM002_callback() | ||||
|  | ||||
| @ -247,25 +247,13 @@ static void __attribute__((unused)) E01X_send_packet(uint8_t bind) | ||||
| static void __attribute__((unused)) E01X_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	if(sub_protocol==E012) | ||||
| 		HS6200_SetTXAddr((uint8_t *)"\x55\x42\x9C\x8F\xC9", E01X_ADDRESS_LENGTH); | ||||
| 	else if(sub_protocol==E015) | ||||
| 		HS6200_SetTXAddr((uint8_t *)"\x62\x54\x79\x38\x53", E01X_ADDRESS_LENGTH); | ||||
| 	else //E016H
 | ||||
| 		XN297_SetTXAddr((uint8_t *)"\x5a\x53\x46\x30\x31", 5);  // bind address
 | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03); | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00); // no retransmits
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);             // 1 Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);                          // Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);       // Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01);     // Set feature bits on
 | ||||
| 	NRF24L01_Activate(0x73); | ||||
| } | ||||
| 
 | ||||
| uint16_t E01X_callback() | ||||
|  | ||||
| @ -31,14 +31,8 @@ static void __attribute__((unused)) ESKY150_RF_init() | ||||
| 	hopping_frequency[1] = hopping_frequency[0] + 40; | ||||
| 
 | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, (_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO)));  | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknoledgement
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  // Enable data pipe 0
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x02);   // 4-byte RX/TX address
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0);    // Disable retransmit
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_2M); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, ESKY150_PAYLOADSIZE);   // bytes of data payload for pipe 0
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, rx_tx_addr, ESKY150_TX_ADDRESS_SIZE); | ||||
| 
 | ||||
| @ -47,9 +41,6 @@ static void __attribute__((unused)) ESKY150_RF_init() | ||||
| 	// Enable: Dynamic Payload Length, Payload with ACK , W_TX_PAYLOAD_NOACK
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, _BV(NRF2401_1D_EN_DPL) | _BV(NRF2401_1D_EN_ACK_PAY) | _BV(NRF2401_1D_EN_DYN_ACK)); | ||||
| 	NRF24L01_Activate(0x73); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	// Turn radio power on
 | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) ESKY150_bind_init() | ||||
|  | ||||
| @ -39,10 +39,6 @@ static void __attribute__((unused)) ESKY_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 
 | ||||
| 	// 2-bytes CRC, radio off
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, _BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO));  | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);            // No Auto Acknowledgement
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);        // Enable data pipe 0
 | ||||
| 	if (IS_BIND_IN_PROGRESS) | ||||
| 	{ | ||||
| 		NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x01);     // 3-byte RX/TX address for bind packets
 | ||||
| @ -51,11 +47,7 @@ static void __attribute__((unused)) ESKY_RF_init() | ||||
| 	} | ||||
| 	else | ||||
| 		ESKY_set_data_address(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0);          // No auto retransmission
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, 50);              // Channel 50 for bind packets
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);                   // 1Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);           // Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, ESKY_PAYLOAD_SIZE);  // bytes of data payload for pipe 0
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_12_RX_PW_P1, ESKY_PAYLOAD_SIZE); | ||||
| 	NRF24L01_WriteReg(NRF24L01_13_RX_PW_P2, ESKY_PAYLOAD_SIZE); | ||||
|  | ||||
| @ -81,11 +81,11 @@ static void __attribute__((unused)) ssv_pack_dpl(uint8_t addr[], uint8_t pid, ui | ||||
| 	*len += 4; | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) FQ777_send_packet(uint8_t bind) | ||||
| static void __attribute__((unused)) FQ777_send_packet() | ||||
| { | ||||
| 	uint8_t packet_len = FQ777_PACKET_SIZE; | ||||
| 	uint8_t packet_ori[8]; | ||||
| 	if (bind) | ||||
| 	if (IS_BIND_IN_PROGRESS) | ||||
| 	{ | ||||
| 		// 4,5,6 = address fields
 | ||||
| 		// last field is checksum of address fields
 | ||||
| @ -138,7 +138,7 @@ static void __attribute__((unused)) FQ777_send_packet(uint8_t bind) | ||||
| 		packet_count++; | ||||
| 	} | ||||
| 
 | ||||
| 	ssv_pack_dpl( (0 == bind) ? rx_tx_addr : FQ777_bind_addr, hopping_frequency_no, &packet_len, packet_ori, packet); | ||||
| 	ssv_pack_dpl( IS_BIND_IN_PROGRESS ? FQ777_bind_addr : rx_tx_addr, hopping_frequency_no, &packet_len, packet_ori, packet); | ||||
| 	 | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG,_BV(NRF24L01_00_PWR_UP)); | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, hopping_frequency[hopping_frequency_no++]); | ||||
| @ -153,27 +153,15 @@ static void __attribute__((unused)) FQ777_send_packet(uint8_t bind) | ||||
| static void __attribute__((unused)) FQ777_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, FQ777_bind_addr, 5); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknowledgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x00); | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03); | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00); // no retransmits
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_250K); | ||||
| 	NRF24L01_SetPower(); | ||||
|     NRF24L01_Activate(0x73);                         // Activate feature register
 | ||||
|     NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);      // Disable dynamic payload length on all pipes
 | ||||
|     NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01); | ||||
|     NRF24L01_Activate(0x73); | ||||
| } | ||||
| 
 | ||||
| uint16_t FQ777_callback() | ||||
| { | ||||
| 	if(bind_counter!=0) | ||||
| 	if(bind_counter) | ||||
| 	{ | ||||
| 		FQ777_send_packet(1); | ||||
| 		bind_counter--; | ||||
| 		if (bind_counter == 0) | ||||
| 		{ | ||||
| @ -181,13 +169,12 @@ uint16_t FQ777_callback() | ||||
| 			BIND_DONE; | ||||
| 		} | ||||
| 	} | ||||
| 	#ifdef MULTI_SYNC | ||||
| 	else | ||||
| 	{ | ||||
| 		#ifdef MULTI_SYNC | ||||
| 			telemetry_set_input_sync(FQ777_PACKET_PERIOD); | ||||
| 		#endif | ||||
| 		FQ777_send_packet(0); | ||||
| 	} | ||||
| 		telemetry_set_input_sync(FQ777_PACKET_PERIOD); | ||||
| 	#endif | ||||
| 
 | ||||
| 	FQ777_send_packet(); | ||||
| 	return FQ777_PACKET_PERIOD; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -61,20 +61,8 @@ static void __attribute__((unused)) FX816_send_packet() | ||||
| static void __attribute__((unused)) FX816_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	XN297_SetTXAddr((uint8_t *)"\xcc\xcc\xcc\xcc\xcc", 5); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     	// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      	// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  	// Enable data pipe 0 only
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);             	// 1Mbps
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00);	// No retransmits
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);							// Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);			// Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01); | ||||
| 	NRF24L01_Activate(0x73); | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) FX816_initialize_txid() | ||||
|  | ||||
| @ -91,22 +91,16 @@ static void __attribute__((unused)) FY326_send_packet(uint8_t bind) | ||||
| static void __attribute__((unused)) FY326_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	if(sub_protocol==FY319) | ||||
| 		NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);   // Five-byte rx/tx address
 | ||||
| 	else | ||||
| 		NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x01);   // Three-byte rx/tx address
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR,    (uint8_t *)"\x15\x59\x23\xc6\x29", 5); | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, (uint8_t *)"\x15\x59\x23\xc6\x29", 5); | ||||
|     NRF24L01_FlushTx(); | ||||
|     NRF24L01_FlushRx(); | ||||
|     NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
|     NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknowledgement on all data pipes
 | ||||
|     NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  // Enable data pipe 0 only
 | ||||
|     NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, FY326_PACKET_SIZE); | ||||
|     NRF24L01_WriteReg(NRF24L01_05_RF_CH, FY326_RF_BIND_CHANNEL); | ||||
|     NRF24L01_SetBitrate(NRF24L01_BR_250K); | ||||
|     NRF24L01_SetPower(); | ||||
| 
 | ||||
| 	NRF24L01_Activate(0x73); | ||||
|     NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x3f); | ||||
| @ -115,7 +109,6 @@ static void __attribute__((unused)) FY326_RF_init() | ||||
| 
 | ||||
| 	//Switch to RX
 | ||||
| 	NRF24L01_SetTxRxMode(TXRX_OFF); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_SetTxRxMode(RX_EN); | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -32,10 +32,10 @@ enum { | ||||
| 	GW008_DATA | ||||
| }; | ||||
| 
 | ||||
| static void __attribute__((unused)) GW008_send_packet(uint8_t bind) | ||||
| static void __attribute__((unused)) GW008_send_packet() | ||||
| { | ||||
| 	packet[0] = rx_tx_addr[0]; | ||||
| 	if(bind) | ||||
| 	if(IS_BIND_IN_PROGRESS) | ||||
| 	{ | ||||
| 		packet[1] = 0x55; | ||||
| 		packet[2] = hopping_frequency[0]; | ||||
| @ -65,7 +65,7 @@ static void __attribute__((unused)) GW008_send_packet(uint8_t bind) | ||||
| 
 | ||||
| 	// Power on, TX mode, CRC enabled
 | ||||
| 	XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP)); | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, bind ? GW008_RF_BIND_CHANNEL : hopping_frequency[(hopping_frequency_no++)/2]); | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, IS_BIND_IN_PROGRESS ? GW008_RF_BIND_CHANNEL : hopping_frequency[(hopping_frequency_no++)/2]); | ||||
| 	hopping_frequency_no %= 8; | ||||
| 
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); | ||||
| @ -78,23 +78,10 @@ static void __attribute__((unused)) GW008_send_packet(uint8_t bind) | ||||
| static void __attribute__((unused)) GW008_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	XN297_SetTXAddr((uint8_t*)"\xcc\xcc\xcc\xcc\xcc", 5); | ||||
| 	XN297_SetRXAddr((uint8_t*)"\xcc\xcc\xcc\xcc\xcc", 5); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01); | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, GW008_PAYLOAD_SIZE+2); // payload + 2 bytes for pcf
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03); | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00); // no retransmits
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M); | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);                         // Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);      // Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01);    // Set feature bits on
 | ||||
| 	NRF24L01_Activate(0x73); | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) GW008_initialize_txid() | ||||
| @ -123,7 +110,7 @@ uint16_t GW008_callback() | ||||
| 			{ | ||||
| 				NRF24L01_SetTxRxMode(TXRX_OFF); | ||||
| 				NRF24L01_SetTxRxMode(TX_EN); | ||||
| 				GW008_send_packet(1); | ||||
| 				GW008_send_packet(); | ||||
| 				phase = GW008_BIND2; | ||||
| 				return 850; // minimum value 750 for STM32
 | ||||
| 			} | ||||
| @ -142,7 +129,7 @@ uint16_t GW008_callback() | ||||
| 			#ifdef MULTI_SYNC | ||||
| 				telemetry_set_input_sync(GW008_PACKET_PERIOD); | ||||
| 			#endif | ||||
| 			GW008_send_packet(0); | ||||
| 			GW008_send_packet(); | ||||
| 			break; | ||||
| 	} | ||||
| 	return GW008_PACKET_PERIOD; | ||||
|  | ||||
| @ -50,7 +50,7 @@ enum H8_3D_FLAGS_2 { | ||||
|     H8_3D_FLAG_CAM_UP     = 0x04, | ||||
| }; | ||||
| 
 | ||||
| static void __attribute__((unused)) H8_3D_send_packet(uint8_t bind) | ||||
| static void __attribute__((unused)) H8_3D_send_packet() | ||||
| { | ||||
| 	if(sub_protocol==H20H) | ||||
| 		packet[0] = 0x14; | ||||
| @ -63,7 +63,7 @@ static void __attribute__((unused)) H8_3D_send_packet(uint8_t bind) | ||||
| 	packet[4] = rx_tx_addr[3]; | ||||
| 	packet[8] = rx_tx_addr[0]+rx_tx_addr[1]+rx_tx_addr[2]+rx_tx_addr[3]; // txid checksum
 | ||||
| 	memset(&packet[9], 0, 10); | ||||
| 	if (bind) | ||||
| 	if (IS_BIND_IN_PROGRESS) | ||||
| 	{     | ||||
| 		packet[5] = 0x00; | ||||
| 		packet[6] = 0x00; | ||||
| @ -127,13 +127,13 @@ static void __attribute__((unused)) H8_3D_send_packet(uint8_t bind) | ||||
| 	XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP)); | ||||
| 	if(sub_protocol!=H20H) | ||||
| 	{ // H8_3D, H20MINI, H30MINI
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_05_RF_CH, bind ? hopping_frequency[0] : hopping_frequency[hopping_frequency_no++]); | ||||
| 		NRF24L01_WriteReg(NRF24L01_05_RF_CH, IS_BIND_IN_PROGRESS ? hopping_frequency[0] : hopping_frequency[hopping_frequency_no++]); | ||||
| 		hopping_frequency_no %= H8_3D_RF_NUM_CHANNELS; | ||||
| 	} | ||||
| 	else | ||||
| 	{ //H20H
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_05_RF_CH, bind ? H20H_BIND_RF : hopping_frequency[packet_count>>3]);   | ||||
| 		if(!bind) | ||||
| 		NRF24L01_WriteReg(NRF24L01_05_RF_CH, IS_BIND_IN_PROGRESS ? H20H_BIND_RF : hopping_frequency[packet_count>>3]);   | ||||
| 		if(IS_BIND_DONE) | ||||
| 		{ | ||||
| 			packet_count++; | ||||
| 			if(packet_count>15) | ||||
| @ -157,45 +157,31 @@ static void __attribute__((unused)) H8_3D_send_packet(uint8_t bind) | ||||
| 
 | ||||
| static void __attribute__((unused)) H8_3D_RF_init() | ||||
| { | ||||
|     NRF24L01_Initialize(); | ||||
|     NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	NRF24L01_Initialize(); | ||||
| 
 | ||||
| 	if(sub_protocol==H20H) | ||||
| 		XN297_SetTXAddr((uint8_t *)"\xEE\xDD\xCC\xBB\x11", 5); | ||||
| 	else // H8_3D, H20MINI, H30MINI
 | ||||
| 		XN297_SetTXAddr((uint8_t *)"\xC4\x57\x09\x65\x21", 5); | ||||
| 
 | ||||
|     NRF24L01_FlushTx(); | ||||
|     NRF24L01_FlushRx(); | ||||
|     NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
|     NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknowldgement on all data pipes
 | ||||
|     NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  // Enable data pipe 0 only
 | ||||
|     NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00); // no retransmits
 | ||||
|     NRF24L01_SetBitrate(NRF24L01_BR_1M);             // 1Mbps
 | ||||
|     NRF24L01_SetPower(); | ||||
| } | ||||
| 
 | ||||
| uint16_t H8_3D_callback() | ||||
| { | ||||
| 	if(IS_BIND_DONE) | ||||
| 	{ | ||||
| 		#ifdef MULTI_SYNC | ||||
| 			telemetry_set_input_sync(packet_period); | ||||
| 		#endif | ||||
| 		H8_3D_send_packet(0); | ||||
| 	} | ||||
| 	else | ||||
| 	if(bind_counter) | ||||
| 	{ | ||||
| 		bind_counter--; | ||||
| 		if (bind_counter == 0) | ||||
| 		{ | ||||
| 			BIND_DONE; | ||||
| 			packet_count=0; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			H8_3D_send_packet(1); | ||||
| 			bind_counter--; | ||||
| 		} | ||||
| 	} | ||||
| 	#ifdef MULTI_SYNC | ||||
| 	else | ||||
| 		telemetry_set_input_sync(packet_period); | ||||
| 	#endif | ||||
| 
 | ||||
| 	H8_3D_send_packet(); | ||||
| 	return	packet_period; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -24,43 +24,6 @@ | ||||
| //
 | ||||
| uint8_t bind_buf_arry[4][10]; | ||||
| 
 | ||||
| // HiSky protocol uses TX id as an address for nRF24L01, and uses frequency hopping sequence
 | ||||
| // which does not depend on this id and is passed explicitly in binding sequence. So we are free
 | ||||
| // to generate this sequence as we wish. It should be in the range [02..77]
 | ||||
| static void __attribute__((unused)) HISKY_calc_fh_channels() | ||||
| { | ||||
| 	uint8_t idx = 0; | ||||
| 	uint32_t rnd = MProtocol_id; | ||||
| 
 | ||||
| 	while (idx < HISKY_FREQUENCE_NUM) | ||||
| 	{ | ||||
| 		uint8_t i; | ||||
| 		uint8_t count_2_26 = 0, count_27_50 = 0, count_51_74 = 0; | ||||
| 
 | ||||
| 		rnd = rnd * 0x0019660D + 0x3C6EF35F; // Randomization
 | ||||
| 		// Use least-significant byte. 73 is prime, so channels 76..77 are unused
 | ||||
| 		uint8_t next_ch = ((rnd >> 8) % 73) + 2; | ||||
| 		// Keep the distance 2 between the channels - either odd or even
 | ||||
| 		if (((next_ch ^ (uint8_t)rx_tx_addr[3]) & 0x01 )== 0) | ||||
| 			continue; | ||||
| 		// Check that it's not duplicated and spread uniformly
 | ||||
| 		for (i = 0; i < idx; i++) { | ||||
| 			if(hopping_frequency[i] == next_ch) | ||||
| 				break; | ||||
| 			if(hopping_frequency[i] <= 26) | ||||
| 				count_2_26++; | ||||
| 			else if (hopping_frequency[i] <= 50) | ||||
| 				count_27_50++; | ||||
| 			else | ||||
| 				count_51_74++; | ||||
| 		} | ||||
| 		if (i != idx) | ||||
| 			continue; | ||||
| 		if ( (next_ch <= 26 && count_2_26 < 8) || (next_ch >= 27 && next_ch <= 50 && count_27_50 < 8) || (next_ch >= 51 && count_51_74 < 8) ) | ||||
| 			hopping_frequency[idx++] = next_ch;//find hopping frequency
 | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) HISKY_build_binding_packet(void) | ||||
| { | ||||
| 	uint8_t i; | ||||
| @ -99,19 +62,12 @@ static void __attribute__((unused)) HISKY_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);			// No Auto Acknowledgement
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);		// Enable p0 rx
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);		// 5-byte RX/TX address (byte -2)
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, 81);			// binding packet must be set in channel 81
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, rx_tx_addr, 5); | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, rx_tx_addr, 5); | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, 10);		// payload size = 10
 | ||||
| 	if(sub_protocol==HK310) | ||||
| 		NRF24L01_SetBitrate(NRF24L01_BR_250K);				// 250Kbps
 | ||||
| 	else | ||||
| 		NRF24L01_SetBitrate(NRF24L01_BR_1M);				// 1Mbps
 | ||||
| 	NRF24L01_SetPower();								// Set power
 | ||||
| 	NRF24L01_SetTxRxMode(TX_EN);						// TX mode, 2-bytes CRC, radio on
 | ||||
| 		NRF24L01_SetBitrate(NRF24L01_BR_250K);			// 250Kbps
 | ||||
| } | ||||
| 
 | ||||
| // HiSky channel sequence: AILE  ELEV  THRO  RUDD  GEAR  PITCH, channel data value is from 0 to 1000
 | ||||
| @ -248,7 +204,10 @@ static void __attribute__((unused)) HISKY_initialize_tx_id() | ||||
| 			hopping_frequency[i]=hopping_frequency_no++;	// Sequential order hop channels...
 | ||||
| 	} | ||||
| 	else | ||||
| 		HISKY_calc_fh_channels(); | ||||
| 		calc_fh_channels(HISKY_FREQUENCE_NUM); | ||||
| 		// HiSky air protocol uses TX id as an address for nRF24L01, and uses frequency hopping sequence
 | ||||
| 		// which does not depend on this id and is passed explicitly in binding sequence. So we are free
 | ||||
| 		// to generate this sequence as we wish. It should be in the range [02..77]
 | ||||
| } | ||||
| 
 | ||||
| void HISKY_init() | ||||
|  | ||||
| @ -136,19 +136,11 @@ static void __attribute__((unused)) HONTAI_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 
 | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	if(sub_protocol == JJRCX1) | ||||
| 		NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, (uint8_t*)"\xd2\xb5\x99\xb3\x4a", 5); | ||||
| 	else | ||||
| 		XN297_SetTXAddr((const uint8_t*)"\xd2\xb5\x99\xb3\x4a", 5); | ||||
| 
 | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);			// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);				// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);					// 1Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);								// Activate feature register
 | ||||
| 	if(sub_protocol == JJRCX1) | ||||
| 	{ | ||||
| @ -156,12 +148,6 @@ static void __attribute__((unused)) HONTAI_RF_init() | ||||
| 		NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x3f);			// match other stock settings even though AA disabled...
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x07); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00);	// no retransmits
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);			// Disable dynamic payload length on all pipes
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x00); | ||||
| 	} | ||||
| 	NRF24L01_Activate(0x73);								// Deactivate feature register
 | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -133,16 +133,9 @@ static void __attribute__((unused)) JJRC345_send_packet() | ||||
| static void __attribute__((unused)) JJRC345_RF_init() | ||||
| { | ||||
|     NRF24L01_Initialize(); | ||||
|     NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
|     XN297_SetTXAddr((uint8_t*)"\xcc\xcc\xcc\xcc\xcc", 5); | ||||
|     NRF24L01_WriteReg(NRF24L01_05_RF_CH, sub_protocol == JJRC345 ? JJRC345_RF_BIND_CHANNEL:SKYTMBLR_RF_BIND_CHANNEL);	// Bind channel
 | ||||
|     NRF24L01_FlushTx(); | ||||
|     NRF24L01_FlushRx(); | ||||
|     NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);					// Clear data ready, data sent, and retransmit
 | ||||
|     NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);						// No Auto Acknowldgement on all data pipes
 | ||||
|     NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);					// Enable data pipe 0 only
 | ||||
|     NRF24L01_SetBitrate(NRF24L01_BR_1M);							// 1 Mbps
 | ||||
|     NRF24L01_SetPower(); | ||||
| } | ||||
| 
 | ||||
| uint16_t JJRC345_callback() | ||||
|  | ||||
| @ -246,27 +246,12 @@ static void __attribute__((unused)) KN_RF_init() | ||||
| 
 | ||||
| 	NRF24L01_Initialize(); | ||||
| 
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, _BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO));  | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknoledgement
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  // Enable data pipe 0
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);   // 5-byte RX/TX address
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0);    // Disable retransmit
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, 0x20);   // bytes of data payload for pipe 0
 | ||||
| 
 | ||||
| 
 | ||||
| 	NRF24L01_Activate(0x73); | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 1); // Dynamic payload for data pipe 0
 | ||||
| 	// Enable: Dynamic Payload Length to enable PCF
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, _BV(NRF2401_1D_EN_DPL)); | ||||
| 
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 
 | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	// Turn radio power on
 | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);	//USE1MBPS_YES ? NRF24L01_BR_1M : NRF24L01_BR_250K;
 | ||||
| 	NRF24L01_Activate(0x73); | ||||
| } | ||||
|    | ||||
| //================================================================================================
 | ||||
|  | ||||
| @ -24,20 +24,11 @@ Multiprotocol is distributed in the hope that it will be useful, | ||||
| static void __attribute__((unused)) LOLI_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      	// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  	// Enable data pipe 0 only
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);		// 5-bytes RX/TX address
 | ||||
| 
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, (uint8_t*)"LOVE!", 5); | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, (uint8_t*)"LOVE!", 5); | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00);	// No retransmits
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, LOLI_PACKET_SIZE);	// RX FIFO size
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_250K);             	// 250Kbps
 | ||||
| 
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     	// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| } | ||||
| 
 | ||||
| // flags going to packet[1] for packet type 0xa2 (Rx config)
 | ||||
|  | ||||
| @ -246,25 +246,15 @@ static void __attribute__((unused)) MJXQ_RF_init() | ||||
| 	else | ||||
| 	{ | ||||
| 		NRF24L01_Initialize(); | ||||
| 		NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 		if (sub_protocol == H26D || sub_protocol == H26WH) | ||||
| 		{ | ||||
| 			NRF24L01_WriteReg(NRF24L01_03_SETUP_AW,		0x03);		// 5-byte RX/TX address
 | ||||
| 			NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, addr, MJXQ_ADDRESS_LENGTH); | ||||
| 		} | ||||
| 		else | ||||
| 			XN297_SetTXAddr(addr, MJXQ_ADDRESS_LENGTH); | ||||
| 
 | ||||
| 		NRF24L01_FlushTx(); | ||||
| 		NRF24L01_FlushRx(); | ||||
| 		NRF24L01_WriteReg(NRF24L01_07_STATUS,		0x70);		// Clear data ready, data sent, and retransmit
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_01_EN_AA,		0x00);		// No Auto Acknowledgment on all data pipes
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR,	0x01);		// Enable data pipe 0 only
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR,	0x00);		// no retransmits
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0,		MJXQ_PACKET_SIZE); | ||||
| 		NRF24L01_SetBitrate(NRF24L01_BR_1M);					// 1Mbps
 | ||||
| 		NRF24L01_SetPower(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -253,22 +253,12 @@ static void __attribute__((unused)) MT99XX_send_packet() | ||||
| static void __attribute__((unused)) MT99XX_RF_init() | ||||
| { | ||||
|     NRF24L01_Initialize(); | ||||
| 
 | ||||
|     if(sub_protocol == YZ) | ||||
| 		XN297_SetScrambledMode(XN297_UNSCRAMBLED); | ||||
|     NRF24L01_SetTxRxMode(TX_EN); | ||||
|     NRF24L01_FlushTx(); | ||||
|     XN297_SetTXAddr((uint8_t *)"\xCC\xCC\xCC\xCC\xCC", 5); | ||||
|     NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);		// Clear data ready, data sent, and retransmit
 | ||||
|     NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);			// No Auto Acknowldgement on all data pipes
 | ||||
|     NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);		// Enable data pipe 0 only
 | ||||
|     NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);		// 5 bytes address
 | ||||
|     NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00);	// no auto retransmit
 | ||||
|     if(sub_protocol == YZ) | ||||
|         NRF24L01_SetBitrate(NRF24L01_BR_250K);			// 250Kbps (nRF24L01+ only)
 | ||||
|     else | ||||
|         NRF24L01_SetBitrate(NRF24L01_BR_1M);			// 1Mbps
 | ||||
|     NRF24L01_SetPower(); | ||||
| 	 | ||||
|     XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP) ); | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -19,7 +19,7 @@ | ||||
| #define VERSION_MAJOR		1 | ||||
| #define VERSION_MINOR		3 | ||||
| #define VERSION_REVISION	2 | ||||
| #define VERSION_PATCH_LEVEL	38 | ||||
| #define VERSION_PATCH_LEVEL	39 | ||||
| 
 | ||||
| //******************
 | ||||
| // Protocols
 | ||||
|  | ||||
| @ -34,22 +34,13 @@ enum { | ||||
| static void __attribute__((unused)) NCC_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);     // 5-byte RX/TX address
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, (uint8_t*)"\xE7\xE7\xC7\xD7\x67",5); | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR,    (uint8_t*)"\xE7\xE7\xC7\xD7\x67",5); | ||||
| 	 | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);			// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);				// No Auto Acknowledgment on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);			// Enable data pipe 0 only
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, NCC_RX_PACKET_LEN);	// Enable rx pipe 0
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_250K);					// NRF24L01_BR_1M, NRF24L01_BR_2M, NRF24L01_BR_250K
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, (0 << NRF24L01_00_EN_CRC)   // switch to TX mode and disable CRC
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, NCC_RX_PACKET_LEN);			// Enable rx pipe 0
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_250K);								// NRF24L01_BR_1M, NRF24L01_BR_2M, NRF24L01_BR_250K
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, (0 << NRF24L01_00_EN_CRC)		// switch to TX mode and disable CRC
 | ||||
| 										| (1 << NRF24L01_00_CRCO) | ||||
| 										| (1 << NRF24L01_00_PWR_UP) | ||||
| 										| (0 << NRF24L01_00_PRIM_RX)); | ||||
|  | ||||
| @ -29,6 +29,23 @@ void NRF24L01_Initialize() | ||||
|     rf_setup = 0x09; | ||||
| 	prev_power = 0x00;	// Make sure prev_power is inline with current power
 | ||||
| 	XN297_SetScrambledMode(XN297_SCRAMBLED); | ||||
| 
 | ||||
| 	//Load most likely default NRF config
 | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA,		0x00);	// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR,	0x01); 	// Enable data pipe 0 only
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW,		0x03);	// 5 bytes rx/tx address
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR,	0x00); 	// no retransmits
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);             	// 1Mbps
 | ||||
| 	/* Already done in NRF24L01_Reset
 | ||||
| 	NRF24L01_Activate(0x73);                          	// Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);       	// Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01);     	// Set feature bits off and enable the command NRF24L01_B0_TX_PYLD_NOACK
 | ||||
| 	NRF24L01_Activate(0x73); | ||||
| 	*/ | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN);						// Clear data ready, data sent, retransmit and enable CRC 16bits, ready for TX
 | ||||
| }   | ||||
| 
 | ||||
| void NRF24L01_WriteReg(uint8_t reg, uint8_t data) | ||||
| @ -220,7 +237,7 @@ void NRF24L01_Reset() | ||||
| 	//** not in deviation but needed to hot switch between models
 | ||||
| 	NRF24L01_Activate(0x73);                          // Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);       // Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x00);     // Set feature bits off
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01);     // Set feature bits off
 | ||||
| 	NRF24L01_Activate(0x73); | ||||
| 	//**
 | ||||
| 
 | ||||
|  | ||||
| @ -26,14 +26,7 @@ static void __attribute__((unused)) XN297L_Init() | ||||
| 		PE1_on;							//NRF24L01 antenna RF3 by default
 | ||||
| 		PE2_off;						//NRF24L01 antenna RF3 by default
 | ||||
| 		NRF24L01_Initialize(); | ||||
| 		NRF24L01_SetTxRxMode(TX_EN); | ||||
| 		NRF24L01_FlushTx(); | ||||
| 		NRF24L01_FlushRx(); | ||||
| 		NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);	// Clear data ready, data sent, and retransmit
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);		// No Auto Acknowldgement on all data pipes
 | ||||
| 		NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);	// Enable data pipe 0 only
 | ||||
| 		NRF24L01_SetBitrate(NRF24L01_BR_250K);			// 250Kbps
 | ||||
| 		NRF24L01_SetPower(); | ||||
| 		return; | ||||
| 	} | ||||
| 	//CC2500
 | ||||
|  | ||||
| @ -45,16 +45,9 @@ static void __attribute__((unused)) NANORF_send_packet() | ||||
| static void __attribute__((unused)) NANORF_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR , (uint8_t *)"Nano1",5); | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknoledgement
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  // Enable all data pipes (even though not used?)
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);   // 5-byte RX/TX address
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00); // 4mS retransmit t/o, 15 tries (retries w/o AA?)
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, NANORF_RF_CHANNEL); | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M); | ||||
| 	NRF24L01_SetPower();	// Set tx_power
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, _BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP));  // 
 | ||||
| } | ||||
| 
 | ||||
| uint16_t NANORF_callback() | ||||
|  | ||||
| @ -74,23 +74,11 @@ static void __attribute__((unused)) POTENSIC_send_packet() | ||||
| static void __attribute__((unused)) POTENSIC_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 
 | ||||
| 	if(IS_BIND_IN_PROGRESS) | ||||
| 		XN297_SetTXAddr((uint8_t*)"\x01\x01\x01\x01\x06", 5);	// Bind address
 | ||||
| 	else | ||||
| 		XN297_SetTXAddr(rx_tx_addr,5);							// Normal address
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);			// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);		// Enable data pipe 0 only
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);		// set address length (5 bytes)
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00);	// no retransmits
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);				// 1Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);							// Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);			// Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01); | ||||
| 	NRF24L01_Activate(0x73); | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) POTENSIC_initialize_txid() | ||||
|  | ||||
| @ -158,24 +158,18 @@ static void __attribute__((unused)) PROPEL_data_packet() | ||||
| static void __attribute__((unused)) PROPEL_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x7f); | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x3f);       // AA on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x3f);   // Enable all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);    // 5-byte address
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x36);  // retransmit 1ms, 6 times
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);              // 1Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x07);      // ?? match protocol capture
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, (uint8_t *)"\x99\x77\x55\x33\x11", PROPEL_ADDRESS_LENGTH);	//Bind address
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR,    (uint8_t *)"\x99\x77\x55\x33\x11", PROPEL_ADDRESS_LENGTH);	//Bind address
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, PROPEL_BIND_RF_CHANNEL); | ||||
| 	NRF24L01_Activate(0x73);                          // Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x3f);       // Enable dynamic payload length
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x07);     // Enable all features
 | ||||
| 	// Beken 2425 register bank 1 initialized here in stock tx capture
 | ||||
| 	// Hopefully won't matter for nRF compatibility
 | ||||
| 	NRF24L01_FlushTx(); | ||||
|     NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	NRF24L01_Activate(0x73);                          // Activate feature register
 | ||||
| } | ||||
| 
 | ||||
| const uint8_t PROGMEM PROPEL_hopping []= { 0x47,0x36,0x27,0x44,0x33,0x0D,0x3C,0x2E,0x1B,0x39,0x2A,0x18 }; | ||||
|  | ||||
| @ -286,32 +286,13 @@ static void __attribute__((unused)) Q303_RF_init() | ||||
| 	const uint8_t bind_address[] = {0xcc,0xcc,0xcc,0xcc,0xcc}; | ||||
| 
 | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	switch(sub_protocol) | ||||
| 
 | ||||
| 	if(sub_protocol==Q303) | ||||
| 	{ | ||||
| 		case CX35: | ||||
| 		case CX10D: | ||||
| 		case CX10WD: | ||||
| 			NRF24L01_SetBitrate(NRF24L01_BR_1M); | ||||
| 			break; | ||||
| 		case Q303: | ||||
| 			XN297_SetScrambledMode(XN297_UNSCRAMBLED); | ||||
| 			NRF24L01_SetBitrate(NRF24L01_BR_250K); | ||||
| 			break; | ||||
| 		XN297_SetScrambledMode(XN297_UNSCRAMBLED); | ||||
| 		NRF24L01_SetBitrate(NRF24L01_BR_250K); | ||||
| 	} | ||||
| 	XN297_SetTXAddr(bind_address, 5); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);		// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);			// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01); | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03); | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00);	// no retransmits
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);							// Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);			// Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01);		// Set feature bits on
 | ||||
| 	NRF24L01_Activate(0x73); | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) Q303_initialize_txid() | ||||
|  | ||||
| @ -89,14 +89,7 @@ static void __attribute__((unused)) REALACC_initialize_txid() | ||||
| static void __attribute__((unused)) REALACC_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);	// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);		// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);	// Enable data pipe 0 only
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);			// 1Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 
 | ||||
| 	XN297_SetTXAddr((uint8_t*)"MAIN", 4); | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, REALACC_BIND_RF_CHANNEL);	// Set bind channel
 | ||||
| } | ||||
|  | ||||
| @ -32,12 +32,6 @@ const uint8_t PROGMEM SHENQI_Freq[] = { | ||||
| void SHENQI_RF_init() | ||||
| { | ||||
|     NRF24L01_Initialize(); | ||||
|     NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);		// Clear data ready, data sent, and retransmit
 | ||||
|     NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);			// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);          // 1Mbps
 | ||||
|     NRF24L01_SetPower(); | ||||
| 
 | ||||
|     NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);		// 5 bytes rx/tx address
 | ||||
| 
 | ||||
| 	LT8900_Config(4, 8, _BV(LT8900_CRC_ON)|_BV(LT8900_PACKET_LENGTH_EN), 0xAA); | ||||
| 	LT8900_SetChannel(2); | ||||
|  | ||||
| @ -193,19 +193,13 @@ static void __attribute__((unused)) symax_rf_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	//
 | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	//	
 | ||||
| 	NRF24L01_ReadReg(NRF24L01_07_STATUS); | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, _BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO));  | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknoledgement
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x3F);  // Enable all data pipes (even though not used?)
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);   // 5-byte RX/TX address
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0xff); // 4mS retransmit t/o, 15 tries (retries w/o AA?)
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, 0x08); | ||||
| 
 | ||||
| 	if (sub_protocol==SYMAX5C) | ||||
| 	{ | ||||
| 		NRF24L01_SetBitrate(NRF24L01_BR_1M); | ||||
| 		//NRF24L01_SetBitrate(NRF24L01_BR_1M);
 | ||||
| 		packet_length = 16; | ||||
| 	} | ||||
| 	else | ||||
| @ -214,8 +208,6 @@ static void __attribute__((unused)) symax_rf_init() | ||||
| 		packet_length = 10; | ||||
| 	} | ||||
| 	//
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_08_OBSERVE_TX, 0x00); | ||||
| 	NRF24L01_WriteReg(NRF24L01_09_CD, 0x00); | ||||
| 	NRF24L01_WriteReg(NRF24L01_0C_RX_ADDR_P2, 0xC3); // LSB byte of pipe 2 receive address
 | ||||
| @ -231,14 +223,6 @@ static void __attribute__((unused)) symax_rf_init() | ||||
| 	NRF24L01_WriteReg(NRF24L01_17_FIFO_STATUS, 0x00); // Just in case, no real bits to write here
 | ||||
| 
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR , sub_protocol==SYMAX5C ? (uint8_t *)"\x6D\x6A\x73\x73\x73" : (uint8_t *)"\xAB\xAC\xAD\xAE\xAF" ,5); | ||||
| 
 | ||||
| 	NRF24L01_ReadReg(NRF24L01_07_STATUS); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_ReadReg(NRF24L01_07_STATUS); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x0e); | ||||
| 	NRF24L01_ReadReg(NRF24L01_00_CONFIG);  | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x0c);  | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x0e);  // power on
 | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) symax_init1() | ||||
|  | ||||
| @ -91,20 +91,8 @@ static void __attribute__((unused)) TIGER_send_packet() | ||||
| static void __attribute__((unused)) TIGER_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 
 | ||||
| 	XN297_SetTXAddr((uint8_t *)"\x68\x94\xA6\xD5\xC3", 5); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     	// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      	// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);  	// Enable data pipe 0 only
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);             	// 1Mbps
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00);	// No retransmits
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);							// Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);			// Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01); | ||||
| 	NRF24L01_Activate(0x73); | ||||
| 	// Power on, TX mode, 2byte CRC
 | ||||
| 	XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP)); | ||||
| } | ||||
|  | ||||
| @ -74,34 +74,11 @@ static void __attribute__((unused)) V2X2_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 
 | ||||
| 	// 2-bytes CRC, radio off
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, _BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO));  | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);      // No Auto Acknoledgement
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x3F);  // Enable all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);   // 5-byte RX/TX address
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0xFF); // 4ms retransmit t/o, 15 tries
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_05_RF_CH, 0x08);      // Channel 8
 | ||||
| 	NRF24L01_SetBitrate(sub_protocol==V2X2_MR101?NRF24L01_BR_250K:NRF24L01_BR_1M); | ||||
| 	NRF24L01_SetPower(); | ||||
| 	 | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);     // Clear data ready, data sent, and retransmit
 | ||||
| 	//    NRF24L01_WriteReg(NRF24L01_08_OBSERVE_TX, 0x00); // no write bits in this field
 | ||||
| 	//    NRF24L01_WriteReg(NRF24L01_00_CD, 0x00);         // same
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_0C_RX_ADDR_P2, 0xC3); // LSB byte of pipe 2 receive address
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_0D_RX_ADDR_P3, 0xC4);
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_0E_RX_ADDR_P4, 0xC5);
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_0F_RX_ADDR_P5, 0xC6);
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, V2X2_PAYLOADSIZE);   // bytes of data payload for pipe 1
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_12_RX_PW_P1, V2X2_PAYLOADSIZE);
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_13_RX_PW_P2, V2X2_PAYLOADSIZE);
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_14_RX_PW_P3, V2X2_PAYLOADSIZE);
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_15_RX_PW_P4, V2X2_PAYLOADSIZE);
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_16_RX_PW_P5, V2X2_PAYLOADSIZE);
 | ||||
| 	// NRF24L01_WriteReg(NRF24L01_17_FIFO_STATUS, 0x00); // Just in case, no real bits to write here
 | ||||
| 	if(sub_protocol==V2X2_MR101) | ||||
| 		NRF24L01_SetBitrate(NRF24L01_BR_250K); | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, (uint8_t *)"\x66\x88\x68\x68\x68", 5); | ||||
| 	// NRF24L01_WriteRegisterMulti(NRF24L01_0B_RX_ADDR_P1, (uint8_t *)"\x88\x66\x86\x86\x86", 5);
 | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, (uint8_t *)"\x66\x88\x68\x68\x68", 5); | ||||
|     NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR,    (uint8_t *)"\x66\x88\x68\x68\x68", 5); | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) V2X2_set_tx_id(void) | ||||
|  | ||||
| @ -126,19 +126,7 @@ static void __attribute__((unused)) V761_send_packet() | ||||
| static void __attribute__((unused)) V761_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);			// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);		// Enable data pipe 0 only
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x02);		// set address length (4 bytes)
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00);	// no retransmits
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);				// 1Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_Activate(0x73);							// Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00);			// Disable dynamic payload length on all pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01); | ||||
| 	NRF24L01_Activate(0x73); | ||||
| } | ||||
| 
 | ||||
| static void __attribute__((unused)) V761_initialize_txid() | ||||
|  | ||||
| @ -122,16 +122,10 @@ static void __attribute__((unused)) YD717_RF_init() | ||||
| 	NRF24L01_Initialize(); | ||||
| 
 | ||||
| 	// CRC, radio on
 | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	NRF24L01_WriteReg(NRF24L01_00_CONFIG, _BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_PWR_UP));  | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x3F);				// Enable Acknowledgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x3F);			// Enable all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03);			// 5-byte RX/TX address
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x1A);		// 500uS retransmit t/o, 10 tries
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, YD717_RF_CHANNEL);	// Channel 3C
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);					// 1Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);			// Clear data ready, data sent and retransmit
 | ||||
| 
 | ||||
| 	NRF24L01_Activate(0x73);								// Activate feature register
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x3F);				// Enable dynamic payload length on all pipes
 | ||||
|  | ||||
| @ -66,14 +66,7 @@ static void __attribute__((unused)) ZSX_initialize_txid() | ||||
| static void __attribute__((unused)) ZSX_RF_init() | ||||
| { | ||||
| 	NRF24L01_Initialize(); | ||||
| 	NRF24L01_SetTxRxMode(TX_EN); | ||||
| 	NRF24L01_FlushTx(); | ||||
| 	NRF24L01_FlushRx(); | ||||
| 	NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);	// Clear data ready, data sent, and retransmit
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);		// No Auto Acknowldgement on all data pipes
 | ||||
| 	NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01);	// Enable data pipe 0 only
 | ||||
| 	NRF24L01_SetBitrate(NRF24L01_BR_1M);			// 1Mbps
 | ||||
| 	NRF24L01_SetPower(); | ||||
| 
 | ||||
| 	XN297_SetTXAddr((uint8_t*)"\xc1\xc2\xc3", 3); | ||||
| 	NRF24L01_WriteReg(NRF24L01_05_RF_CH, ZSX_RF_BIND_CHANNEL);	// Set bind channel
 | ||||
| } | ||||
| @ -104,7 +97,7 @@ void ZSX_init() | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| // XN297 spped 1Mb, scrambled
 | ||||
| // XN297 speed 1Mb, scrambled
 | ||||
| // Bind
 | ||||
| //   channel 7
 | ||||
| //   address: C1 C2 C3
 | ||||
|  | ||||
| @ -353,7 +353,7 @@ | ||||
| /*************************/ | ||||
| //In this section you can configure all details about PPM.
 | ||||
| //If you do not plan to use the PPM mode comment this line using "//" to save Flash space, you don't need to configure anything below in this case
 | ||||
| #define ENABLE_PPM | ||||
| //#define ENABLE_PPM
 | ||||
| 
 | ||||
| /** TX END POINTS **/ | ||||
| //It is important for the module to know the endpoints of your radio.
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user