mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 15:48:10 +00:00
Multi 5-in-1 initial support
This commit is contained in:
parent
0316c9eea9
commit
90b287f1f4
@ -1,96 +1,79 @@
|
|||||||
#if defined(FRSKYR9_SX1276_INO)
|
#if defined(FRSKYR9_SX1276_INO)
|
||||||
#include "iface_sx1276.h"
|
#include "iface_sx1276.h"
|
||||||
|
|
||||||
#define FREQ_MAP_SIZE 29
|
#define FREQ_MAP_SIZE 29
|
||||||
|
|
||||||
// TODO the channel spacing is equal, consider calculating the new channel instead of using lookup tables (first_chan + index * step)
|
uint8_t FrSkyR9_step = 1;
|
||||||
|
uint32_t FrSkyR9_freq_map[FREQ_MAP_SIZE];
|
||||||
|
|
||||||
static uint32_t FrSkyR9_freq_map_915[FREQ_MAP_SIZE] =
|
static void __attribute__((unused)) FrSkyR9_build_packet()
|
||||||
{
|
{
|
||||||
914472960,
|
//Header
|
||||||
914972672,
|
packet[0] = 0x3C; // unknown but constant
|
||||||
915472384,
|
|
||||||
915972096,
|
|
||||||
916471808,
|
|
||||||
916971520,
|
|
||||||
917471232,
|
|
||||||
917970944,
|
|
||||||
918470656,
|
|
||||||
918970368,
|
|
||||||
919470080,
|
|
||||||
919969792,
|
|
||||||
920469504,
|
|
||||||
920969216,
|
|
||||||
921468928,
|
|
||||||
921968640,
|
|
||||||
922468352,
|
|
||||||
922968064,
|
|
||||||
923467776,
|
|
||||||
923967488,
|
|
||||||
924467200,
|
|
||||||
924966912,
|
|
||||||
925466624,
|
|
||||||
925966336,
|
|
||||||
926466048,
|
|
||||||
926965760,
|
|
||||||
927465472,
|
|
||||||
|
|
||||||
// last two determined by FrSkyR9_step
|
//ID
|
||||||
0,
|
packet[1] = rx_tx_addr[3];
|
||||||
0
|
packet[2] = rx_tx_addr[2];
|
||||||
};
|
|
||||||
|
|
||||||
static uint32_t FrSkyR9_freq_map_868[FREQ_MAP_SIZE] =
|
//Hopping
|
||||||
{
|
packet[3] = hopping_frequency_no; // current channel index
|
||||||
859504640,
|
packet[4] = FrSkyR9_step; // step size and last 2 channels start index
|
||||||
860004352,
|
|
||||||
860504064,
|
|
||||||
861003776,
|
|
||||||
861503488,
|
|
||||||
862003200,
|
|
||||||
862502912,
|
|
||||||
863002624,
|
|
||||||
863502336,
|
|
||||||
864002048,
|
|
||||||
864501760,
|
|
||||||
865001472,
|
|
||||||
865501184,
|
|
||||||
866000896,
|
|
||||||
866500608,
|
|
||||||
867000320,
|
|
||||||
867500032,
|
|
||||||
867999744,
|
|
||||||
868499456,
|
|
||||||
868999168,
|
|
||||||
869498880,
|
|
||||||
869998592,
|
|
||||||
870498304,
|
|
||||||
870998016,
|
|
||||||
871497728,
|
|
||||||
871997440,
|
|
||||||
872497152,
|
|
||||||
|
|
||||||
// last two determined by FrSkyR9_step
|
//RX number
|
||||||
0,
|
packet[5] = RX_num; // receiver number from OpenTX
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
static uint8_t FrSkyR9_step = 1;
|
// Set packet[6]=failsafe, packet[7]=0?? and packet[8..19]=channels data
|
||||||
static uint32_t* FrSkyR9_freq_map = FrSkyR9_freq_map_915;
|
FrSkyX_channels(6);
|
||||||
|
|
||||||
|
//Bind
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
packet[6] = 0x41;
|
||||||
|
|
||||||
|
//SPort
|
||||||
|
packet[20] = 0x08; //FrSkyX_TX_Seq=8 at startup
|
||||||
|
packet[21] = 0x00; // length?
|
||||||
|
packet[22] = 0x00; // data1?
|
||||||
|
packet[23] = 0x00; // data2?
|
||||||
|
|
||||||
|
//CRC
|
||||||
|
uint16_t crc = FrSkyX_crc(packet, 24);
|
||||||
|
packet[24] = crc; // low byte
|
||||||
|
packet[25] = crc >> 8; // high byte
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t initFrSkyR9()
|
uint16_t initFrSkyR9()
|
||||||
{
|
{
|
||||||
set_rx_tx_addr(MProtocol_id_master);
|
set_rx_tx_addr(MProtocol_id_master);
|
||||||
|
|
||||||
if(sub_protocol & 0x01)
|
//FrSkyR9_step
|
||||||
FrSkyR9_freq_map = FrSkyR9_freq_map_868;
|
|
||||||
else
|
|
||||||
FrSkyR9_freq_map = FrSkyR9_freq_map_915;
|
|
||||||
|
|
||||||
FrSkyR9_step = 1 + (random(0xfefefefe) % 24);
|
FrSkyR9_step = 1 + (random(0xfefefefe) % 24);
|
||||||
FrSkyR9_freq_map[27] = FrSkyR9_freq_map[FrSkyR9_step];
|
debugln("Step=%d", FrSkyR9_step);
|
||||||
FrSkyR9_freq_map[28] = FrSkyR9_freq_map[FrSkyR9_step+1];
|
|
||||||
|
//Frequency table
|
||||||
|
uint32_t start_freq=914472960; //915
|
||||||
|
if(sub_protocol & 0x01)
|
||||||
|
start_freq=859504640; //868
|
||||||
|
for(uint8_t i=0;i<FREQ_MAP_SIZE-2;i++)
|
||||||
|
{
|
||||||
|
FrSkyR9_freq_map[i]=start_freq;
|
||||||
|
debugln("F%d=%lu", i, FrSkyR9_freq_map[i]);
|
||||||
|
start_freq+=0x7A000;
|
||||||
|
}
|
||||||
|
// Last two frequencies determined by FrSkyR9_step
|
||||||
|
FrSkyR9_freq_map[FREQ_MAP_SIZE-2] = FrSkyR9_freq_map[FrSkyR9_step];
|
||||||
|
debugln("F%d=%lu", FREQ_MAP_SIZE-2, FrSkyR9_freq_map[FREQ_MAP_SIZE-2]);
|
||||||
|
FrSkyR9_freq_map[FREQ_MAP_SIZE-1] = FrSkyR9_freq_map[FrSkyR9_step+1];
|
||||||
|
debugln("F%d=%lu", FREQ_MAP_SIZE-1, FrSkyR9_freq_map[FREQ_MAP_SIZE-1]);
|
||||||
|
hopping_frequency_no = 0;
|
||||||
|
|
||||||
|
//Set FrSkyFormat
|
||||||
|
if((sub_protocol & 0x02) == 0)
|
||||||
|
FrSkyFormat=0; // 16 channels
|
||||||
|
else
|
||||||
|
FrSkyFormat=1; // 8 channels
|
||||||
|
debugln("%dCH", FrSkyFormat&1 ? 8:16);
|
||||||
|
|
||||||
|
//SX1276 Init
|
||||||
SX1276_SetMode(true, false, SX1276_OPMODE_SLEEP);
|
SX1276_SetMode(true, false, SX1276_OPMODE_SLEEP);
|
||||||
SX1276_SetMode(true, false, SX1276_OPMODE_STDBY);
|
SX1276_SetMode(true, false, SX1276_OPMODE_STDBY);
|
||||||
|
|
||||||
@ -106,17 +89,16 @@ uint16_t initFrSkyR9()
|
|||||||
SX1276_SetPreambleLength(9);
|
SX1276_SetPreambleLength(9);
|
||||||
SX1276_SetDetectionThreshold(SX1276_MODEM_DETECTION_THRESHOLD_SF6);
|
SX1276_SetDetectionThreshold(SX1276_MODEM_DETECTION_THRESHOLD_SF6);
|
||||||
SX1276_SetLna(1, true);
|
SX1276_SetLna(1, true);
|
||||||
SX1276_SetHopPeriod(0); // 0 = disabled, we hope frequencies manually
|
SX1276_SetHopPeriod(0); // 0 = disabled, we hop frequencies manually
|
||||||
SX1276_SetPaDac(true);
|
SX1276_SetPaDac(true);
|
||||||
|
SX1276_SetTxRxMode(TX_EN); // Set RF switch to TX
|
||||||
|
|
||||||
hopping_frequency_no = 0;
|
return 20000; // start calling FrSkyR9_callback in 20 milliseconds
|
||||||
|
|
||||||
// TODO this can probably be shorter
|
|
||||||
return 20000; // start calling FrSkyR9_callback in 20 milliseconds
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t FrSkyR9_callback()
|
uint16_t FrSkyR9_callback()
|
||||||
{
|
{
|
||||||
|
//Force standby
|
||||||
SX1276_SetMode(true, false, SX1276_OPMODE_STDBY);
|
SX1276_SetMode(true, false, SX1276_OPMODE_STDBY);
|
||||||
|
|
||||||
//SX1276_WriteReg(SX1276_11_IRQFLAGSMASK, 0xbf); // use only RxDone interrupt
|
//SX1276_WriteReg(SX1276_11_IRQFLAGSMASK, 0xbf); // use only RxDone interrupt
|
||||||
@ -135,74 +117,28 @@ uint16_t FrSkyR9_callback()
|
|||||||
|
|
||||||
// SX1276_WriteReg(SX1276_01_OPMODE, 0x81); // STDBY
|
// SX1276_WriteReg(SX1276_01_OPMODE, 0x81); // STDBY
|
||||||
|
|
||||||
//SX1276_WriteReg(SX1276_09_PACONFIG, 0xF0);
|
// SX1276_WriteReg(SX1276_09_PACONFIG, 0xF0);
|
||||||
|
|
||||||
|
//Set power
|
||||||
// max power: 15dBm (10.8 + 0.6 * MaxPower [dBm])
|
// max power: 15dBm (10.8 + 0.6 * MaxPower [dBm])
|
||||||
// output_power: 2 dBm (17-(15-OutputPower) (if pa_boost_pin == true))
|
// output_power: 2 dBm (17-(15-OutputPower) (if pa_boost_pin == true))
|
||||||
SX1276_SetPaConfig(true, 7, 0);
|
SX1276_SetPaConfig(true, 7, 0);
|
||||||
SX1276_SetFrequency(FrSkyR9_freq_map[hopping_frequency_no]); // set current center frequency
|
|
||||||
|
|
||||||
delayMicroseconds(500);
|
//Set frequency
|
||||||
|
|
||||||
packet[0] = 0x3C; // ????
|
|
||||||
packet[1] = rx_tx_addr[3]; // unique radio id
|
|
||||||
packet[2] = rx_tx_addr[2]; // unique radio id
|
|
||||||
packet[3] = hopping_frequency_no; // current channel index
|
|
||||||
packet[4] = FrSkyR9_step; // step size and last 2 channels start index
|
|
||||||
packet[5] = RX_num; // receiver number from OpenTX
|
|
||||||
|
|
||||||
// binding mode: 0x00 regular / 0x41 bind?
|
|
||||||
if(IS_BIND_IN_PROGRESS)
|
|
||||||
packet[6] = 0x41;
|
|
||||||
else
|
|
||||||
packet[6] = 0x00;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
packet[7] = 0x00; // fail safe related (looks like the same sequence of numbers as FrskyX protocol)
|
|
||||||
|
|
||||||
// two channel are spread over 3 bytes.
|
|
||||||
// each channel is 11 bit + 1 bit (msb) that states whether
|
|
||||||
// it's part of the upper channels (9-16) or lower (1-8) (0 - lower 1 - upper)
|
|
||||||
|
|
||||||
#define CH_POS 8
|
|
||||||
static uint8_t chan_start=0;
|
|
||||||
uint8_t chan_index = chan_start;
|
|
||||||
|
|
||||||
for(int i = 0; i < 12; i += 3)
|
|
||||||
{
|
|
||||||
// map channel values (0-2047) to (64-1984)
|
|
||||||
uint16_t ch1 = FrSkyX_scaleForPXX(chan_index);
|
|
||||||
uint16_t ch2 = FrSkyX_scaleForPXX(chan_index + 1);
|
|
||||||
|
|
||||||
packet[CH_POS + i] = ch1;
|
|
||||||
packet[CH_POS + i + 1] = (ch1 >> 8) | (ch2 << 4);
|
|
||||||
packet[CH_POS + i + 2] = (ch2 >> 4);
|
|
||||||
|
|
||||||
chan_index += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((sub_protocol & 0x02) == 0)
|
|
||||||
chan_start ^= 0x08; // Alternate between lower and upper when 16 channels is used
|
|
||||||
|
|
||||||
packet[20] = 0x08; // ????
|
|
||||||
packet[21] = 0x00; // ????
|
|
||||||
packet[22] = 0x00; // ????
|
|
||||||
packet[23] = 0x00; // ????
|
|
||||||
|
|
||||||
uint16_t crc = FrSkyX_crc(packet, 24);
|
|
||||||
|
|
||||||
packet[24] = crc; // low byte
|
|
||||||
packet[25] = crc >> 8; // high byte
|
|
||||||
|
|
||||||
SX1276_WritePayloadToFifo(packet, 26);
|
|
||||||
|
|
||||||
hopping_frequency_no = (hopping_frequency_no + FrSkyR9_step) % FREQ_MAP_SIZE;
|
hopping_frequency_no = (hopping_frequency_no + FrSkyR9_step) % FREQ_MAP_SIZE;
|
||||||
|
SX1276_SetFrequency(FrSkyR9_freq_map[hopping_frequency_no]); // set current center frequency
|
||||||
|
delayMicroseconds(500); //Frequency settle time
|
||||||
|
|
||||||
|
//Build packet
|
||||||
|
FrSkyR9_build_packet();
|
||||||
|
|
||||||
|
//Send
|
||||||
|
SX1276_WritePayloadToFifo(packet, 26);
|
||||||
SX1276_SetMode(true, false, SX1276_OPMODE_TX);
|
SX1276_SetMode(true, false, SX1276_OPMODE_TX);
|
||||||
|
|
||||||
// need to clear RegIrqFlags?
|
// need to clear RegIrqFlags?
|
||||||
|
|
||||||
return 19400;
|
return 20000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_REVISION 1
|
#define VERSION_REVISION 1
|
||||||
#define VERSION_PATCH_LEVEL 12
|
#define VERSION_PATCH_LEVEL 13
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
|
@ -300,12 +300,12 @@ void setup()
|
|||||||
PORTE.DIRCLR = 0x02 ;
|
PORTE.DIRCLR = 0x02 ;
|
||||||
// Timer1 config
|
// Timer1 config
|
||||||
// TCC1 16-bit timer, clocked at 0.5uS
|
// TCC1 16-bit timer, clocked at 0.5uS
|
||||||
EVSYS.CH3MUX = 0x80 + 0x04 ; // Prescaler of 16
|
EVSYS.CH3MUX = 0x80 + 0x04 ; // Prescaler of 16
|
||||||
TCC1.CTRLB = 0; TCC1.CTRLC = 0; TCC1.CTRLD = 0; TCC1.CTRLE = 0;
|
TCC1.CTRLB = 0; TCC1.CTRLC = 0; TCC1.CTRLD = 0; TCC1.CTRLE = 0;
|
||||||
TCC1.INTCTRLA = 0; TIMSK1 = 0;
|
TCC1.INTCTRLA = 0; TIMSK1 = 0;
|
||||||
TCC1.PER = 0xFFFF ;
|
TCC1.PER = 0xFFFF ;
|
||||||
TCNT1 = 0 ;
|
TCNT1 = 0 ;
|
||||||
TCC1.CTRLA = 0x0B ; // Event3 (prescale of 16)
|
TCC1.CTRLA = 0x0B ; // Event3 (prescale of 16)
|
||||||
#elif defined STM32_BOARD
|
#elif defined STM32_BOARD
|
||||||
//STM32
|
//STM32
|
||||||
afio_cfg_debug_ports(AFIO_DEBUG_NONE);
|
afio_cfg_debug_ports(AFIO_DEBUG_NONE);
|
||||||
@ -322,7 +322,7 @@ void setup()
|
|||||||
pinMode(RX_INV_pin,OUTPUT);
|
pinMode(RX_INV_pin,OUTPUT);
|
||||||
#if defined TELEMETRY
|
#if defined TELEMETRY
|
||||||
#if defined INVERT_SERIAL
|
#if defined INVERT_SERIAL
|
||||||
TX_INV_on; //activate inverter for both serial TX and RX signals
|
TX_INV_on; // activate inverter for both serial TX and RX signals
|
||||||
RX_INV_on;
|
RX_INV_on;
|
||||||
#else
|
#else
|
||||||
TX_INV_off;
|
TX_INV_off;
|
||||||
@ -331,11 +331,20 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
pinMode(BIND_pin,INPUT_PULLUP);
|
pinMode(BIND_pin,INPUT_PULLUP);
|
||||||
pinMode(PPM_pin,INPUT);
|
pinMode(PPM_pin,INPUT);
|
||||||
pinMode(S1_pin,INPUT_PULLUP);//dial switch
|
pinMode(S1_pin,INPUT_PULLUP); // dial switch
|
||||||
pinMode(S2_pin,INPUT_PULLUP);
|
pinMode(S2_pin,INPUT_PULLUP);
|
||||||
pinMode(S3_pin,INPUT_PULLUP);
|
pinMode(S3_pin,INPUT_PULLUP);
|
||||||
pinMode(S4_pin,INPUT_PULLUP);
|
pinMode(S4_pin,INPUT_PULLUP);
|
||||||
|
|
||||||
|
#ifdef MULTI_5IN1_INTERNAL
|
||||||
|
//pinMode(SX1276_RST_pin,OUTPUT); // already done by LED2_pin
|
||||||
|
pinMode(SX1276_TXEN_pin,OUTPUT); // PB0
|
||||||
|
pinMode(SX1276_DIO0_pin,INPUT_PULLUP);
|
||||||
|
#else
|
||||||
|
//Random pin
|
||||||
|
pinMode(RND_pin, INPUT_ANALOG); // set up PB0 pin for analog input
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined ENABLE_DIRECT_INPUTS
|
#if defined ENABLE_DIRECT_INPUTS
|
||||||
#if defined (DI1_PIN)
|
#if defined (DI1_PIN)
|
||||||
pinMode(DI1_PIN,INPUT_PULLUP);
|
pinMode(DI1_PIN,INPUT_PULLUP);
|
||||||
@ -350,12 +359,9 @@ void setup()
|
|||||||
pinMode(DI4_PIN,INPUT_PULLUP);
|
pinMode(DI4_PIN,INPUT_PULLUP);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Random pins
|
|
||||||
pinMode(PB0, INPUT_ANALOG); // set up pin for analog input
|
|
||||||
|
|
||||||
//Timers
|
//Timers
|
||||||
init_HWTimer(); //0.5us
|
init_HWTimer(); //0.5us
|
||||||
#else
|
#else
|
||||||
//ATMEGA328p
|
//ATMEGA328p
|
||||||
// all inputs
|
// all inputs
|
||||||
@ -410,6 +416,10 @@ void setup()
|
|||||||
#ifdef NRF_CSN_pin
|
#ifdef NRF_CSN_pin
|
||||||
NRF_CSN_on;
|
NRF_CSN_on;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SPI_CSN_pin
|
||||||
|
SPI_CSN_on;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set SPI lines
|
// Set SPI lines
|
||||||
#ifdef STM32_BOARD
|
#ifdef STM32_BOARD
|
||||||
initSPI2();
|
initSPI2();
|
||||||
@ -473,7 +483,12 @@ void setup()
|
|||||||
#ifdef STM32_BOARD
|
#ifdef STM32_BOARD
|
||||||
uint32_t seed=0;
|
uint32_t seed=0;
|
||||||
for(uint8_t i=0;i<4;i++)
|
for(uint8_t i=0;i<4;i++)
|
||||||
seed=(seed<<8) | (analogRead(PB0)& 0xFF);
|
#ifdef RND_pin
|
||||||
|
seed=(seed<<8) | (analogRead(RND_pin)& 0xFF);
|
||||||
|
#else
|
||||||
|
//TODO find something to randomize...
|
||||||
|
seed=(seed<<8);
|
||||||
|
#endif
|
||||||
randomSeed(seed);
|
randomSeed(seed);
|
||||||
#else
|
#else
|
||||||
//Init the seed with a random value created from watchdog timer for all protocols requiring random values
|
//Init the seed with a random value created from watchdog timer for all protocols requiring random values
|
||||||
@ -597,8 +612,8 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
#endif //ENABLE_SERIAL
|
#endif //ENABLE_SERIAL
|
||||||
}
|
}
|
||||||
LED2_on;
|
|
||||||
debugln("Init complete");
|
debugln("Init complete");
|
||||||
|
LED2_on;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main
|
// Main
|
||||||
|
@ -223,6 +223,8 @@
|
|||||||
#define S3_pin PA6
|
#define S3_pin PA6
|
||||||
#define S4_pin PA7
|
#define S4_pin PA7
|
||||||
//
|
//
|
||||||
|
#define RND_pin PB0
|
||||||
|
//
|
||||||
#define PE1_pin PB4 //PE1
|
#define PE1_pin PB4 //PE1
|
||||||
#define PE2_pin PB5 //PE2
|
#define PE2_pin PB5 //PE2
|
||||||
//CS pins
|
//CS pins
|
||||||
@ -313,6 +315,20 @@
|
|||||||
#define DEBUG_PIN_toggle
|
#define DEBUG_PIN_toggle
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MULTI_5IN1_INTERNAL
|
||||||
|
#undef RND_pin
|
||||||
|
#define SX1276_RST_pin PA2 //LED2 on other modules
|
||||||
|
#define SX1276_TXEN_pin PB0 //Random gen on other modules
|
||||||
|
#define SX1276_DIO0_pin PC13 //Unused on other modules
|
||||||
|
|
||||||
|
#define SX1276_RST_on digitalWrite(SX1276_RST_pin,HIGH)
|
||||||
|
#define SX1276_RST_off digitalWrite(SX1276_RST_pin,LOW)
|
||||||
|
#define SX1276_TXEN_on digitalWrite(SX1276_TXEN_pin,HIGH)
|
||||||
|
#define SX1276_RXEN_on digitalWrite(SX1276_TXEN_pin,LOW)
|
||||||
|
#define IS_DIO0_on ( digitalRead(SX1276_DIO0_pin)==HIGH )
|
||||||
|
#define IS_DIO0_off ( digitalRead(SX1276_DIO0_pin)==LOW )
|
||||||
|
#endif
|
||||||
|
|
||||||
#define cli() noInterrupts()
|
#define cli() noInterrupts()
|
||||||
#define sei() interrupts()
|
#define sei() interrupts()
|
||||||
#define delayMilliseconds(x) delay(x)
|
#define delayMilliseconds(x) delay(x)
|
||||||
|
@ -33,18 +33,32 @@ void SX1276_WriteRegisterMulti(uint8_t address, const uint8_t* data, uint8_t len
|
|||||||
|
|
||||||
uint8_t SX1276_Reset()
|
uint8_t SX1276_Reset()
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO when pin is not wired
|
||||||
|
#ifdef SX1276_RST_pin
|
||||||
|
SX1276_RST_off;
|
||||||
|
delayMicroseconds(200);
|
||||||
|
SX1276_RST_on;
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SX1276_SetTxRxMode(uint8_t mode)
|
||||||
|
{
|
||||||
|
#ifdef SX1276_TXEN_pin
|
||||||
|
if(mode == TX_EN)
|
||||||
|
SX1276_TXEN_on;
|
||||||
|
else
|
||||||
|
SX1276_RXEN_on;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void SX1276_SetFrequency(uint32_t frequency)
|
void SX1276_SetFrequency(uint32_t frequency)
|
||||||
{
|
{
|
||||||
uint32_t f = frequency / 61;
|
uint32_t f = frequency / 61;
|
||||||
uint8_t data[3];
|
uint8_t data[3];
|
||||||
data[0] = (f & (0xFF << 16)) >> 16;
|
data[0] = f >> 16;
|
||||||
data[1] = (f & (0xFF << 8)) >> 8;
|
data[1] = f >> 8;
|
||||||
data[2] = f & 0xFF;
|
data[2] = f;
|
||||||
|
|
||||||
SX1276_WriteRegisterMulti(SX1276_06_FRFMSB, data, 3);
|
SX1276_WriteRegisterMulti(SX1276_06_FRFMSB, data, 3);
|
||||||
}
|
}
|
||||||
|
@ -185,12 +185,24 @@
|
|||||||
#undef CC25_CSN_pin
|
#undef CC25_CSN_pin
|
||||||
#undef NRF24L01_INSTALLED // Disable NRF for OrangeTX module
|
#undef NRF24L01_INSTALLED // Disable NRF for OrangeTX module
|
||||||
#undef NRF_CSN_pin
|
#undef NRF_CSN_pin
|
||||||
#undef SX1276_INSTALLED // Disable NRF for OrangeTX module
|
#undef SX1276_INSTALLED // Disable SX1276 for OrangeTX module
|
||||||
#define TELEMETRY // Enable telemetry
|
#define TELEMETRY // Enable telemetry
|
||||||
#define INVERT_TELEMETRY // Enable invert telemetry
|
#define INVERT_TELEMETRY // Enable invert telemetry
|
||||||
#define DSM_TELEMETRY // Enable DSM telemetry
|
#define DSM_TELEMETRY // Enable DSM telemetry
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//Change/Force RF chip configuration if MULTI_5IN1_INTERNAL
|
||||||
|
#ifdef MULTI_5IN1_INTERNAL
|
||||||
|
#if not defined(STM32_BOARD)
|
||||||
|
#error "Error MULTI_5IN1_INTERNAL is only for STM32 boards."
|
||||||
|
#endif
|
||||||
|
#define A7105_INSTALLED
|
||||||
|
#define CYRF6936_INSTALLED
|
||||||
|
#define CC2500_INSTALLED
|
||||||
|
#define NRF24L01_INSTALLED
|
||||||
|
#define SX1276_INSTALLED
|
||||||
|
#endif
|
||||||
|
|
||||||
//Make sure protocols are selected correctly
|
//Make sure protocols are selected correctly
|
||||||
#ifndef A7105_INSTALLED
|
#ifndef A7105_INSTALLED
|
||||||
#undef AFHDS2A_A7105_INO
|
#undef AFHDS2A_A7105_INO
|
||||||
|
@ -414,7 +414,7 @@ static uint16_t XN297Dump_callback()
|
|||||||
packet_count=0;
|
packet_count=0;
|
||||||
bind_counter=0;
|
bind_counter=0;
|
||||||
debugln("Time between CH:%d and CH:%d",hopping_frequency[0],hopping_frequency[hopping_frequency_no]);
|
debugln("Time between CH:%d and CH:%d",hopping_frequency[0],hopping_frequency[hopping_frequency_no]);
|
||||||
time_rf[hopping_frequency_no]=-1;
|
time_rf[hopping_frequency_no]=0xFFFFFFFF;
|
||||||
NRF24L01_WriteReg(NRF24L01_05_RF_CH,hopping_frequency[0]);
|
NRF24L01_WriteReg(NRF24L01_05_RF_CH,hopping_frequency[0]);
|
||||||
uint16_t timeL=TCNT1;
|
uint16_t timeL=TCNT1;
|
||||||
if(TIMER2_BASE->SR & TIMER_SR_UIF)
|
if(TIMER2_BASE->SR & TIMER_SR_UIF)
|
||||||
@ -504,7 +504,7 @@ static uint16_t XN297Dump_callback()
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
time=time_rf[i];
|
time=time_rf[i];
|
||||||
if(time!=-1)
|
if(time!=0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
next=i;
|
next=i;
|
||||||
for(uint8_t j=2;j<rf_ch_num;j++)
|
for(uint8_t j=2;j<rf_ch_num;j++)
|
||||||
|
@ -69,9 +69,10 @@
|
|||||||
/****************/
|
/****************/
|
||||||
/*** RF CHIPS ***/
|
/*** RF CHIPS ***/
|
||||||
/****************/
|
/****************/
|
||||||
//There are 4 RF components supported. If one of them is not installed you must comment it using "//".
|
//There are 5 RF components supported. If one of them is not installed you must comment it using "//".
|
||||||
//If a chip is not installed all associated protocols are automatically disabled.
|
//If a chip is not installed all associated protocols are automatically disabled.
|
||||||
//4-in-1 modules have all RF chips installed
|
//4-in-1 modules have the A7105, CYRF6936, CC2500 and NRF24L01 RF chips installed
|
||||||
|
//5-in-1 modules have all RF chips installed
|
||||||
//!!!If a RF chip is present it MUST be marked as installed!!! or weird things will happen you have been warned.
|
//!!!If a RF chip is present it MUST be marked as installed!!! or weird things will happen you have been warned.
|
||||||
#define A7105_INSTALLED
|
#define A7105_INSTALLED
|
||||||
#define CYRF6936_INSTALLED
|
#define CYRF6936_INSTALLED
|
||||||
@ -79,6 +80,10 @@
|
|||||||
#define NRF24L01_INSTALLED
|
#define NRF24L01_INSTALLED
|
||||||
//#define SX1276_INSTALLED // only supported on STM32 modules
|
//#define SX1276_INSTALLED // only supported on STM32 modules
|
||||||
|
|
||||||
|
//Uncomment (remove //) if you have an internal 5-in-1 Multi module.
|
||||||
|
//All components are considered to be installed and specifics to that module are automatically configured
|
||||||
|
//#define MULTI_5IN1_INTERNAL
|
||||||
|
|
||||||
/** OrangeRX TX **/
|
/** OrangeRX TX **/
|
||||||
//If you compile for the OrangeRX TX module you need to select the correct board type.
|
//If you compile for the OrangeRX TX module you need to select the correct board type.
|
||||||
//By default the compilation is done for the GREEN board, to switch to a BLUE board uncomment the line below by removing the "//"
|
//By default the compilation is done for the GREEN board, to switch to a BLUE board uncomment the line below by removing the "//"
|
||||||
|
@ -1512,7 +1512,11 @@ CH1|CH2|CH3|CH4|CH5
|
|||||||
# SX1276 RF Module
|
# SX1276 RF Module
|
||||||
|
|
||||||
## FRSKYR9 - *65*
|
## FRSKYR9 - *65*
|
||||||
Extended limits supported
|
Extended limits and failsafe supported.
|
||||||
|
|
||||||
|
**R9 RXs must be flashed with ACCST Flex.**
|
||||||
|
|
||||||
|
Telemetry and power adjustment not yet supported.
|
||||||
|
|
||||||
### Sub_protocol R9_915 - *0*
|
### Sub_protocol R9_915 - *0*
|
||||||
915MHz, 16 channels
|
915MHz, 16 channels
|
||||||
@ -1546,4 +1550,3 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
|||||||
|
|
||||||
## OpenLRS - *27*
|
## OpenLRS - *27*
|
||||||
This is a reservation for OpenLRSng which is using Multi's serial protocol for their modules: https://openlrsng.org/. On the Multi side there is no protocol affected on 27 so it's just ignored.
|
This is a reservation for OpenLRSng which is using Multi's serial protocol for their modules: https://openlrsng.org/. On the Multi side there is no protocol affected on 27 so it's just ignored.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user