diff --git a/Multiprotocol/BUMBLEB_ccnrf.ino b/Multiprotocol/BUMBLEB_ccnrf.ino new file mode 100644 index 0000000..fe157a7 --- /dev/null +++ b/Multiprotocol/BUMBLEB_ccnrf.ino @@ -0,0 +1,196 @@ +/* + 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(BUMBLEB_CCNRF_INO) + +#include "iface_xn297.h" + +#define FORCE_BUMBLEB_ORIGINAL_ID +#define BUMBLEB_TELEM_DEBUG + +#define BUMBLEB_PACKET_PERIOD 10200 +#define BUMBLEB_RF_BIND_CHANNEL 42 +#define BUMBLEB_RF_NUM_CHANNELS 2 +#define BUMBLEB_PAYLOAD_SIZE 7 + +static void __attribute__((unused)) BUMBLEB_send_packet() +{ + packet[6] = 0x00; + if(IS_BIND_IN_PROGRESS) + { + packet[0] = rx_tx_addr[0]; + packet[1] = rx_tx_addr[1]; + packet[2] = 0x54; //??? + packet[3] = 0x58; //??? + hopping_frequency_no ^= 0x01; + packet[4] = hopping_frequency[hopping_frequency_no]; + } + else + { + //hopping frequency + XN297_Hopping(hopping_frequency_no); + hopping_frequency_no ^= 0x01; + packet[0] = 0x20 + |GET_FLAG(CH6_SW,0x80); // High rate + packet[1] = convert_channel_8b_limit_deadband(AILERON,0xBF,0xA0,0x81,40); // Aileron: Max values:BD..A0..82 + if(packet[1] < 0xA0) + packet[1] = 0x20 - packet[1]; // Reverse low part of aileron + packet[2] = convert_channel_8b(CH5)>>2; // 01..20..3F + if(CH7_SW) // Drive trim from aileron + { + uint8_t ch=convert_channel_8b(AILERON); + if(ch > 0x5A && ch < 0x80-0x07) + packet[2] = ch - 0x5A; + else if(ch < 0x5A) + { + if(ch < 0x5A-0x20) + packet[2] = 0; + else + packet[2] = ch - (0x5A-0x20); + } + else if(packet[1] == 0x89) + packet[2] = 0x20; + else if(ch > 0xA5) + { + if(ch > 0xA9+0x1F) + packet[2] = 0x3F; + else + packet[2] = ch - 0x89; + } + else if(ch > 0xA5-0x1F) + packet[2] = ch - (0xA5-0x1F-0x20); + } + else + packet[2] = convert_channel_8b(CH5)>>2; // 01..20..3F + packet[3] = convert_channel_8b(THROTTLE)>>2; // 00..3F + packet[4] = hopping_frequency[hopping_frequency_no]; + } + + packet[5] = packet[0]; + for(uint8_t i=1;iNRF24L01 PROTO_SCORPIO = 94, // =>CYRF6936 PROTO_BLUEFLY = 95, // =>CC2500 & NRF24L01 + PROTO_BUMBLEB = 96, // =>CC2500 & NRF24L01 PROTO_NANORF = 126, // =>NRF24L01 @@ -831,8 +832,9 @@ enum { #define FRSKYX2_CLONE_EEPROM_OFFSET 873 // (1) format + (3) TX ID, 4 bytes, end is 877 #define DSM_RX_EEPROM_OFFSET 877 // (4) TX ID + format, 5 bytes, end is 882 #define MOULDKG_EEPROM_OFFSET 882 // RX ID, 3 bytes per model, end is 882+64*3=1074 -#define DSM_CLONE_EEPROM_OFFSET 1074 // (4) TX ID, (1) Initialized, end is 1079 -//#define CONFIG_EEPROM_OFFSET 1079 // Current configuration of the multimodule +#define DSM_CLONE_EEPROM_OFFSET 1074 // (4) TX ID, (1) Initialized, end is 1079 +#define TRAXXAS_EEPROM_OFFSET 1079 // RX ID, 2 bytes per model id, end is 1079+128=1207 +//#define CONFIG_EEPROM_OFFSET 1207 // Current configuration of the multimodule /* STM32 Flash Size */ #ifndef DISABLE_FLASH_SIZE_CHECK diff --git a/Multiprotocol/Validate.h b/Multiprotocol/Validate.h index 4c34331..e805be8 100644 --- a/Multiprotocol/Validate.h +++ b/Multiprotocol/Validate.h @@ -341,6 +341,7 @@ #endif #if ( not defined(CC2500_INSTALLED) && not defined(NRF24L01_INSTALLED) ) || defined MULTI_EU #undef BLUEFLY_CCNRF_INO + #undef BUMBLEB_CCNRF_INO #undef GD00X_CCNRF_INO #undef KF606_CCNRF_INO #undef MJXQ_CCNRF_INO