diff --git a/Multiprotocol/A7105_SPI.ino b/Multiprotocol/A7105_SPI.ino index 51b1847..1a25160 100644 --- a/Multiprotocol/A7105_SPI.ino +++ b/Multiprotocol/A7105_SPI.ino @@ -293,6 +293,14 @@ const uint8_t PROGMEM HUBSAN_A7105_regs[] = { 0xFF, 0xFF // 30 - 31 }; #endif +#ifdef PELIKAN_A7105_INO +const uint8_t PROGMEM PELIKAN_A7105_regs[] = { + 0xff, 0x42, 0x00, 0x0F, 0x00, 0xff, 0xff ,0x00, 0x00, 0x00, 0x00, 0x01, 0x21, 0xb7, 0x01, 0x50, // 00 - 0f + 0x96, 0x64, 0x00, 0x02, 0x16, 0x2f, 0x12, 0x00, 0x62, 0x80, 0x80, 0x00, 0x0a, 0x32, 0xc3, 0x07, // 10 - 1f + 0x16, 0x00, 0x00, 0xff, 0x00, 0x00, 0x3b, 0x00, 0x1b, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, // 20 - 2f + 0x01, 0x0f // 30 - 31 +}; +#endif #define ID_NORMAL 0x55201041 #define ID_PLUS 0xAA201041 @@ -309,6 +317,14 @@ void A7105_Init(void) } else #endif + #ifdef PELIKAN_A7105_INO + if(protocol==PROTO_PELIKAN) + { + A7105_Regs=(uint8_t*)PELIKAN_A7105_regs; + A7105_WriteID(0x06230623); + } + else + #endif #ifdef BUGS_A7105_INO if(protocol==PROTO_BUGS) A7105_Regs=(uint8_t*)BUGS_A7105_regs; @@ -391,6 +407,9 @@ void A7105_Init(void) case PROTO_FLYZONE: vco_calibration1=0x02; break; + case PROTO_PELIKAN: + vco_calibration1=0x0C; + break; default: vco_calibration1=0x0A; break; diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index 0e379c6..e07a4b8 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -56,4 +56,6 @@ 56,AFHDS2A_RX 57,HoTT 58,FX816,P38 -63,XN_DUMP,250K,1M,2M +59,Bayang_RX +60,Pelikan +63,XN_DUMP,250K,1M,2M,AUTO diff --git a/Multiprotocol/Multi_Names.ino b/Multiprotocol/Multi_Names.ino index 802eea2..a6a90ed 100644 --- a/Multiprotocol/Multi_Names.ino +++ b/Multiprotocol/Multi_Names.ino @@ -73,6 +73,7 @@ const char STR_AFHDS2A_RX[] ="FS2A_RX"; const char STR_HOTT[] ="HoTT"; const char STR_FX816[] ="FX816"; const char STR_BAYANG_RX[] ="BayanRX"; +const char STR_PELIKAN[] ="Pelikan"; const char STR_XN297DUMP[] ="XN297DP"; const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20"; @@ -110,7 +111,7 @@ const char STR_SUBTYPE_POTENSIC[] = "\x03""A20"; const char STR_SUBTYPE_ZSX[] = "\x07""280JJRC"; const char STR_SUBTYPE_FLYZONE[] = "\x05""FZ410"; const char STR_SUBTYPE_FX816[] = "\x03""P38"; -const char STR_SUBTYPE_XN297DUMP[] = "\x07""250Kbps""1Mbps\0 ""2Mbps\0 "; +const char STR_SUBTYPE_XN297DUMP[] = "\x07""250Kbps""1Mbps\0 ""2Mbps\0 ""Auto\0 "; const char STR_SUBTYPE_ESKY150[] = "\x03""4CH""7CH"; enum @@ -304,6 +305,9 @@ const mm_protocol_definition multi_protocols[] = { #if defined(BAYANG_RX_NRF24L01_INO) {PROTO_BAYANG_RX, STR_BAYANG_RX, 0, NO_SUBTYPE, OPTION_NONE }, #endif +#if defined(BAYANG_RX_NRF24L01_INO) + {PROTO_PELIKAN, STR_PELIKAN , 0, NO_SUBTYPE, OPTION_NONE }, +#endif #if defined(XN297DUMP_NRF24L01_INO) {PROTO_XN297DUMP, STR_XN297DUMP, 3, STR_SUBTYPE_XN297DUMP, OPTION_RFCHAN }, #endif diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 6bc00b4..462f528 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 0 -#define VERSION_PATCH_LEVEL 48 +#define VERSION_PATCH_LEVEL 49 //****************** // Protocols @@ -86,6 +86,7 @@ enum PROTOCOLS PROTO_HOTT = 57, // =>CC2500 PROTO_FX816 = 58, // =>NRF24L01 PROTO_BAYANG_RX = 59, // =>NRF24L01 + PROTO_PELIKAN = 60, // =>A7105 PROTO_XN297DUMP = 63, // =>NRF24L01 }; @@ -694,6 +695,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- HOTT 57 FX816 58 BAYANG_RX 59 + PELIKAN 60 BindBit=> 0x80 1=Bind/0=No AutoBindBit=> 0x40 1=Yes /0=No RangeCheck=> 0x20 1=Yes /0=No diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 545c717..022d719 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -1058,6 +1058,13 @@ static void protocol_init() remote_callback = AFHDS2A_Rx_callback; break; #endif + #if defined(PELIKAN_A7105_INO) + case PROTO_PELIKAN: + PE1_off; //antenna RF1 + next_callback = initPelikan(); + remote_callback = ReadPelikan; + break; + #endif #endif #ifdef CC2500_INSTALLED #if defined(FRSKYD_CC2500_INO) diff --git a/Multiprotocol/Pelikan_a7105.ino b/Multiprotocol/Pelikan_a7105.ino new file mode 100644 index 0000000..6386b22 --- /dev/null +++ b/Multiprotocol/Pelikan_a7105.ino @@ -0,0 +1,146 @@ +/* + 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 . + */ +// Compatible with CADET PRO V4 TX + +#if defined(PELIKAN_A7105_INO) + +#include "iface_a7105.h" + +#define PELIKAN_FORCE_ID + +#define PELIKAN_BIND_COUNT 400 +#define PELIKAN_BIND_RF 0x3C +#define PELIKAN_NUM_RF_CHAN 0x1D +#define PELIKAN_PAQUET_PERIOD 7980 + +static void __attribute__((unused)) pelikan_build_packet() +{ + static boolean upper=false; + packet[0] = 0x15; + if(IS_BIND_IN_PROGRESS) + { + packet[1] = 0x04; //version?? + packet[2] = rx_tx_addr[0]; + packet[3] = rx_tx_addr[1]; + packet[4] = rx_tx_addr[2]; + packet[5] = rx_tx_addr[3]; + packet[6] = 0x05; //?? + packet[7] = 0x00; //?? + packet[8] = 0x55; //?? + packet_length = 10; + } + else + { + //ID + packet[1] = rx_tx_addr[0]; + packet[7] = rx_tx_addr[1]; + packet[12] = rx_tx_addr[2]; + packet[13] = rx_tx_addr[3]; + //Channels + uint8_t offset=upper?4:0; + uint16_t channel=convert_channel_16b_nolimit(CH_AETR[offset++], 153, 871); + uint8_t top=(channel>>2) & 0xC0; + packet[2] = channel; + channel=convert_channel_16b_nolimit(CH_AETR[offset++], 153, 871); + top|=(channel>>4) & 0x30; + packet[3] = channel; + channel=convert_channel_16b_nolimit(CH_AETR[offset++], 153, 871); + top|=(channel>>6) & 0x0C; + packet[4] = channel; + channel=convert_channel_16b_nolimit(CH_AETR[offset], 153, 871); + top|=(channel>>8) & 0x03; + packet[5] = channel; + packet[6] = top; + //Check + crc8=0x15; + for(uint8_t i=1;i<8;i++) + crc8+=packet[i]; + packet[8]=crc8; + //Low/Up channel flag + packet[9]=upper?0xAA:0x00; + upper=!upper; + //Hopping counters + packet[11]=packet_count; + if(++packet_count>4) + { + packet_count=0; + if(++hopping_frequency_no>=PELIKAN_NUM_RF_CHAN) + hopping_frequency_no=0; + } + packet[10]=hopping_frequency_no; + + packet_length = 15; + } + + //Check + crc8=0x15; + for(uint8_t i=1; i