mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-10 16:18:13 +00:00
Renamed FrSky protocols to match with receivers
This commit is contained in:
parent
f0646dde32
commit
4daec3794e
@ -13,7 +13,7 @@
|
|||||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(FRSKY_CC2500_INO)
|
#if defined(FRSKYD_CC2500_INO)
|
||||||
|
|
||||||
#include "iface_cc2500.h"
|
#include "iface_cc2500.h"
|
||||||
|
|
@ -13,21 +13,21 @@
|
|||||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(FRSKY1_CC2500_INO)
|
#if defined(FRSKYV_CC2500_INO)
|
||||||
|
|
||||||
#define FRSKY1_BIND_COUNT 200
|
#define FRSKYV_BIND_COUNT 200
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FRSKY1_DATA1=0,
|
FRSKYV_DATA1=0,
|
||||||
FRSKY1_DATA2,
|
FRSKYV_DATA2,
|
||||||
FRSKY1_DATA3,
|
FRSKYV_DATA3,
|
||||||
FRSKY1_DATA4,
|
FRSKYV_DATA4,
|
||||||
FRSKY1_DATA5
|
FRSKYV_DATA5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#include "iface_cc2500.h"
|
#include "iface_cc2500.h"
|
||||||
const PROGMEM uint8_t FRSKY1_cc2500_conf[][2]={
|
const PROGMEM uint8_t FRSKYV_cc2500_conf[][2]={
|
||||||
{ CC2500_17_MCSM1, 0x0c },
|
{ CC2500_17_MCSM1, 0x0c },
|
||||||
{ CC2500_18_MCSM0, 0x18 },
|
{ CC2500_18_MCSM0, 0x18 },
|
||||||
{ CC2500_06_PKTLEN, 0xff },
|
{ CC2500_06_PKTLEN, 0xff },
|
||||||
@ -47,12 +47,12 @@ const PROGMEM uint8_t FRSKY1_cc2500_conf[][2]={
|
|||||||
{ CC2500_15_DEVIATN, 0x41 }
|
{ CC2500_15_DEVIATN, 0x41 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __attribute__((unused)) FRSKY1_init()
|
static void __attribute__((unused)) FRSKYV_init()
|
||||||
{
|
{
|
||||||
for(uint8_t i=0;i<17;i++)
|
for(uint8_t i=0;i<17;i++)
|
||||||
{
|
{
|
||||||
uint8_t reg=pgm_read_byte_near(&FRSKY1_cc2500_conf[i][0]);
|
uint8_t reg=pgm_read_byte_near(&FRSKYV_cc2500_conf[i][0]);
|
||||||
uint8_t val=pgm_read_byte_near(&FRSKY1_cc2500_conf[i][1]);
|
uint8_t val=pgm_read_byte_near(&FRSKYV_cc2500_conf[i][1]);
|
||||||
if(reg==CC2500_0C_FSCTRL0)
|
if(reg==CC2500_0C_FSCTRL0)
|
||||||
val=option;
|
val=option;
|
||||||
CC2500_WriteReg(reg,val);
|
CC2500_WriteReg(reg,val);
|
||||||
@ -71,7 +71,7 @@ static void __attribute__((unused)) FRSKY1_init()
|
|||||||
CC2500_Strobe(CC2500_SIDLE); // Go to idle...
|
CC2500_Strobe(CC2500_SIDLE); // Go to idle...
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t __attribute__((unused)) FRSKY1_crc8(uint8_t result, uint8_t *data, uint8_t len)
|
static uint8_t __attribute__((unused)) FRSKYV_crc8(uint8_t result, uint8_t *data, uint8_t len)
|
||||||
{
|
{
|
||||||
for(uint8_t i = 0; i < len; i++)
|
for(uint8_t i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
@ -85,15 +85,10 @@ static uint8_t __attribute__((unused)) FRSKY1_crc8(uint8_t result, uint8_t *data
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t __attribute__((unused)) FRSKY1_crc8_le(uint8_t init, uint8_t *data, uint8_t len)
|
static uint8_t __attribute__((unused)) FRSKYV_crc8_le(uint8_t *data, uint8_t len)
|
||||||
{
|
{
|
||||||
uint8_t result = 0;
|
uint8_t result = 0xD6;
|
||||||
|
|
||||||
for(uint8_t i = 0; i < 8; i++)
|
|
||||||
{
|
|
||||||
result = (result << 1) | (init & 0x01);
|
|
||||||
init >>= 1;
|
|
||||||
}
|
|
||||||
for(uint8_t i = 0; i < len; i++)
|
for(uint8_t i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
result = result ^ data[i];
|
result = result ^ data[i];
|
||||||
@ -106,7 +101,7 @@ static uint8_t __attribute__((unused)) FRSKY1_crc8_le(uint8_t init, uint8_t *dat
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) FRSKY1_build_bind_packet()
|
static void __attribute__((unused)) FRSKYV_build_bind_packet()
|
||||||
{
|
{
|
||||||
//0e 03 01 57 12 00 06 0b 10 15 1a 00 00 00 61
|
//0e 03 01 57 12 00 06 0b 10 15 1a 00 00 00 61
|
||||||
packet[0] = 0x0e; //Length
|
packet[0] = 0x0e; //Length
|
||||||
@ -123,10 +118,10 @@ static void __attribute__((unused)) FRSKY1_build_bind_packet()
|
|||||||
packet[11] = 0x00;
|
packet[11] = 0x00;
|
||||||
packet[12] = 0x00;
|
packet[12] = 0x00;
|
||||||
packet[13] = 0x00;
|
packet[13] = 0x00;
|
||||||
packet[14] = FRSKY1_crc8(0x93, packet, 14);
|
packet[14] = FRSKYV_crc8(0x93, packet, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t __attribute__((unused)) FRSKY1_calc_channel()
|
static uint8_t __attribute__((unused)) FRSKYV_calc_channel()
|
||||||
{
|
{
|
||||||
uint32_t temp=seed;
|
uint32_t temp=seed;
|
||||||
temp = (temp * 0xaa) % 0x7673;
|
temp = (temp * 0xaa) % 0x7673;
|
||||||
@ -134,7 +129,7 @@ static uint8_t __attribute__((unused)) FRSKY1_calc_channel()
|
|||||||
return (seed & 0xff) % 0x32;
|
return (seed & 0xff) % 0x32;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) FRSKY1_build_data_packet()
|
static void __attribute__((unused)) FRSKYV_build_data_packet()
|
||||||
{
|
{
|
||||||
uint8_t idx = 0; // transmit lower channels
|
uint8_t idx = 0; // transmit lower channels
|
||||||
|
|
||||||
@ -143,10 +138,10 @@ static void __attribute__((unused)) FRSKY1_build_data_packet()
|
|||||||
packet[2] = rx_tx_addr[2];
|
packet[2] = rx_tx_addr[2];
|
||||||
packet[3] = seed & 0xff;
|
packet[3] = seed & 0xff;
|
||||||
packet[4] = seed >> 8;
|
packet[4] = seed >> 8;
|
||||||
if (phase == FRSKY1_DATA1 || phase == FRSKY1_DATA3)
|
if (phase == FRSKYV_DATA1 || phase == FRSKYV_DATA3)
|
||||||
packet[5] = 0x0f;
|
packet[5] = 0x0f;
|
||||||
else
|
else
|
||||||
if(phase == FRSKY1_DATA2 || phase == FRSKY1_DATA4)
|
if(phase == FRSKYV_DATA2 || phase == FRSKYV_DATA4)
|
||||||
{
|
{
|
||||||
packet[5] = 0xf0;
|
packet[5] = 0xf0;
|
||||||
idx=4; // transmit upper channels
|
idx=4; // transmit upper channels
|
||||||
@ -159,14 +154,14 @@ static void __attribute__((unused)) FRSKY1_build_data_packet()
|
|||||||
packet[2*i + 6] = value & 0xff;
|
packet[2*i + 6] = value & 0xff;
|
||||||
packet[2*i + 7] = value >> 8;
|
packet[2*i + 7] = value >> 8;
|
||||||
}
|
}
|
||||||
packet[14] = FRSKY1_crc8(crc8, packet, 14);
|
packet[14] = FRSKYV_crc8(crc8, packet, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ReadFRSKY1()
|
uint16_t ReadFRSKYV()
|
||||||
{
|
{
|
||||||
if(IS_BIND_DONE_on)
|
if(IS_BIND_DONE_on)
|
||||||
{ // Normal operation
|
{ // Normal operation
|
||||||
uint8_t chan = FRSKY1_calc_channel();
|
uint8_t chan = FRSKYV_calc_channel();
|
||||||
CC2500_Strobe(CC2500_SIDLE);
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
if (option != prev_option)
|
if (option != prev_option)
|
||||||
{
|
{
|
||||||
@ -174,12 +169,12 @@ uint16_t ReadFRSKY1()
|
|||||||
prev_option=option;
|
prev_option=option;
|
||||||
}
|
}
|
||||||
CC2500_WriteReg(CC2500_0A_CHANNR, chan * 5 + 6);
|
CC2500_WriteReg(CC2500_0A_CHANNR, chan * 5 + 6);
|
||||||
FRSKY1_build_data_packet();
|
FRSKYV_build_data_packet();
|
||||||
|
|
||||||
if (phase == FRSKY1_DATA5)
|
if (phase == FRSKYV_DATA5)
|
||||||
{
|
{
|
||||||
CC2500_SetPower();
|
CC2500_SetPower();
|
||||||
phase = FRSKY1_DATA1;
|
phase = FRSKYV_DATA1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
phase++;
|
phase++;
|
||||||
@ -188,26 +183,26 @@ uint16_t ReadFRSKY1()
|
|||||||
return 9006;
|
return 9006;
|
||||||
}
|
}
|
||||||
// Bind mode
|
// Bind mode
|
||||||
FRSKY1_build_bind_packet();
|
FRSKYV_build_bind_packet();
|
||||||
CC2500_Strobe(CC2500_SIDLE);
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
CC2500_WriteReg(CC2500_0A_CHANNR, 0x00);
|
CC2500_WriteReg(CC2500_0A_CHANNR, 0x00);
|
||||||
CC2500_WriteData(packet, packet[0]+1);
|
CC2500_WriteData(packet, packet[0]+1);
|
||||||
binding_idx++;
|
binding_idx++;
|
||||||
if(binding_idx>=FRSKY1_BIND_COUNT)
|
if(binding_idx>=FRSKYV_BIND_COUNT)
|
||||||
BIND_DONE;
|
BIND_DONE;
|
||||||
return 53460;
|
return 53460;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t initFRSKY1()
|
uint16_t initFRSKYV()
|
||||||
{
|
{
|
||||||
//ID is 15 bits. Using rx_tx_addr[2] and rx_tx_addr[3] since we want to use RX_Num for model match
|
//ID is 15 bits. Using rx_tx_addr[2] and rx_tx_addr[3] since we want to use RX_Num for model match
|
||||||
rx_tx_addr[2]&=0x7F;
|
rx_tx_addr[2]&=0x7F;
|
||||||
crc8 = FRSKY1_crc8_le(0x6b, rx_tx_addr+2, 2);
|
crc8 = FRSKYV_crc8_le(rx_tx_addr+2, 2);
|
||||||
|
|
||||||
FRSKY1_init();
|
FRSKYV_init();
|
||||||
seed = 1;
|
seed = 1;
|
||||||
binding_idx=0;
|
binding_idx=0;
|
||||||
phase = FRSKY1_DATA1;
|
phase = FRSKYV_DATA1;
|
||||||
return 10000;
|
return 10000;
|
||||||
}
|
}
|
||||||
|
|
@ -31,7 +31,7 @@ enum PROTOCOLS
|
|||||||
MODE_SERIAL = 0, // Serial commands
|
MODE_SERIAL = 0, // Serial commands
|
||||||
MODE_FLYSKY = 1, // =>A7105
|
MODE_FLYSKY = 1, // =>A7105
|
||||||
MODE_HUBSAN = 2, // =>A7105
|
MODE_HUBSAN = 2, // =>A7105
|
||||||
MODE_FRSKY = 3, // =>CC2500
|
MODE_FRSKYD = 3, // =>CC2500
|
||||||
MODE_HISKY = 4, // =>NRF24L01
|
MODE_HISKY = 4, // =>NRF24L01
|
||||||
MODE_V2X2 = 5, // =>NRF24L01
|
MODE_V2X2 = 5, // =>NRF24L01
|
||||||
MODE_DSM = 6, // =>CYRF6936
|
MODE_DSM = 6, // =>CYRF6936
|
||||||
@ -53,7 +53,7 @@ enum PROTOCOLS
|
|||||||
MODE_J6PRO = 22, // =>CYRF6936
|
MODE_J6PRO = 22, // =>CYRF6936
|
||||||
MODE_FQ777 = 23, // =>NRF24L01
|
MODE_FQ777 = 23, // =>NRF24L01
|
||||||
MODE_ASSAN = 24, // =>NRF24L01
|
MODE_ASSAN = 24, // =>NRF24L01
|
||||||
MODE_FRSKY1 = 25 // =>CC2500
|
MODE_FRSKYV = 25 // =>CC2500
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Flysky
|
enum Flysky
|
||||||
@ -516,7 +516,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
=> Reserved 0
|
=> Reserved 0
|
||||||
Flysky 1
|
Flysky 1
|
||||||
Hubsan 2
|
Hubsan 2
|
||||||
Frsky 3
|
FrskyD 3
|
||||||
Hisky 4
|
Hisky 4
|
||||||
V2x2 5
|
V2x2 5
|
||||||
DSM 6
|
DSM 6
|
||||||
@ -538,7 +538,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
J6PRO 22
|
J6PRO 22
|
||||||
FQ777 23
|
FQ777 23
|
||||||
ASSAN 24
|
ASSAN 24
|
||||||
FRSKY1 25
|
FrskyV 25
|
||||||
BindBit=> 0x80 1=Bind/0=No
|
BindBit=> 0x80 1=Bind/0=No
|
||||||
AutoBindBit=> 0x40 1=Yes /0=No
|
AutoBindBit=> 0x40 1=Yes /0=No
|
||||||
RangeCheck=> 0x20 1=Yes /0=No
|
RangeCheck=> 0x20 1=Yes /0=No
|
||||||
|
@ -352,7 +352,7 @@ void Update_All()
|
|||||||
update_led_status();
|
update_led_status();
|
||||||
#if defined(TELEMETRY)
|
#if defined(TELEMETRY)
|
||||||
uint8_t protocol=cur_protocol[0]&0x1F;
|
uint8_t protocol=cur_protocol[0]&0x1F;
|
||||||
if( (protocol==MODE_FRSKY) || (protocol==MODE_HUBSAN) || (protocol==MODE_FRSKYX) || (protocol==MODE_DSM) )
|
if( (protocol==MODE_FRSKYD) || (protocol==MODE_HUBSAN) || (protocol==MODE_FRSKYX) || (protocol==MODE_DSM) )
|
||||||
TelemetryUpdate();
|
TelemetryUpdate();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -466,20 +466,20 @@ static void protocol_init()
|
|||||||
remote_callback = ReadHubsan;
|
remote_callback = ReadHubsan;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(FRSKY_CC2500_INO)
|
#if defined(FRSKYD_CC2500_INO)
|
||||||
case MODE_FRSKY:
|
case MODE_FRSKYD:
|
||||||
CTRL1_off; //antenna RF2
|
CTRL1_off; //antenna RF2
|
||||||
CTRL2_on;
|
CTRL2_on;
|
||||||
next_callback = initFrSky_2way();
|
next_callback = initFrSky_2way();
|
||||||
remote_callback = ReadFrSky_2way;
|
remote_callback = ReadFrSky_2way;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(FRSKY1_CC2500_INO)
|
#if defined(FRSKYV_CC2500_INO)
|
||||||
case MODE_FRSKY1:
|
case MODE_FRSKYV:
|
||||||
CTRL1_off; //antenna RF2
|
CTRL1_off; //antenna RF2
|
||||||
CTRL2_on;
|
CTRL2_on;
|
||||||
next_callback = initFRSKY1();
|
next_callback = initFRSKYV();
|
||||||
remote_callback = ReadFRSKY1;
|
remote_callback = ReadFRSKYV;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(FRSKYX_CC2500_INO)
|
#if defined(FRSKYX_CC2500_INO)
|
||||||
|
@ -108,7 +108,7 @@ void frsky_check_telemetry(uint8_t *pkt,uint8_t len)
|
|||||||
void frsky_link_frame()
|
void frsky_link_frame()
|
||||||
{
|
{
|
||||||
frame[0] = 0xFE;
|
frame[0] = 0xFE;
|
||||||
if ((cur_protocol[0]&0x1F)==MODE_FRSKY)
|
if ((cur_protocol[0]&0x1F)==MODE_FRSKYD)
|
||||||
{
|
{
|
||||||
compute_RSSIdbm();
|
compute_RSSIdbm();
|
||||||
frame[1] = pktt[3];
|
frame[1] = pktt[3];
|
||||||
@ -465,7 +465,7 @@ void TelemetryUpdate()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined HUB_TELEMETRY
|
#if defined HUB_TELEMETRY
|
||||||
if(!telemetry_link && (cur_protocol[0]&0x1F) == MODE_FRSKY)
|
if(!telemetry_link && (cur_protocol[0]&0x1F) == MODE_FRSKYD)
|
||||||
{ // FrSky
|
{ // FrSky
|
||||||
frsky_user_frame();
|
frsky_user_frame();
|
||||||
return;
|
return;
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
#define J6PRO_CYRF6936_INO
|
#define J6PRO_CYRF6936_INO
|
||||||
#endif
|
#endif
|
||||||
#ifdef CC2500_INSTALLED
|
#ifdef CC2500_INSTALLED
|
||||||
#define FRSKY_CC2500_INO
|
#define FRSKYD_CC2500_INO
|
||||||
#define FRSKY1_CC2500_INO
|
#define FRSKYV_CC2500_INO
|
||||||
#define FRSKYX_CC2500_INO
|
#define FRSKYX_CC2500_INO
|
||||||
#define SFHSS_CC2500_INO
|
#define SFHSS_CC2500_INO
|
||||||
#endif
|
#endif
|
||||||
@ -94,7 +94,7 @@
|
|||||||
#if defined FRSKYX_CC2500_INO
|
#if defined FRSKYX_CC2500_INO
|
||||||
#define SPORT_TELEMETRY
|
#define SPORT_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
#if defined FRSKY_CC2500_INO
|
#if defined FRSKYD_CC2500_INO
|
||||||
#define HUB_TELEMETRY
|
#define HUB_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -148,7 +148,7 @@ const PPM_Parameters PPM_prot[15]= {
|
|||||||
// Dial Protocol Sub protocol RX_Num Power Auto Bind Option
|
// Dial Protocol Sub protocol RX_Num Power Auto Bind Option
|
||||||
/* 1 */ {MODE_FLYSKY, Flysky , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
/* 1 */ {MODE_FLYSKY, Flysky , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||||
/* 2 */ {MODE_HUBSAN, 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
/* 2 */ {MODE_HUBSAN, 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||||
/* 3 */ {MODE_FRSKY , 0 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
|
/* 3 */ {MODE_FRSKYD , 0 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
|
||||||
/* 4 */ {MODE_HISKY , Hisky , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
/* 4 */ {MODE_HISKY , Hisky , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||||
/* 5 */ {MODE_V2X2 , 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
/* 5 */ {MODE_V2X2 , 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||||
/* 6 */ {MODE_DSM , DSM2 , 0 , P_HIGH , NO_AUTOBIND , 2 }, // option=2=6 channels @ 22ms
|
/* 6 */ {MODE_DSM , DSM2 , 0 , P_HIGH , NO_AUTOBIND , 2 }, // option=2=6 channels @ 22ms
|
||||||
@ -170,7 +170,7 @@ const PPM_Parameters PPM_prot[15]= {
|
|||||||
V912
|
V912
|
||||||
MODE_HUBSAN
|
MODE_HUBSAN
|
||||||
NONE
|
NONE
|
||||||
MODE_FRSKY
|
MODE_FRSKYD
|
||||||
NONE
|
NONE
|
||||||
MODE_HISKY
|
MODE_HISKY
|
||||||
Hisky
|
Hisky
|
||||||
@ -239,7 +239,7 @@ const PPM_Parameters PPM_prot[15]= {
|
|||||||
NONE
|
NONE
|
||||||
MODE_ASSAN
|
MODE_ASSAN
|
||||||
NONE
|
NONE
|
||||||
MODE_FRSKY1
|
MODE_FRSKYV
|
||||||
NONE
|
NONE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user