27 changed files with 1903 additions and 1771 deletions
-
12Multiprotocol/FrSkyD_cc2500.cpp
-
25Multiprotocol/FrSkyD_cc2500.h
-
26Multiprotocol/FrSkyV_cc2500.cpp
-
39Multiprotocol/FrSkyV_cc2500.h
-
42Multiprotocol/FrSkyX_cc2500.cpp
-
37Multiprotocol/FrSkyX_cc2500.h
-
977Multiprotocol/Multiprotocol.h
-
265Multiprotocol/Multiprotocol.ino
-
211Multiprotocol/TX_Def.h
-
363Multiprotocol/Validate.h
-
66Multiprotocol/cc2500_spi.cpp
-
33Multiprotocol/cc2500_spi.h
-
217Multiprotocol/common.cpp
-
77Multiprotocol/common.h
-
235Multiprotocol/config.cpp
-
371Multiprotocol/config.h
-
6Multiprotocol/debug.h
-
77Multiprotocol/input.cpp
-
44Multiprotocol/input.h
-
38Multiprotocol/inputs.ino
-
15Multiprotocol/pins.h
-
57Multiprotocol/spi.cpp
-
38Multiprotocol/spi.h
-
90Multiprotocol/state.cpp
-
27Multiprotocol/state.h
-
217Multiprotocol/tx_def.h
-
57config
@ -0,0 +1,25 @@ |
|||
/* |
|||
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 <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#ifndef _FRSKYD_CC2500_H_ |
|||
#define _FRSKYD_CC2500_H_ |
|||
|
|||
#include <stdint.h> |
|||
void frsky2way_init(uint8_t bind); |
|||
void frsky2way_build_bind_packet(); |
|||
void frsky2way_data_frame(void); |
|||
uint16_t initFrSky_2way(void); |
|||
uint16_t ReadFrSky_2way(void); |
|||
#endif |
@ -0,0 +1,39 @@ |
|||
/* |
|||
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 <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#ifndef _FRSKYV_CC2500_H_ |
|||
#define _FRSKYV_CC2500_H_ |
|||
|
|||
#define FRSKYV_BIND_COUNT 200 |
|||
#include <stdint.h> |
|||
#include "Multiprotocol.h" |
|||
|
|||
enum frskyv_data_e { |
|||
FRSKYV_DATA1=0, |
|||
FRSKYV_DATA2, |
|||
FRSKYV_DATA3, |
|||
FRSKYV_DATA4, |
|||
FRSKYV_DATA5 |
|||
}; |
|||
|
|||
uint8_t FRSKYV_crc8(uint8_t result, uint8_t *data, uint8_t len); |
|||
|
|||
uint8_t FRSKYV_crc8_le(uint8_t *data, uint8_t len); |
|||
void FRSKYV_build_bind_packet(void); |
|||
uint8_t FRSKYV_calc_channel(void); |
|||
void FRSKYV_build_data_packet(void); |
|||
uint16_t ReadFRSKYV(void); |
|||
uint16_t initFRSKYV(void); |
|||
#endif |
@ -0,0 +1,37 @@ |
|||
/* ************************** |
|||
* By Midelic on RCGroups * |
|||
************************** |
|||
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 <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#ifndef _FRSKYX_CC2500_H_ |
|||
#define _FRSKYX_CC2500_H_ |
|||
#include <stdint.h> |
|||
|
|||
#define FRX_FAILSAFE_TIMEOUT 1032 |
|||
#define FRX_FAILSAFE_TIME 1032 |
|||
|
|||
void frskyX_set_start(uint8_t ch); |
|||
void frskyX_init(void); |
|||
void frskyX_initialize_data(uint8_t adr); |
|||
uint16_t frskyX_CRCTable(uint8_t val); |
|||
uint16_t frskyX_crc_x(uint8_t *data, uint8_t len); |
|||
void frskyX_build_bind_packet(void); |
|||
uint16_t frskyX_scaleForPXX(uint8_t i); |
|||
uint16_t frskyX_scaleForPXX_FS(uint8_t i); |
|||
|
|||
void frskyX_data_frame(void); |
|||
uint16_t ReadFrSkyX(void); |
|||
uint16_t initFrSkyX(void); |
|||
#endif |
977
Multiprotocol/Multiprotocol.h
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,211 +0,0 @@ |
|||
// Turnigy PPM and channels |
|||
#if defined(TX_ER9X) |
|||
#define PPM_MAX_100 2012 // 100% |
|||
#define PPM_MIN_100 988 // 100% |
|||
#endif |
|||
|
|||
// Devo PPM and channels |
|||
#if defined(TX_DEVO7) |
|||
#define PPM_MAX_100 1920 // 100% |
|||
#define PPM_MIN_100 1120 // 100% |
|||
#endif |
|||
|
|||
// SPEKTRUM PPM and channels |
|||
#if defined(TX_SPEKTRUM) |
|||
#define PPM_MAX_100 1900 // 100% |
|||
#define PPM_MIN_100 1100 // 100% |
|||
#endif |
|||
|
|||
// HISKY |
|||
#if defined(TX_HISKY) |
|||
#define PPM_MAX_100 1920 // 100% |
|||
#define PPM_MIN_100 1120 // 100% |
|||
#endif |
|||
|
|||
// Multiplex MC2020 |
|||
#if defined(TX_MPX) |
|||
#define PPM_MAX_100 1950 // 100% |
|||
#define PPM_MIN_100 1250 // 100% |
|||
#endif |
|||
|
|||
// Walkera PL0811-01H |
|||
#if defined(TX_WALKERA) |
|||
#define PPM_MAX_100 1800 // 100% |
|||
#define PPM_MIN_100 1000 // 100% |
|||
#endif |
|||
|
|||
//Channel MIN MAX values |
|||
#define CHANNEL_MAX_100 1844 // 100% |
|||
#define CHANNEL_MIN_100 204 // 100% |
|||
#define CHANNEL_MAX_125 2047 // 125% |
|||
#define CHANNEL_MIN_125 0 // 125% |
|||
|
|||
#define CHANNEL_MIN_COMMAND 784 // 1350us |
|||
#define CHANNEL_SWITCH 1104 // 1550us |
|||
#define CHANNEL_MAX_COMMAND 1424 // 1750us |
|||
|
|||
//Channel definitions |
|||
#ifdef AETR |
|||
#define AILERON 0 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 3 |
|||
#endif |
|||
#ifdef AERT |
|||
#define AILERON 0 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef ARET |
|||
#define AILERON 0 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef ARTE |
|||
#define AILERON 0 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef ATRE |
|||
#define AILERON 0 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef ATER |
|||
#define AILERON 0 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 3 |
|||
#endif |
|||
|
|||
#ifdef EATR |
|||
#define AILERON 1 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 3 |
|||
#endif |
|||
#ifdef EART |
|||
#define AILERON 1 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef ERAT |
|||
#define AILERON 2 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef ERTA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef ETRA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef ETAR |
|||
#define AILERON 2 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 3 |
|||
#endif |
|||
|
|||
#ifdef TEAR |
|||
#define AILERON 2 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 3 |
|||
#endif |
|||
#ifdef TERA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef TREA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef TRAE |
|||
#define AILERON 2 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef TARE |
|||
#define AILERON 1 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef TAER |
|||
#define AILERON 1 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 3 |
|||
#endif |
|||
|
|||
#ifdef RETA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 0 |
|||
#endif |
|||
#ifdef REAT |
|||
#define AILERON 2 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 0 |
|||
#endif |
|||
#ifdef RAET |
|||
#define AILERON 1 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 0 |
|||
#endif |
|||
#ifdef RATE |
|||
#define AILERON 1 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 0 |
|||
#endif |
|||
#ifdef RTAE |
|||
#define AILERON 2 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 0 |
|||
#endif |
|||
#ifdef RTEA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 0 |
|||
#endif |
|||
|
|||
#define CH1 0 |
|||
#define CH2 1 |
|||
#define CH3 2 |
|||
#define CH4 3 |
|||
#define CH5 4 |
|||
#define CH6 5 |
|||
#define CH7 6 |
|||
#define CH8 7 |
|||
#define CH9 8 |
|||
#define CH10 9 |
|||
#define CH11 10 |
|||
#define CH12 11 |
|||
#define CH13 12 |
|||
#define CH14 13 |
|||
#define CH15 14 |
|||
#define CH16 15 |
@ -0,0 +1,77 @@ |
|||
/* |
|||
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 <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
#ifndef _COMMON_H_ |
|||
#define _COMMON_H_ |
|||
#include <stdint.h> |
|||
#include "config.h" |
|||
#include "tx_def.h" |
|||
|
|||
void InitFailsafe(void); |
|||
void InitPPM(void); |
|||
void InitChannel(void); |
|||
void reverse_channel(uint8_t num); |
|||
uint16_t convert_channel_ppm(uint8_t num); |
|||
uint16_t convert_channel_10b(uint8_t num); |
|||
uint8_t convert_channel_8b(uint8_t num); |
|||
int16_t convert_channel_16b_limit(uint8_t num, int16_t min, int16_t max); |
|||
int16_t convert_channel_16b_nolimit(uint8_t num, int16_t min, int16_t max); |
|||
uint8_t convert_channel_s8b(uint8_t num); |
|||
uint16_t limit_channel_100(uint8_t num); |
|||
void convert_channel_HK310(uint8_t num, uint8_t *low, uint8_t *high); |
|||
void convert_failsafe_HK310(uint8_t num, uint8_t *low, uint8_t *high); |
|||
uint16_t convert_channel_frsky(uint8_t num); |
|||
|
|||
/******************************/ |
|||
/** FrSky D and X routines **/ |
|||
/******************************/ |
|||
enum { |
|||
FRSKY_BIND = 0, |
|||
FRSKY_BIND_DONE = 1000, |
|||
FRSKY_DATA1, |
|||
FRSKY_DATA2, |
|||
FRSKY_DATA3, |
|||
FRSKY_DATA4, |
|||
FRSKY_DATA5 |
|||
}; |
|||
|
|||
void Frsky_init_hop(void); |
|||
/******************************/ |
|||
/** FrSky V, D and X routines **/ |
|||
/******************************/ |
|||
#if defined(FRSKYV_CC2500_INO) || defined(FRSKYD_CC2500_INO) || defined(FRSKYX_CC2500_INO) |
|||
|
|||
extern uint8_t FRSKY_common_startreg_cc2500_conf[]; |
|||
#if defined(FRSKYV_CC2500_INO) |
|||
extern uint8_t FRSKYV_cc2500_conf[]; |
|||
#endif |
|||
|
|||
#if defined(FRSKYD_CC2500_INO) |
|||
extern uint8_t FRSKYD_cc2500_conf[]; |
|||
#endif |
|||
|
|||
#if defined(FRSKYX_CC2500_INO) |
|||
extern uint8_t FRSKYX_cc2500_conf[]; |
|||
extern uint8_t FRSKYXEU_cc2500_conf[]; |
|||
#endif |
|||
|
|||
extern uint8_t FRSKY_common_end_cc2500_conf[][2]; |
|||
void FRSKY_init_cc2500(const uint8_t *ptr); |
|||
|
|||
#ifdef FAILSAFE_ENABLE |
|||
extern uint16_t Failsafe_data[NUM_CHN]; |
|||
#endif |
|||
#endif |
|||
|
|||
#endif |
@ -0,0 +1,235 @@ |
|||
/*
|
|||
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 <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
#include "config.h"
|
|||
uint8_t curr_bank = 0; |
|||
const PPM_Parameters PPM_prot[14*NBR_BANKS]= { |
|||
//****************************** BANK 1 ******************************
|
|||
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option
|
|||
/* 1 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 0 }, |
|||
/* 2 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 20 }, |
|||
/* 3 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 40 }, |
|||
/* 4 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 60 }, |
|||
/* 5 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 80 }, |
|||
/* 6 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 100 }, |
|||
/* 7 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 120 }, |
|||
/* 8 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 140 }, |
|||
/* 9 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 160 }, |
|||
/* 10 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 180 }, |
|||
/* 11 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 200 }, |
|||
/* 12 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 220 }, // option=fine freq tuning
|
|||
/* 13 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 240 }, |
|||
/* 14 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 255 }, |
|||
//****************************** BANK 2 ******************************
|
|||
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option
|
|||
/* 1 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , -120 }, |
|||
/* 2 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , -100 }, |
|||
/* 3 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , -80 }, |
|||
/* 4 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , -60 }, |
|||
/* 5 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , -40 }, |
|||
/* 6 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , -20 }, |
|||
/* 7 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , 0 }, |
|||
/* 8 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , 10 }, |
|||
/* 9 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , 20 }, |
|||
/* 10 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , 40 }, |
|||
/* 11 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , 60 }, |
|||
/* 12 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , 80 }, // option=fine freq tuning
|
|||
/* 13 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , 100 }, |
|||
/* 14 */ {PROTO_FRSKYX, EU_16 , 0 , P_LOW , AUTOBIND , 120 }, |
|||
//****************************** BANK 3 ******************************
|
|||
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option
|
|||
/* 1 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , -120 }, |
|||
/* 2 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , -100 }, |
|||
/* 3 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , -80 }, |
|||
/* 4 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , -60 }, |
|||
/* 5 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , -40 }, |
|||
/* 6 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , -20 }, |
|||
/* 7 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , 0 }, |
|||
/* 8 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , 10 }, |
|||
/* 9 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , 20 }, |
|||
/* 10 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , 40 }, |
|||
/* 11 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , 60 }, |
|||
/* 12 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , 80 }, // option=fine freq tuning
|
|||
/* 13 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , 100 }, |
|||
/* 14 */ {PROTO_FRSKYX, CH_16 , 0 , P_LOW , AUTOBIND , 120 }, |
|||
}; |
|||
/* Available protocols and associated sub protocols to pick and choose from
|
|||
PROTO_FLYSKY |
|||
Flysky |
|||
V9X9 |
|||
V6X6 |
|||
V912 |
|||
CX20 |
|||
PROTO_HUBSAN |
|||
H107 |
|||
H301 |
|||
H501 |
|||
PROTO_FRSKYV |
|||
NONE |
|||
PROTO_FRSKYD |
|||
NONE |
|||
PROTO_FRSKYX |
|||
CH_16 |
|||
CH_8 |
|||
EU_16 |
|||
EU_8 |
|||
PROTO_HISKY |
|||
Hisky |
|||
HK310 |
|||
PROTO_V2X2 |
|||
V2X2 |
|||
JXD506 |
|||
PROTO_DSM |
|||
DSM2_22 |
|||
DSM2_11 |
|||
DSMX_22 |
|||
DSMX_11 |
|||
PROTO_DEVO |
|||
NONE |
|||
PROTO_YD717 |
|||
YD717 |
|||
SKYWLKRP_LOW |
|||
SYMAX4 |
|||
XINXUN |
|||
NIHUI |
|||
PROTO_KN |
|||
WLTOYS |
|||
FEILUN |
|||
PROTO_SYMAX |
|||
SYMAX |
|||
SYMAX5C |
|||
PROTO_SLT |
|||
NONE |
|||
PROTO_CX10 |
|||
CX10_GREEN |
|||
CX10_BLUE |
|||
DM007 |
|||
JC3015_1 |
|||
JC3015_2 |
|||
MK33041 |
|||
PROTO_Q2X2 |
|||
Q222 |
|||
Q242 |
|||
Q282 |
|||
PROTO_SLT |
|||
SLT |
|||
VISTA |
|||
PROTO_CG023 |
|||
CG023 |
|||
YD829 |
|||
PROTO_BAYANG |
|||
BAYANG |
|||
H8S3D |
|||
X16_AH |
|||
IRDRONE |
|||
PROTO_ESKY |
|||
NONE |
|||
PROTO_MT99XX |
|||
MT99 |
|||
H7 |
|||
YZ |
|||
LS |
|||
FY805 |
|||
PROTO_MJXQ |
|||
WLH08 |
|||
X600 |
|||
X800 |
|||
H26D |
|||
E010 |
|||
H26WH |
|||
PROTO_SHENQI |
|||
NONE |
|||
PROTO_FY326 |
|||
FY326 |
|||
FY319 |
|||
PROTO_SFHSS |
|||
NONE |
|||
PROTO_J6PRO |
|||
NONE |
|||
PROTO_FQ777 |
|||
NONE |
|||
PROTO_ASSAN |
|||
NONE |
|||
PROTO_HONTAI |
|||
HONTAI |
|||
JJRCX1 |
|||
X5C1 |
|||
FQ777_951 |
|||
PROTO_AFHDS2A |
|||
PWM_IBUS |
|||
PPM_IBUS |
|||
PWM_SBUS |
|||
PPM_SBUS |
|||
PROTO_WK2x01 |
|||
WK2801 |
|||
WK2401 |
|||
W6_5_1 |
|||
W6_6_1 |
|||
W6_HEL |
|||
W6_HEL_I |
|||
PROTO_Q303 |
|||
Q303 |
|||
CX35 |
|||
CX10D |
|||
CX10WD |
|||
PROTO_GW008 |
|||
NONE |
|||
PROTO_DM002 |
|||
NONE |
|||
PROTO_CABELL |
|||
CABELL_V3 |
|||
CABELL_V3_TELEMETRY |
|||
CABELL_SET_FAIL_SAFE |
|||
CABELL_UNBIND |
|||
PROTO_ESKY150 |
|||
PROTO_H8_3D |
|||
H8_3D |
|||
H20H |
|||
H20MINI |
|||
H30MINI |
|||
PROTO_CORONA |
|||
COR_V1 |
|||
COR_V2 |
|||
FD_V3 |
|||
PROTO_CFLIE |
|||
NONE |
|||
PROTO_HITEC |
|||
OPT_FW |
|||
OPT_HUB |
|||
MINIMA |
|||
PROTO_WFLY |
|||
NONE |
|||
PROTO_BUGS |
|||
NONE |
|||
PROTO_SLT |
|||
SLT_V1 |
|||
SLT_V2 |
|||
Q100 |
|||
Q200 |
|||
MR100 |
|||
*/ |
|||
|
|||
// RX_Num is used for TX & RX match. Using different RX_Num values for each receiver will prevent starting a model with the false config loaded...
|
|||
// RX_Num value is between 0 and 15.
|
|||
|
|||
// Power P_HIGH or P_LOW: High or low power setting for the transmission.
|
|||
// For indoor P_LOW is more than enough.
|
|||
|
|||
// Auto Bind AUTOBIND or NO_AUTOBIND
|
|||
// For protocols which does not require binding at each power up (like Flysky, FrSky...), you might still want a bind to be initiated each time you power up the TX.
|
|||
// As an example, it's usefull for the WLTOYS F929/F939/F949/F959 (all using the Flysky protocol) which requires a bind at each power up.
|
|||
// It also enables the Bind from channel feature, allowing to execute a bind by toggling a designated channel.
|
|||
|
|||
// Option: the value is between -128 and +127.
|
|||
// The option value is only valid for some protocols, read this page for more information: https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/blob/master/Protocols_Details.md
|
@ -0,0 +1,77 @@ |
|||
#include "Arduino.h"
|
|||
#include <string.h>
|
|||
#include "config.h"
|
|||
#include "tx_def.h"
|
|||
#include "Multiprotocol.h"
|
|||
#include "input.h"
|
|||
#include "pins.h"
|
|||
#include "state.h"
|
|||
Input input; |
|||
|
|||
Input::Input(void) { |
|||
this->curr = &(this->input[0]); |
|||
this->old = &(this->input[1]); |
|||
memset(this->input,0, sizeof(this->input)); |
|||
} |
|||
void Input::mark_processed(void) { |
|||
struct data* temp = this->old; |
|||
this->old = this->curr; |
|||
this->curr = temp; |
|||
} |
|||
|
|||
struct Input::data* Input::get_curr_input(void) { |
|||
return this->curr; |
|||
} |
|||
|
|||
struct Input::data* Input::get_old_input(void) { |
|||
return this->old; |
|||
} |
|||
|
|||
void Input::update(void) { |
|||
this->curr->throttle = analogRead(Throttle_pin); |
|||
this->curr->yaw = analogRead(Yaw_pin); |
|||
this->curr->roll = analogRead(Roll_pin); |
|||
this->curr->pitch = analogRead(Pitch_pin); |
|||
|
|||
this->curr->aux[0] = digitalRead(Aux1_pin); |
|||
this->curr->aux[1] = digitalRead(Aux2_pin); |
|||
this->curr->aux[2] = digitalRead(Aux3_pin); |
|||
this->curr->aux[3] = digitalRead(Aux4_pin); |
|||
this->curr->aux[4] = digitalRead(Aux5_pin); |
|||
this->curr->aux[5] = digitalRead(Aux6_pin); |
|||
|
|||
this->curr->menu = digitalRead(Menu_pin); |
|||
|
|||
// only do channeloutpu if needed
|
|||
if (curr_state != s_fly) |
|||
return; |
|||
|
|||
Channel_data[THROTTLE] = map(this->curr->throttle, 0, 3500, CHANNEL_MIN_100, CHANNEL_MAX_100); |
|||
Channel_data[RUDDER] = map(this->curr->yaw, 0, 3500, CHANNEL_MIN_100, CHANNEL_MAX_100); |
|||
Channel_data[AILERON] = map(this->curr->roll, 0, 3500, CHANNEL_MIN_100, CHANNEL_MAX_100); |
|||
Channel_data[ELEVATOR] = map(this->curr->pitch, 0, 3500, CHANNEL_MIN_100, CHANNEL_MAX_100); |
|||
|
|||
for (uint8_t i = 0; i<6; ++i) { |
|||
if(this->curr->aux[i]) |
|||
Channel_data[CH5+i] = CHANNEL_MAX_100; |
|||
else |
|||
Channel_data[CH5+i] = CHANNEL_MIN_100; |
|||
} |
|||
} |
|||
|
|||
bool Input::menu_triggered(void) { |
|||
return false; |
|||
} |
|||
|
|||
bool Input::left_triggered(void) { |
|||
return false; |
|||
} |
|||
bool Input::right_triggered(void) { |
|||
return false; |
|||
} |
|||
bool Input::down_triggered(void) { |
|||
return false; |
|||
} |
|||
bool Input::up_triggered(void) { |
|||
return false; |
|||
} |
@ -0,0 +1,44 @@ |
|||
#ifndef _INPUT_H_ |
|||
#define _INPUT_H_ |
|||
#include <stdint.h> |
|||
#include "tx_def.h" |
|||
|
|||
class Input { |
|||
private: |
|||
struct data { |
|||
uint16_t throttle; |
|||
uint16_t yaw; |
|||
uint16_t roll; |
|||
uint16_t pitch; |
|||
|
|||
bool aux[6]; |
|||
|
|||
bool menu; |
|||
|
|||
}; |
|||
int curr_input; |
|||
public: |
|||
struct data input[2]; |
|||
struct data* curr; |
|||
struct data* old; |
|||
|
|||
Input(void); |
|||
void update(void); |
|||
|
|||
struct data* get_curr_input(void); |
|||
struct data* get_old_input(void); |
|||
void update_inputs(void); |
|||
void mark_processed(void); |
|||
|
|||
// menu inputs |
|||
bool menu_triggered(void); |
|||
|
|||
bool left_triggered(void); |
|||
bool right_triggered(void); |
|||
bool down_triggered(void); |
|||
bool up_triggered(void); |
|||
}; |
|||
|
|||
extern uint16_t Channel_data[NUM_CHN]; |
|||
extern Input input; |
|||
#endif |
@ -1,38 +0,0 @@ |
|||
void update_inputs(void) { |
|||
|
|||
INPUT_SIGNAL_on; |
|||
|
|||
if (state < FRSKY_BIND_DONE) |
|||
return; |
|||
|
|||
uint16_t throttle = analogRead(Throttle_pin); |
|||
uint16_t yaw = analogRead(Yaw_pin); |
|||
uint16_t roll = analogRead(Roll_pin); |
|||
uint16_t pitch = analogRead(Pitch_pin); |
|||
uint16_t aux1 = 0;//analogRead(Aux1_pin);
|
|||
uint16_t aux2 = analogRead(Aux2_pin); |
|||
|
|||
uint16_t ch_min=CHANNEL_MIN_100; |
|||
uint16_t ch_max=CHANNEL_MAX_100; |
|||
|
|||
|
|||
Channel_data[THROTTLE] += map(throttle, 0, 3500, ch_min, ch_max); |
|||
Channel_data[RUDDER] += map(yaw, 0, 3500, ch_min, ch_max); |
|||
Channel_data[AILERON] += map(roll, 0, 3500, ch_min, ch_max); |
|||
Channel_data[ELEVATOR] += map(pitch, 0, 3500, ch_min, ch_max); |
|||
//Channel_data[CH5] += map(aux1, 0, 3500, ch_min, ch_max);
|
|||
Channel_data[CH6] += map(aux2, 0, 3500, ch_min, ch_max); |
|||
|
|||
|
|||
Channel_data[THROTTLE] /= 2; |
|||
Channel_data[RUDDER] /= 2; |
|||
Channel_data[AILERON] /= 2; |
|||
Channel_data[ELEVATOR] /= 2; |
|||
Channel_data[CH5] /= 2; |
|||
Channel_data[CH6] /= 2; |
|||
|
|||
//debugln("T %d y %d r %d p %d a1 %d a2 %d",throttle,yaw,roll,pitch,aux1,aux2);
|
|||
//debugln("T %d y %d r %d p %d a1 %d a2 %d",Channel_data[THROTTLE],Channel_data[RUDDER],Channel_data[AILERON],Channel_data[ELEVATOR],Channel_data[CH5],Channel_data[CH6]);
|
|||
} |
|||
|
|||
|
@ -0,0 +1,57 @@ |
|||
/*
|
|||
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 <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
#include <stdint.h>
|
|||
#include "pins.h"
|
|||
#include "spi.h"
|
|||
|
|||
/********************/ |
|||
/** SPI routines **/ |
|||
/********************/ |
|||
void SPI_Write(uint8_t command) |
|||
{ |
|||
uint8_t n=8; |
|||
|
|||
SCLK_off;//SCK start low
|
|||
SDI_off; |
|||
do |
|||
{ |
|||
if(command&0x80) |
|||
SDI_on; |
|||
else |
|||
SDI_off; |
|||
SCLK_on; |
|||
//delay(1);
|
|||
command = command << 1; |
|||
SCLK_off; |
|||
} |
|||
while(--n) ; |
|||
SDI_on; |
|||
} |
|||
|
|||
uint8_t SPI_Read(void) |
|||
{ |
|||
uint8_t result=0,i; |
|||
for(i=0;i<8;i++) |
|||
{ |
|||
result=result<<1; |
|||
if(SDO_1) |
|||
result |= 0x01; |
|||
SCLK_on; |
|||
NOP(); |
|||
SCLK_off; |
|||
} |
|||
return result; |
|||
} |
|||
|
@ -0,0 +1,217 @@ |
|||
#ifndef _TX_DEV_H_ |
|||
#define _TX_DEV_H_ |
|||
|
|||
// Turnigy PPM and channels |
|||
#if defined(TX_ER9X) |
|||
#define PPM_MAX_100 2012 // 100% |
|||
#define PPM_MIN_100 988 // 100% |
|||
#endif |
|||
|
|||
// Devo PPM and channels |
|||
#if defined(TX_DEVO7) |
|||
#define PPM_MAX_100 1920 // 100% |
|||
#define PPM_MIN_100 1120 // 100% |
|||
#endif |
|||
|
|||
// SPEKTRUM PPM and channels |
|||
#if defined(TX_SPEKTRUM) |
|||
#define PPM_MAX_100 1900 // 100% |
|||
#define PPM_MIN_100 1100 // 100% |
|||
#endif |
|||
|
|||
// HISKY |
|||
#if defined(TX_HISKY) |
|||
#define PPM_MAX_100 1920 // 100% |
|||
#define PPM_MIN_100 1120 // 100% |
|||
#endif |
|||
|
|||
// Multiplex MC2020 |
|||
#if defined(TX_MPX) |
|||
#define PPM_MAX_100 1950 // 100% |
|||
#define PPM_MIN_100 1250 // 100% |
|||
#endif |
|||
|
|||
// Walkera PL0811-01H |
|||
#if defined(TX_WALKERA) |
|||
#define PPM_MAX_100 1800 // 100% |
|||
#define PPM_MIN_100 1000 // 100% |
|||
#endif |
|||
|
|||
//Channel MIN MAX values |
|||
#define CHANNEL_MAX_100 1844 // 100% |
|||
#define CHANNEL_MIN_100 204 // 100% |
|||
#define CHANNEL_MAX_125 2047 // 125% |
|||
#define CHANNEL_MIN_125 0 // 125% |
|||
|
|||
#define CHANNEL_MIN_COMMAND 784 // 1350us |
|||
#define CHANNEL_SWITCH 1104 // 1550us |
|||
#define CHANNEL_MAX_COMMAND 1424 // 1750us |
|||
|
|||
//Channel definitions |
|||
#ifdef AETR |
|||
#define AILERON 0 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 3 |
|||
#endif |
|||
#ifdef AERT |
|||
#define AILERON 0 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef ARET |
|||
#define AILERON 0 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef ARTE |
|||
#define AILERON 0 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef ATRE |
|||
#define AILERON 0 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef ATER |
|||
#define AILERON 0 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 3 |
|||
#endif |
|||
|
|||
#ifdef EATR |
|||
#define AILERON 1 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 3 |
|||
#endif |
|||
#ifdef EART |
|||
#define AILERON 1 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef ERAT |
|||
#define AILERON 2 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef ERTA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef ETRA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef ETAR |
|||
#define AILERON 2 |
|||
#define ELEVATOR 0 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 3 |
|||
#endif |
|||
|
|||
#ifdef TEAR |
|||
#define AILERON 2 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 3 |
|||
#endif |
|||
#ifdef TERA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef TREA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef TRAE |
|||
#define AILERON 2 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 1 |
|||
#endif |
|||
#ifdef TARE |
|||
#define AILERON 1 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 2 |
|||
#endif |
|||
#ifdef TAER |
|||
#define AILERON 1 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 0 |
|||
#define RUDDER 3 |
|||
#endif |
|||
|
|||
#ifdef RETA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 0 |
|||
#endif |
|||
#ifdef REAT |
|||
#define AILERON 2 |
|||
#define ELEVATOR 1 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 0 |
|||
#endif |
|||
#ifdef RAET |
|||
#define AILERON 1 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 3 |
|||
#define RUDDER 0 |
|||
#endif |
|||
#ifdef RATE |
|||
#define AILERON 1 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 2 |
|||
#define RUDDER 0 |
|||
#endif |
|||
#ifdef RTAE |
|||
#define AILERON 2 |
|||
#define ELEVATOR 3 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 0 |
|||
#endif |
|||
#ifdef RTEA |
|||
#define AILERON 3 |
|||
#define ELEVATOR 2 |
|||
#define THROTTLE 1 |
|||
#define RUDDER 0 |
|||
#endif |
|||
|
|||
#define CH1 0 |
|||
#define CH2 1 |
|||
#define CH3 2 |
|||
#define CH4 3 |
|||
#define CH5 4 |
|||
#define CH6 5 |
|||
#define CH7 6 |
|||
#define CH8 7 |
|||
#define CH9 8 |
|||
#define CH10 9 |
|||
#define CH11 10 |
|||
#define CH12 11 |
|||
#define CH13 12 |
|||
#define CH14 13 |
|||
#define CH15 14 |
|||
#define CH16 15 |
|||
#define NUM_CHN 16 |
|||
|
|||
#endif /* _TX_DEV_H_ */ |
@ -0,0 +1,57 @@ |
|||
resource MOTOR 1 A03 |
|||
resource MOTOR 2 B08 |
|||
resource MOTOR 3 A02 |
|||
resource MOTOR 4 B09 |
|||
resource PWM 1 D07 |
|||
resource PWM 2 C08 |
|||
resource PWM 3 K05 |
|||
resource PWM 4 D04 |
|||
resource PWM 5 B02 |
|||
resource PWM 7 B01 |
|||
resource PWM 8 A02 |
|||
|
|||
feature -RX_PPM |
|||
feature -OSD |
|||
feature RX_SERIAL |
|||
feature LED_STRIP |
|||
beeper -GPS_STATUS |
|||
beeper -ON_USB |
|||
beeper -CAM_CONNECTION_OPEN |
|||
beeper -CAM_CONNECTION_CLOSED |
|||
serial 2 64 115200 57600 0 115200 |
|||
led 0 1,0::CW:0 |
|||
led 1 0,0::CW:0 |
|||
aux 0 0 0 1650 2100 0 |
|||
aux 1 1 1 1600 2100 0 |
|||
aux 2 2 1 925 1400 0 |
|||
aux 3 27 0 1475 2100 0 |
|||
set acc_calibration = 46,25,-115 |
|||
set baro_hardware = NONE |
|||
set mid_rc = 1518 |
|||
set min_check = 1003 |
|||
set max_check = 1995 |
|||
set serialrx_provider = SBUS |
|||
set blackbox_device = NONE |
|||
set align_board_yaw = 270 |
|||
set bat_capacity = 750 |
|||
profile 0 |
|||
|
|||
profile 1 |
|||
|
|||
profile 2 |
|||
|
|||
profile 2 |
|||
rateprofile 0 |
|||
|
|||
rateprofile 1 |
|||
|
|||
rateprofile 2 |
|||
|
|||
rateprofile 3 |
|||
|
|||
rateprofile 4 |
|||
|
|||
rateprofile 5 |
|||
|
|||
rateprofile 0 |
|||
save |
Write
Preview
Loading…
Cancel
Save
Reference in new issue