diff --git a/Multiprotocol/Multi_Names.ino b/Multiprotocol/Multi_Names.ino index 7e848e3..f2b6e3c 100644 --- a/Multiprotocol/Multi_Names.ino +++ b/Multiprotocol/Multi_Names.ino @@ -86,6 +86,7 @@ const char STR_XN297DUMP[] ="XN297DP"; const char STR_FRSKYR9[] ="FrSkyR9"; const char STR_PROPEL[] ="Propel"; const char STR_SKYARTEC[] ="Skyartc"; +const char STR_TEST[] ="Test"; const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20"; const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501"; @@ -366,6 +367,9 @@ const mm_protocol_definition multi_protocols[] = { #endif #if defined(ZSX_NRF24L01_INO) {PROTO_ZSX, STR_ZSX, 1, STR_SUBTYPE_ZSX, OPTION_NONE }, + #endif + #if defined(TEST_CC2500_INO) + {PROTO_TEST, STR_TEST, 0, NO_SUBTYPE, OPTION_RFTUNE }, #endif {0x00, nullptr, 0, nullptr, 0 } }; diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index a2afa9b..adb8a4c 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -99,6 +99,8 @@ enum PROTOCOLS PROTO_DSM_RX = 70, // =>CYRF6936 PROTO_JJRC345 = 71, // =>NRF24L01 PROTO_Q90C = 72, // =>NRF24L01 or CC2500 + + PROTO_TEST = 127, // =>CC2500 }; enum Flysky diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index a5b42ba..21df352 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -1554,7 +1554,12 @@ static void protocol_init() remote_callback = Q90C_callback; break; #endif - + #if defined(TEST_CC2500_INO) + case PROTO_TEST: + next_callback=initTEST(); + remote_callback = TEST_callback; + break; + #endif #endif #ifdef SX1276_INSTALLED #if defined(FRSKYR9_SX1276_INO) diff --git a/Multiprotocol/Pelikan_a7105.ino b/Multiprotocol/Pelikan_a7105.ino index 44570e8..708e0b8 100644 --- a/Multiprotocol/Pelikan_a7105.ino +++ b/Multiprotocol/Pelikan_a7105.ino @@ -236,7 +236,7 @@ const uint8_t PROGMEM pelikan_hopp[][PELIKAN_NUM_RF_CHAN] = { }; #endif -#ifdef PELIKAN_LITE_FORCE_ID +#ifdef PELIKAN_LITE_FORCE_HOP const uint8_t PROGMEM pelikan_lite_hopp[][PELIKAN_NUM_RF_CHAN] = { { 0x46,0x2A,0x3E,0x5A,0x5C,0x24,0x4E,0x32,0x54,0x26,0x2C,0x34,0x56,0x1E,0x3A,0x3C,0x50,0x4A,0x2E,0x42,0x20,0x52,0x28,0x22,0x44,0x58,0x36,0x38,0x4C } }; diff --git a/Multiprotocol/TEST_cc2500.ino b/Multiprotocol/TEST_cc2500.ino new file mode 100644 index 0000000..e868a4f --- /dev/null +++ b/Multiprotocol/TEST_cc2500.ino @@ -0,0 +1,63 @@ +/* + 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 . + */ + +#if defined(TEST_CC2500_INO) + +#include "iface_nrf250k.h" + +#define TEST_INITIAL_WAIT 500 +#define TEST_PACKET_PERIOD 10000 +#define TEST_PAYLOAD_SIZE 10 +#define TEST_RF_NUM_CHANNELS 3 + +uint16_t TEST_callback() +{ + option=1; + if(phase) + XN297L_WritePayload(packet, TEST_PAYLOAD_SIZE); + else + { + if(Channel_data[CH5]CHANNEL_MAX_COMMAND) + hopping_frequency_no=2; + else + hopping_frequency_no=1; + XN297L_Hopping(hopping_frequency_no); + CC2500_WriteReg(CC2500_3E_PATABLE,convert_channel_8b(CH6)); + debugln("CH:%d, PWR:%d",hopping_frequency_no,convert_channel_8b(CH6)); + } + phase ^= 1; + return TEST_PACKET_PERIOD>>1; +} + +uint16_t initTEST() +{ + option=1; + + hopping_frequency[0]=0; + hopping_frequency[1]=40; + hopping_frequency[2]=80; + XN297L_Init(); + XN297L_HoppingCalib(TEST_RF_NUM_CHANNELS); // Calibrate all channels + XN297L_SetTXAddr((uint8_t*)"RADIO", 5); + hopping_frequency_no = 0; + phase=0; + for(uint8_t i=0; i