2 This project is free software: you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation, either version 3 of the License, or
5 (at your option) any later version.
7 Multiprotocol is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
16 #if defined(JOYSWAY_A7105_INO)
18 #include "iface_a7105.h"
20 //#define JOYSWAY_FORCE_ID
22 static void __attribute__((unused)) JOYSWAY_send_packet()
24 static uint8_t next_ch = 0x30;
27 if (packet_count == 254)
30 A7105_WriteID(0x5475c52a);
33 else if (packet_count == 2)
35 A7105_WriteID(MProtocol_id);
40 if (packet_count & 0x01)
45 if (! (packet_count & 0x01))
53 packet[0] = packet_count == 0 ? 0xdd : 0xff;
55 packet[1] = rx_tx_addr[0];
56 packet[2] = rx_tx_addr[1];
57 packet[3] = rx_tx_addr[2];
58 packet[4] = rx_tx_addr[3];
61 for (uint8_t i = 0; i < 4; i++)
62 packet[ 6 + (i & 0x01) + ((i & 0x02)<<1)] = convert_channel_16b_limit(i, 0x00, 0xCC);
67 packet[14] = packet_count == 0 ? 0x30 : 0xaa;
70 for (uint8_t i = 0; i < 15; i++)
76 debug("ch=%02X P=",rf_ch_num);
77 for(uint8_t i=0; i<16; i++)
78 debug("%02X ", packet[i]);
81 A7105_WriteData(16, rf_ch_num);
86 uint16_t JOYSWAY_callback()
89 telemetry_set_input_sync(6000);
91 #ifndef FORCE_JOYSWAY_TUNING
92 A7105_AdjustLOBaseFreq(1);
95 JOYSWAY_send_packet();
101 BIND_DONE; // not a bind protocol
103 MProtocol_id &= 0x00FFFFFF;
104 MProtocol_id |= 0xF8000000;
105 #ifdef JOYSWAY_FORCE_ID
106 MProtocol_id = 0xf82dcaa0;
109 set_rx_tx_addr(MProtocol_id);