mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-07-12 09:47:54 +00:00
Fixes
This commit is contained in:
parent
054d5c8f0b
commit
62f96c3105
@ -31,6 +31,9 @@ HardwareTimer timer(2);
|
|||||||
|
|
||||||
#ifdef XMEGA
|
#ifdef XMEGA
|
||||||
#undef ENABLE_PPM // Disable PPM for orange module
|
#undef ENABLE_PPM // Disable PPM for orange module
|
||||||
|
#undef A7105_INSTALLED // Disable A7105 for orange module
|
||||||
|
#undef CC2500_INSTALLED // Disable CC2500 for orange module
|
||||||
|
#undef NFR24L01_INSTALLED // Disable NRF for orange module
|
||||||
#endif
|
#endif
|
||||||
//Multiprotocol module configuration file
|
//Multiprotocol module configuration file
|
||||||
|
|
||||||
@ -40,8 +43,7 @@ uint32_t MProtocol_id_master;
|
|||||||
uint32_t Model_fixed_id=0;
|
uint32_t Model_fixed_id=0;
|
||||||
uint32_t fixed_id;
|
uint32_t fixed_id;
|
||||||
uint32_t blink=0;
|
uint32_t blink=0;
|
||||||
uint8_t prev_option;//change option value on the fly.
|
|
||||||
uint8_t prev_power=0xFD; // unused power value
|
|
||||||
//
|
//
|
||||||
uint16_t counter;
|
uint16_t counter;
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
@ -99,7 +101,9 @@ volatile uint16_t PPM_data[NUM_CHN];
|
|||||||
#ifdef INVERT_TELEMETRY
|
#ifdef INVERT_TELEMETRY
|
||||||
// enable bit bash for serial
|
// enable bit bash for serial
|
||||||
#ifndef STM32_board
|
#ifndef STM32_board
|
||||||
|
#ifndef XMEGA
|
||||||
#define BASH_SERIAL 1
|
#define BASH_SERIAL 1
|
||||||
|
#endif
|
||||||
#define INVERT_SERIAL 1
|
#define INVERT_SERIAL 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -118,6 +122,8 @@ uint8_t sub_protocol;
|
|||||||
uint8_t option;
|
uint8_t option;
|
||||||
uint8_t cur_protocol[2];
|
uint8_t cur_protocol[2];
|
||||||
uint8_t prev_protocol=0;
|
uint8_t prev_protocol=0;
|
||||||
|
uint8_t prev_option;//change option value on the fly.
|
||||||
|
uint8_t prev_power=0xFD; // unused power value
|
||||||
|
|
||||||
#ifdef STM32_board
|
#ifdef STM32_board
|
||||||
void PPM_decode();
|
void PPM_decode();
|
||||||
@ -142,7 +148,7 @@ uint8_t telemetry_counter=0;
|
|||||||
// Callback
|
// Callback
|
||||||
typedef uint16_t (*void_function_t) (void);//pointer to a function with no parameters which return an uint16_t integer
|
typedef uint16_t (*void_function_t) (void);//pointer to a function with no parameters which return an uint16_t integer
|
||||||
void_function_t remote_callback = 0;
|
void_function_t remote_callback = 0;
|
||||||
static void CheckTimer(uint16_t (*cb)(void));
|
//static void CheckTimer(uint16_t (*cb)(void));
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
void setup()
|
void setup()
|
||||||
@ -202,9 +208,9 @@ void setup()
|
|||||||
#else
|
#else
|
||||||
DDRD = (1<<CS_pin)|(1<<SDI_pin)|(1<<SCLK_pin)|(1<<CS_pin)|(1<< CC25_CSN_pin);
|
DDRD = (1<<CS_pin)|(1<<SDI_pin)|(1<<SCLK_pin)|(1<<CS_pin)|(1<< CC25_CSN_pin);
|
||||||
DDRC = (1<<CTRL1_pin)|(1<<CTRL2_pin); //output
|
DDRC = (1<<CTRL1_pin)|(1<<CTRL2_pin); //output
|
||||||
DDRC |= (1<<5);//RST pin A5(C5) CYRF output
|
DDRC |= (1<<CYRF_RST_pin);//RST pin A5(C5) CYRF output
|
||||||
DDRB = _BV(0)|_BV(1);
|
DDRB = _BV(0)|_BV(1);
|
||||||
PORTB = _BV(2)|_BV(3)|_BV(4)|_BV(5);//pullup 10,11,12 and bind button
|
PORTB = _BV(2)|_BV(3)|_BV(4)|_BV(BIND_pin);//pullup 10,11,12 and bind button
|
||||||
PORTC = _BV(0);//A0 high pullup
|
PORTC = _BV(0);//A0 high pullup
|
||||||
#ifdef DEBUG_TX
|
#ifdef DEBUG_TX
|
||||||
TX_SET_OUTPUT;
|
TX_SET_OUTPUT;
|
||||||
@ -224,10 +230,7 @@ void setup()
|
|||||||
SDI_on;
|
SDI_on;
|
||||||
SCK_off;
|
SCK_off;
|
||||||
#endif
|
#endif
|
||||||
//#ifdef XMEGA
|
|
||||||
// // SPI enable, master, prescale of 16
|
|
||||||
// SPID.CTRL = SPI_ENABLE_bm | SPI_MASTER_bm | SPI_PRESCALER0_bm ;
|
|
||||||
//#endif
|
|
||||||
// Set servos positions
|
// Set servos positions
|
||||||
for(uint8_t i=0;i<NUM_CHN;i++)
|
for(uint8_t i=0;i<NUM_CHN;i++)
|
||||||
Servo_data[i]=1500;
|
Servo_data[i]=1500;
|
||||||
@ -263,6 +266,7 @@ void setup()
|
|||||||
|
|
||||||
LED_OFF;
|
LED_OFF;
|
||||||
LED_SET_OUTPUT;
|
LED_SET_OUTPUT;
|
||||||
|
modules_reset();
|
||||||
// Read or create protocol id
|
// Read or create protocol id
|
||||||
MProtocol_id_master=random_id(10,false);
|
MProtocol_id_master=random_id(10,false);
|
||||||
|
|
||||||
@ -270,7 +274,7 @@ void setup()
|
|||||||
initSPI2();
|
initSPI2();
|
||||||
#endif
|
#endif
|
||||||
//Init RF modules
|
//Init RF modules
|
||||||
modules_reset();
|
|
||||||
//LED_ON;
|
//LED_ON;
|
||||||
//Protocol and interrupts initialization
|
//Protocol and interrupts initialization
|
||||||
#ifdef ENABLE_PPM
|
#ifdef ENABLE_PPM
|
||||||
|
Loading…
x
Reference in New Issue
Block a user