mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 16:28:10 +00:00
Template for WFLY RF
This commit is contained in:
parent
96263ed8a6
commit
6874e3a6a7
@ -325,6 +325,14 @@ const uint8_t PROGMEM KYOSHO_HYPE_A7105_regs[] = {
|
||||
0x01, 0x0f // 30 - 31
|
||||
};
|
||||
#endif
|
||||
#ifdef WFLYRF_A7105_INO
|
||||
const uint8_t PROGMEM WFLYRF_A7105_regs[] = {
|
||||
0xff, 0x42, 0xff, 0x25, 0x00, 0xff, 0xff ,0x00, 0x00, 0x00, 0x00, 0x01, 0x21, 0x05, 0x00, 0x50, // 00 - 0f
|
||||
0x9e, 0x4b, 0x00, 0x02, 0x16, 0x2b, 0x12, 0x40, 0x62, 0x80, 0x80, 0x00, 0x0a, 0x32, 0x03, 0x1f, // 10 - 1f
|
||||
0x1e, 0x00, 0x00, 0xff, 0x00, 0x00, 0x23, 0x70, 0x1F, 0x47, 0x80, 0x57, 0x01, 0x45, 0x19, 0x00, // 20 - 2f
|
||||
0x01, 0x0f // 30 - 31
|
||||
};
|
||||
#endif
|
||||
|
||||
#define ID_NORMAL 0x55201041
|
||||
#define ID_PLUS 0xAA201041
|
||||
@ -381,6 +389,10 @@ void A7105_Init(void)
|
||||
A7105_Regs=(uint8_t*)KYOSHO_HYPE_A7105_regs;
|
||||
}
|
||||
#endif
|
||||
#ifdef WFLYRF_A7105_INO
|
||||
if(protocol==PROTO_WFLYRF)
|
||||
A7105_Regs=(uint8_t*)WFLYRF_A7105_regs;
|
||||
#endif
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < 0x32; i++)
|
||||
|
@ -37,7 +37,7 @@
|
||||
37,CORONA,COR_V1,COR_V2,FD_V3
|
||||
38,CFlie
|
||||
39,Hitec,OPT_FW,OPT_HUB,MINIMA
|
||||
40,WFLY
|
||||
40,WFLY,WFR0x
|
||||
41,BUGS
|
||||
42,BUGSMINI,BUGSMINI,BUGS3H
|
||||
43,Traxxas,RX6519
|
||||
@ -76,3 +76,4 @@
|
||||
76,Realacc,R11
|
||||
77,OMP
|
||||
78,M-Link
|
||||
79,WFLY,RF20x
|
||||
|
@ -140,7 +140,8 @@ const char STR_SUBTYPE_ESKY[] = "\x03""Std""ET4";
|
||||
const char STR_SUBTYPE_PROPEL[] = "\x04""74-Z";
|
||||
const char STR_SUBTYPE_FRSKY_RX[] = "\x07""RX\0 ""CloneTX";
|
||||
const char STR_SUBTYPE_FRSKYL[] = "\x08""LR12\0 ""LR12 6ch";
|
||||
const char STR_SUBTYPE_WFLY[] = "\x06""WFR0xS";
|
||||
const char STR_SUBTYPE_WFLY[] = "\x05""WFR0x";
|
||||
const char STR_SUBTYPE_WFLYRF[] = "\x05""RF20x";
|
||||
const char STR_SUBTYPE_HOTT[] = "\x07""Sync\0 ""No_Sync";
|
||||
const char STR_SUBTYPE_PELIKAN[] = "\x04""Pro\0""Lite";
|
||||
const char STR_SUBTYPE_V761[] = "\x03""3ch""4ch";
|
||||
@ -384,6 +385,9 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
#if defined(WFLY_CYRF6936_INO)
|
||||
{PROTO_WFLY, STR_WFLY, 1, STR_SUBTYPE_WFLY, OPTION_NONE },
|
||||
#endif
|
||||
#if defined(WFLYRF_A7105_INO)
|
||||
{PROTO_WFLYRF, STR_WFLY, 1, STR_SUBTYPE_WFLYRF, OPTION_NONE },
|
||||
#endif
|
||||
#if defined(XK_NRF24L01_INO)
|
||||
{PROTO_XK, STR_XK , 2, STR_SUBTYPE_XK, OPTION_RFTUNE },
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_REVISION 1
|
||||
#define VERSION_PATCH_LEVEL 78
|
||||
#define VERSION_PATCH_LEVEL 79
|
||||
|
||||
//******************
|
||||
// Protocols
|
||||
@ -104,6 +104,7 @@ enum PROTOCOLS
|
||||
PROTO_REALACC = 76, // =>NRF24L01
|
||||
PROTO_OMP = 77, // =>CC2500 & NRF24L01
|
||||
PROTO_MLINK = 78, // =>CYRF6936
|
||||
PROTO_WFLYRF = 79, // =>A7105
|
||||
|
||||
PROTO_NANORF = 126, // =>NRF24L01
|
||||
PROTO_TEST = 127, // =>CC2500
|
||||
@ -836,6 +837,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
REALACC 76
|
||||
OMP 77
|
||||
MLINK 78
|
||||
WFLYRF 79
|
||||
BindBit=> 0x80 1=Bind/0=No
|
||||
AutoBindBit=> 0x40 1=Yes /0=No
|
||||
RangeCheck=> 0x20 1=Yes /0=No
|
||||
|
@ -1196,6 +1196,13 @@ static void protocol_init()
|
||||
remote_callback = ReadKyosho;
|
||||
break;
|
||||
#endif
|
||||
#if defined(WFLYRF_A7105_INO)
|
||||
case PROTO_WFLY:
|
||||
PE1_off; //antenna RF1
|
||||
next_callback = initWFLYRF();
|
||||
remote_callback = ReadWFLYRF;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CC2500_INSTALLED
|
||||
#if defined(FRSKYD_CC2500_INO)
|
||||
|
@ -227,6 +227,7 @@
|
||||
#undef HUBSAN_A7105_INO
|
||||
#undef KYOSHO_A7105_INO
|
||||
#undef PELIKAN_A7105_INO
|
||||
#undef WFLYRF_A7105_INO
|
||||
#endif
|
||||
#ifndef CYRF6936_INSTALLED
|
||||
#undef DEVO_CYRF6936_INO
|
||||
|
151
Multiprotocol/WFLYRF_a7105.ino
Normal file
151
Multiprotocol/WFLYRF_a7105.ino
Normal file
@ -0,0 +1,151 @@
|
||||
/*
|
||||
This project is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Multiprotocol is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(WFLYRF_A7105_INO)
|
||||
|
||||
#include "iface_a7105.h"
|
||||
|
||||
#define WFLYRF_FORCE_ID
|
||||
|
||||
//WFLYRF constants & variables
|
||||
#define WFLYRF_BIND_COUNT 2500
|
||||
|
||||
static void __attribute__((unused)) WFLYRF_send_packet()
|
||||
{
|
||||
//ID
|
||||
packet[1] = rx_tx_addr[0];
|
||||
packet[2] = rx_tx_addr[1];
|
||||
packet[3] = rx_tx_addr[2];
|
||||
packet[4] = rx_tx_addr[3];
|
||||
//unknown may be RX ID on some other remotes
|
||||
memset(packet+5,0xFF,4);
|
||||
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
{
|
||||
packet[ 0] = 0xBC; // bind indicator
|
||||
packet[ 9] &= 0x01;
|
||||
packet[ 9] ^= 0x01; // high/ low part of the RF table
|
||||
packet[10] = 0x00;
|
||||
//RF table
|
||||
for(uint8_t i=0; i<16;i++)
|
||||
packet[i+11]=hopping_frequency[i+(packet[9]<<4)];
|
||||
//unknwon
|
||||
packet[27] = 0x05;
|
||||
packet[28] = 0x00;
|
||||
memset(packet+29,0xFF,8);
|
||||
//frequency hop during bind
|
||||
if(packet[9])
|
||||
rf_ch_num=0x8C;
|
||||
else
|
||||
rf_ch_num=0x0D;
|
||||
}
|
||||
else
|
||||
{
|
||||
packet[ 0] = 0x58; // normal packet
|
||||
//14 channels: steering, throttle, ...
|
||||
for(uint8_t i = 0; i < 14; i++)
|
||||
{
|
||||
uint16_t temp=convert_channel_ppm(i);
|
||||
packet[9 + i*2]=temp&0xFF; // low byte of servo timing(1000-2000us)
|
||||
packet[10 + i*2]=(temp>>8)&0xFF; // high byte of servo timing(1000-2000us)
|
||||
}
|
||||
rf_ch_num=hopping_frequency[hopping_frequency_no];
|
||||
hopping_frequency_no++;
|
||||
packet[34] |= (hopping_frequency_no&0x0F)<<4;
|
||||
packet[36] |= (hopping_frequency_no&0xF0); // last byte is ending with F on the dumps so let's see
|
||||
hopping_frequency_no &= 0x1F;
|
||||
}
|
||||
#if 0
|
||||
debug("ch=%02X P=",rf_ch_num);
|
||||
for(uint8_t i=0; i<37; i++)
|
||||
debug("%02X ", packet[i]);
|
||||
debugln("");
|
||||
#endif
|
||||
A7105_WriteData(37, rf_ch_num);
|
||||
}
|
||||
|
||||
uint16_t ReadWFLYRF()
|
||||
{
|
||||
#ifndef FORCE_WFLYRF_TUNING
|
||||
A7105_AdjustLOBaseFreq(1);
|
||||
#endif
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
{
|
||||
bind_counter--;
|
||||
if (bind_counter==0)
|
||||
{
|
||||
BIND_DONE;
|
||||
if(sub_protocol==WFLYRF_HYPE)
|
||||
{
|
||||
A7105_WriteID(MProtocol_id);
|
||||
A7105_WriteReg(A7105_03_FIFOI,0x05);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(hopping_frequency_no==0)
|
||||
A7105_SetPower();
|
||||
#ifdef MULTI_SYNC
|
||||
telemetry_set_input_sync(packet_period);
|
||||
#endif
|
||||
}
|
||||
WFLYRF_send_packet();
|
||||
return packet_period;
|
||||
}
|
||||
|
||||
uint16_t initWFLYRF()
|
||||
{
|
||||
A7105_Init();
|
||||
|
||||
// compute channels from ID
|
||||
calc_fh_channels(sub_protocol==WFLYRF_FHSS?32:15);
|
||||
hopping_frequency_no=0;
|
||||
|
||||
#ifdef WFLYRF_FORCE_ID_FHSS
|
||||
if(sub_protocol==WFLYRF_FHSS)
|
||||
{
|
||||
memcpy(rx_tx_addr,"\x3A\x39\x37\x00",4);
|
||||
memcpy(hopping_frequency,"\x29\x4C\x67\x92\x31\x1C\x77\x18\x23\x6E\x81\x5C\x8F\x5A\x51\x94\x7A\x12\x45\x6C\x7F\x1E\x0D\x88\x63\x8C\x4F\x37\x26\x61\x2C\x8A",32);
|
||||
}
|
||||
#endif
|
||||
if(sub_protocol==WFLYRF_HYPE)
|
||||
{
|
||||
MProtocol_id &= 0x00FF00FF;
|
||||
rx_tx_addr[0] = 0xAF - (rx_tx_addr[1]&0x0F);
|
||||
rx_tx_addr[2] = 0xFF - rx_tx_addr[3];
|
||||
MProtocol_id |= (rx_tx_addr[0]<<24) + (rx_tx_addr[2]<<8);
|
||||
#ifdef WFLYRF_FORCE_ID_HYPE
|
||||
MProtocol_id=0xAF90738C;
|
||||
set_rx_tx_addr(MProtocol_id);
|
||||
memcpy(hopping_frequency,"\x27\x1B\x63\x75\x03\x39\x57\x69\x87\x0F\x7B\x3F\x33\x51\x6F",15);
|
||||
#endif
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
A7105_WriteID(0xAF00FF00);
|
||||
else
|
||||
{
|
||||
A7105_WriteID(MProtocol_id);
|
||||
A7105_WriteReg(A7105_03_FIFOI,0x05);
|
||||
}
|
||||
}
|
||||
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
bind_counter = WFLYRF_BIND_COUNT;
|
||||
|
||||
packet_sent=0;
|
||||
packet_period=3852; //FHSS
|
||||
return 2000;
|
||||
}
|
||||
#endif
|
@ -682,6 +682,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
E010
|
||||
H26WH
|
||||
PHOENIX
|
||||
PROTO_MLINK
|
||||
NONE
|
||||
PROTO_MT99XX
|
||||
MT99
|
||||
H7
|
||||
@ -750,6 +752,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
V911S_E119
|
||||
PROTO_WFLY
|
||||
NONE
|
||||
PROTO_WFLYRF
|
||||
NONE
|
||||
PROTO_WK2x01
|
||||
WK2801
|
||||
WK2401
|
||||
|
Loading…
x
Reference in New Issue
Block a user