/* 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 . */ //****************** // Protocols //****************** enum PROTOCOLS { MODE_SERIAL = 0, // Serial commands MODE_FLYSKY = 1, // =>A7105 / FLYSKY protocol MODE_HUBSAN = 2, // =>A7105 / HUBSAN protocol MODE_FRSKY = 3, // =>CC2500 / FRSKY protocol MODE_HISKY = 4, // =>NRF24L01 / HISKY protocol MODE_V2X2 = 5, // =>NRF24L01 / V2x2 protocol MODE_DSM2 = 6, // =>CYRF6936 / DSM2 protocol MODE_DEVO =7, // =>CYRF6936 / DEVO protocol MODE_YD717 = 8, // =>NRF24L01 / YD717 protocol (CX10 red pcb) MODE_KN = 9, // =>NRF24L01 / KN protocol MODE_SYMAX = 10, // =>NRF24L01 / SYMAX protocol MODE_SLT = 11, // =>NRF24L01 / SLT protocol MODE_CX10 = 12, // =>NRF24L01 / CX-10 protocol MODE_CG023 = 13, // =>NRF24L01 / CG023 protocol MODE_BAYANG = 14, // =>NRF24L01 / BAYANG protocol MODE_FRSKYX = 15, // =>CC2500 / FRSKYX protocol MODE_ESKY = 16, // =>NRF24L01 / ESKY protocol }; enum Flysky { Flysky=0, V9X9=1, V6X6=2, V912=3 }; enum Hisky { Hisky=0, HK310=1 }; enum DSM2{ DSM2=0, DSMX=1 }; enum YD717 { YD717=0, SKYWLKR=1, SYMAX4=2, XINXUN=3, NIHUI=4 }; enum KN { WLTOYS=0, FEILUN=1 }; enum SYMAX { SYMAX=0, SYMAX5C=1 }; enum CX10 { CX10_GREEN = 0, CX10_BLUE=1, // also compatible with CX10-A, CX12 DM007=2, Q282=3, JC3015_1=4, JC3015_2=5, MK33041=6, Q242=7 }; enum CG023 { CG023 = 0, YD829 = 1, H8_3D = 2 }; #define NONE 0 #define P_HIGH 1 #define P_LOW 0 #define AUTOBIND 1 #define NO_AUTOBIND 0 struct PPM_Parameters { uint8_t protocol : 5; uint8_t sub_proto : 3; uint8_t rx_num : 4; uint8_t power : 1; uint8_t autobind : 1; uint8_t option; }; //******************* //*** Pinouts *** //******************* //#define BIND_pin 13 #define LED_pin 13 //Promini original led on B5 // #define PPM_pin 3 //PPM -D3 #define SDI_pin 5 //SDIO-D5 #define SCLK_pin 4 //SCK-D4 #define CS_pin 2 //CS-D2 #define SDO_pin 6 //D6 // #define CTRL1 1 //C1 (A1) #define CTRL2 2 //C2 (A2) // #define CTRL1_on PORTC |= _BV(1) #define CTRL1_off PORTC &= ~_BV(1) // #define CTRL2_on PORTC |= _BV(2) #define CTRL2_off PORTC &= ~_BV(2) // #define CS_on PORTD |= _BV(2) //D2 #define CS_off PORTD &= ~_BV(2) //D2 // #define SCK_on PORTD |= _BV(4) //D4 #define SCK_off PORTD &= ~_BV(4) //D4 // #define SDI_on PORTD |= _BV(5) //D5 #define SDI_off PORTD &= ~_BV(5) //D5 #define SDI_1 (PIND & (1< Reserved 0 Flysky 1 Hubsan 2 Frsky 3 Hisky 4 V2x2 5 DSM2 6 Devo 7 YD717 8 KN 9 SymaX 10 SLT 11 CX10 12 CG023 13 Bayang 14 FrskyX 15 ESky 16 BindBit=> 0x80 1=Bind/0=No AutoBindBit=> 0x40 1=Yes /0=No RangeCheck=> 0x20 1=Yes /0=No Stream[2] = RxNum | Power | Type; RxNum value is 0..15 (bits 0..3) Type is 0..7 <<4 (bit 4..6) sub_protocol==Flysky Flysky 0 V9x9 1 V6x6 2 V912 3 sub_protocol==Hisky Hisky 0 HK310 1 sub_protocol==DSM2 DSM2 0 DSMX 1 sub_protocol==YD717 YD717 0 SKYWLKR 1 SYMAX4 2 XINXUN 3 NIHUI 4 sub_protocol==KN WLTOYS 0 FEILUN 1 sub_protocol==SYMAX SYMAX 0 SYMAX5C 1 sub_protocol==CX10 CX10_GREEN 0 CX10_BLUE 1 // also compatible with CX10-A, CX12 DM007 2 Q282 3 JC3015_1 4 JC3015_2 5 MK33041 6 Q242 7 sub_protocol==CG023 CG023 0 YD829 1 H8_3D 2 Power value => 0x80 0=High/1=Low Stream[3] = option_protocol; option_protocol value is -127..127 Stream[4] to [25] = Channels 16 Channels on 11 bits (0..2047) 0 -125% 204 -100% 1024 0% 1843 +100% 2047 +125% Channels bits are concatenated to fit in 22 bytes like in SBUS protocol */