/* 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(WL91X_CCNRF_INO) #include "iface_xn297.h" //#define FORCE_WL91X_ORIGINAL_ID #define WL91X_PAYLOAD_SIZE 9 #define WL91X_RF_NUM_CHANNELS 3 #define WL91X_PACKET_PERIOD 2594 static void __attribute__((unused)) WL91X_send_packet() { uint8_t val; //RF freq XN297_Hopping(hopping_frequency_no++); hopping_frequency_no %= WL91X_RF_NUM_CHANNELS; //Sticks val = convert_channel_16b_limit(CH2,0x21,0xE0); //THR forward 00..5F, backward 80..DF if(val < 128) val = 127 - val; packet[0] = val - 0x80; val = convert_channel_s8b(CH1); //ST right 00..7F, left 80..FF packet[1] = val - 0x80; //Trims val = convert_channel_s8b(CH3); //ST_Trim centered=80, increment/decrement=4, right 04..7C, left 84..FC packet[2] = val - 0x80; packet[3] = convert_channel_16b_limit(CH4,0x00,0x70); //TH_Trim increment/decrement=3, 00..39..6F //TX_ID memcpy(&packet[4], rx_tx_addr, 4); //Checksum val = 0; for(uint8_t i=0; i