diff --git a/remote_multiprotocol/CC2500_SPI.ino b/Multiprotocol/CC2500_SPI.ino
similarity index 100%
rename from remote_multiprotocol/CC2500_SPI.ino
rename to Multiprotocol/CC2500_SPI.ino
diff --git a/remote_multiprotocol/Common.ino b/Multiprotocol/Common.ino
similarity index 100%
rename from remote_multiprotocol/Common.ino
rename to Multiprotocol/Common.ino
diff --git a/remote_multiprotocol/FrSkyD_cc2500.ino b/Multiprotocol/FrSkyD_cc2500.ino
similarity index 100%
rename from remote_multiprotocol/FrSkyD_cc2500.ino
rename to Multiprotocol/FrSkyD_cc2500.ino
diff --git a/remote_multiprotocol/FrSkyV_cc2500.ino b/Multiprotocol/FrSkyV_cc2500.ino
similarity index 100%
rename from remote_multiprotocol/FrSkyV_cc2500.ino
rename to Multiprotocol/FrSkyV_cc2500.ino
diff --git a/remote_multiprotocol/FrSkyX_cc2500.ino b/Multiprotocol/FrSkyX_cc2500.ino
similarity index 99%
rename from remote_multiprotocol/FrSkyX_cc2500.ino
rename to Multiprotocol/FrSkyX_cc2500.ino
index cb23485..d9bea04 100644
--- a/remote_multiprotocol/FrSkyX_cc2500.ino
+++ b/Multiprotocol/FrSkyX_cc2500.ino
@@ -332,8 +332,8 @@ uint16_t initFrSkyX()
FrX_chanskip=random(0xfefefefe)%47;
//for test***************
- //rx_tx_addr[3]=0xB3;
- //rx_tx_addr[2]=0xFD;
+ rx_tx_addr[3]=0xB3;
+ rx_tx_addr[2]=0xFD;
//************************
frskyX_init();
#if defined SPORT_POLLING
diff --git a/remote_multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h
similarity index 98%
rename from remote_multiprotocol/Multiprotocol.h
rename to Multiprotocol/Multiprotocol.h
index d9cfb4c..dfe7f8f 100644
--- a/remote_multiprotocol/Multiprotocol.h
+++ b/Multiprotocol/Multiprotocol.h
@@ -462,10 +462,10 @@ enum CC2500_POWER
CC2500_POWER_16 = 0xFE, // 0dbm
CC2500_POWER_17 = 0xFF // +1dbm
};
-#define CC2500_HIGH_POWER CC2500_POWER_17
-#define CC2500_LOW_POWER CC2500_POWER_13
+#define CC2500_HIGH_POWER CC2500_POWER_1
+#define CC2500_LOW_POWER CC2500_POWER_1
#define CC2500_RANGE_POWER CC2500_POWER_1
-#define CC2500_BIND_POWER CC2500_POWER_1
+#define CC2500_BIND_POWER CC2500_POWER_1
// CYRF power
enum CYRF_POWER
@@ -756,7 +756,8 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
[2] Type (see below)
[3] Length (excluding the 4 header bytes)
- [4-xx] data
+ [4-xx] data#define EEPROM_BANK_OFFSET 15 // Current bank number (1 byte)
+
Commands from TX to multi cannot be longer than 22 bytes (RXLen -4byte header)
diff --git a/remote_multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino
similarity index 87%
rename from remote_multiprotocol/Multiprotocol.ino
rename to Multiprotocol/Multiprotocol.ino
index 7bcd1c4..8b6b29d 100644
--- a/remote_multiprotocol/Multiprotocol.ino
+++ b/Multiprotocol/Multiprotocol.ino
@@ -20,7 +20,10 @@
You should have received a copy of the GNU General Public License
along with Multiprotocol. If not, see .
*/
+#if 0
#include
+#include
+#endif
//#define DEBUG_PIN // Use pin TX for AVR and SPI_CS for STM32 => DEBUG_PIN_on, DEBUG_PIN_off, DEBUG_PIN_toggle
#define DEBUG_SERIAL // Only for STM32_BOARD compiled with Upload method "Serial"->usart1, "STM32duino bootloader"->USB serial
@@ -38,8 +41,6 @@
#include "TX_Def.h"
#include "Validate.h"
-#include
-
//Global constants/variables
uint32_t MProtocol_id;//tx id,
uint32_t MProtocol_id_master;
@@ -134,20 +135,17 @@ void_function_t remote_callback = 0;
// Init
void setup()
{
-
- eeprom_write_byte((EE_ADDR)EEPROM_BANK_OFFSET,0x00); // set bank to 0
-
// Setup diagnostic uart before anything else
#ifdef DEBUG_SERIAL
Serial.begin(115200,SERIAL_8N1);
while (!Serial); // Wait for ever for the serial port to connect...
debugln("Multiprotocol version: %d.%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_PATCH_LEVEL);
+ debugln("time %s ", __TIME__);
#endif
// General pinout
//ATMEGA328p
// all inputs
- DDRB=0x00;DDRC=0x00;DDRD=0x00;
// outputs
SDI_output;
SCLK_output;
@@ -165,10 +163,6 @@ void setup()
NRF_CSN_output;
#endif
- // Timer1 config
- TCCR1A = 0;
- TCCR1B = (1 << CS11); //prescaler8, set timer1 to increment every 0.5us(16Mhz) and start timer
-
// Random
//random_init();
@@ -217,7 +211,7 @@ void setup()
char recieved = Serial.read();
if (recieved == '\n') {
int new_bank = atoi(str.c_str());
- eeprom_write_byte((EE_ADDR)EEPROM_BANK_OFFSET,new_bank);
+ curr_bank = new_bank;
debugln("Bank selection %d", new_bank);
break;
}else {
@@ -318,6 +312,7 @@ void setup()
#endif
option = PPM_prot[line].option; // Use radio-defined option value
+ debugln("freq offset: %d", option);
if(PPM_prot[line].power) POWER_FLAG_on;
if(PPM_prot[line].autobind)
{
@@ -371,68 +366,24 @@ void loop()
}
while(remote_callback==0 || IS_WAIT_BIND_on);
}
- #ifndef STM32_BOARD
- if( (TIFR1 & OCF1A_bm) != 0)
- {
- cli(); // Disable global int due to RW of 16 bits registers
- OCR1A=TCNT1; // Callback should already have been called... Use "now" as new sync point.
- sei(); // Enable global int
- }
- else
- while((TIFR1 & OCF1A_bm) == 0); // Wait before callback
- #else
-
- #endif
-
+
do
{
TX_MAIN_PAUSE_on;
tx_pause();
+ unsigned long last_call = millis();
if(IS_INPUT_SIGNAL_on && remote_callback!=0)
next_callback=remote_callback();
else
next_callback=2000; // No PPM/serial signal check again in 2ms...
- #if 0
- delayMilliseconds(next_callback);
- #else
- TX_MAIN_PAUSE_off;
- tx_resume();
- while(next_callback>4000)
- { // start to wait here as much as we can...
- next_callback-=2000; // We will wait below for 2ms
- cli(); // Disable global int due to RW of 16 bits registers
- OCR1A += 2000*2 ; // set compare A for callback
- #ifndef STM32_BOARD
- TIFR1=OCF1A_bm; // clear compare A=callback flag
- #else
- TIMER2_BASE->SR = 0x1E5F & ~TIMER_SR_CC1IF; // Clear Timer2/Comp1 interrupt flag
- #endif
- sei(); // enable global int
- if(Update_All()) // Protocol changed?
- {
- next_callback=0; // Launch new protocol ASAP
- debugln("%s:%d Launch new protocol ASAP ",__func__, __LINE__);
- break;
- }
- #ifndef STM32_BOARD
- while((TIFR1 & OCF1A_bm) == 0); // wait 2ms...
- #else
- while((TIMER2_BASE->SR & TIMER_SR_CC1IF)==0);//2ms wait
- #endif
- }
- // at this point we have a maximum of 4ms in next_callback
- next_callback *= 2 ;
- cli(); // Disable global int due to RW of 16 bits registers
- OCR1A+= next_callback ; // set compare A for callback
- #ifndef STM32_BOARD
- TIFR1=OCF1A_bm; // clear compare A=callback flag
- #else
- TIMER2_BASE->SR = 0x1E5F & ~TIMER_SR_CC1IF; // Clear Timer2/Comp1 interrupt flag
- #endif
- diff=OCR1A-TCNT1; // compare timer and comparator
-
- sei(); // enable global int
- #endif
+
+ unsigned long update_start = millis();
+ update_inputs();
+ unsigned long update_end = millis();
+
+ //debugln("diff = %d", update_end - update_start);
+ //next_abs_call = last_call + next_callback;
+ delayMilliseconds(next_callback / 1000);
}
while(diff&0x8000); // Callback did not took more than requested time for next callback
// so we can launch Update_All before next callback
@@ -455,7 +406,7 @@ uint8_t Update_All()
val=map16b(val,PPM_MIN_100*2,PPM_MAX_100*2,CHANNEL_MIN_100,CHANNEL_MAX_100);
if(val&0x8000) val=CHANNEL_MIN_125;
else if(val>CHANNEL_MAX_125) val=CHANNEL_MAX_125;
- Channel_data[i]=val;
+ //Channel_data[i]=val;
}
PPM_FLAG_off; // wait for next frame before update
update_channels_aux();
@@ -525,10 +476,10 @@ static void update_channels_aux(void)
#ifdef ENABLE_PPM
uint8_t bank_switch(void)
{
- uint8_t bank=eeprom_read_byte((EE_ADDR)EEPROM_BANK_OFFSET);
+ uint8_t bank= curr_bank;
if(bank>=NBR_BANKS)
{ // Wrong number of bank
- eeprom_write_byte((EE_ADDR)EEPROM_BANK_OFFSET,0x00); // set bank to 0
+ curr_bank = 0; // set bank to 0
bank=0;
}
debugln("Using bank %d", bank);
@@ -573,7 +524,7 @@ uint8_t bank_switch(void)
bank++;
if(bank>=NBR_BANKS)
bank=0;
- eeprom_write_byte((EE_ADDR)EEPROM_BANK_OFFSET,bank);
+ curr_bank = bank;
debugln("Using bank %d", bank);
phase=3;
blink+=BLINK_BANK_REPEAT;
@@ -688,20 +639,11 @@ static void protocol_init()
WAIT_BIND_off;
CHANGE_PROTOCOL_FLAG_off;
- if(next_callback>32000)
{ // next_callback should not be more than 32767 so we will wait here...
uint16_t temp=(next_callback>>10)-2;
delayMilliseconds(temp);
next_callback-=temp<<10; // between 2-3ms left at this stage
}
- cli(); // disable global int
- OCR1A = TCNT1 + next_callback*2; // set compare A for callback
- #ifndef STM32_BOARD
- TIFR1 = OCF1A_bm ; // clear compare A flag
- #else
- TIMER2_BASE->SR = 0x1E5F & ~TIMER_SR_CC1IF; // Clear Timer2/Comp1 interrupt flag
- #endif
- sei(); // enable global int
BIND_BUTTON_FLAG_off; // do not bind/reset id anymore even if protocol change
debugln("%s BIND_BUTTON_FLAG_off",__func__);
@@ -1001,7 +943,8 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
#ifndef FORCE_GLOBAL_ID
uint32_t id=0;
- if(eeprom_read_byte((EE_ADDR)(address+10))==0xf0 && !create_new)
+ #if 0
+ //(eeprom_read_byte((EE_ADDR)(address+10))==0xf0 && !create_new)
{ // TXID exists in EEPROM
for(uint8_t i=4;i>0;i--)
{
@@ -1024,11 +967,14 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
}
else
#endif
+ #endif
id = random(0xfefefefe) + ((uint32_t)random(0xfefefefe) << 16);
+ #if 0
for(uint8_t i=0;i<4;i++)
eeprom_write_byte((EE_ADDR)address+i,id >> (i*8));
eeprom_write_byte((EE_ADDR)(address+10),0xf0);//write bind flag in eeprom.
+ #endif
return id;
#else
(void)address;
@@ -1044,7 +990,7 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
/**************************/
//PPM
-#ifdef ENABLE_PPM
+#ifdef blubber // ENABLE_PPM
#ifdef ORANGE_TX
#if PPM_pin == 2
ISR(PORTD_INT0_vect)
@@ -1194,44 +1140,4 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
}
#endif //ENABLE_SERIAL
-#if not defined (ORANGE_TX) && not defined (STM32_BOARD)
- static void random_init(void)
- {
- cli(); // Temporarily turn off interrupts, until WDT configured
- MCUSR = 0; // Use the MCU status register to reset flags for WDR, BOR, EXTR, and POWR
- WDTCSR |= _BV(WDCE); // WDT control register, This sets the Watchdog Change Enable (WDCE) flag, which is needed to set the prescaler
- WDTCSR = _BV(WDIE); // Watchdog interrupt enable (WDIE)
- sei(); // Turn interupts on
- }
-
- static uint32_t random_value(void)
- {
- while (!gWDT_entropy);
- return gWDT_entropy;
- }
- // Random interrupt service routine called every time the WDT interrupt is triggered.
- // It is only enabled at startup to generate a seed.
- ISR(WDT_vect)
- {
- static uint8_t gWDT_buffer_position=0;
- #define gWDT_buffer_SIZE 32
- static uint8_t gWDT_buffer[gWDT_buffer_SIZE];
- gWDT_buffer[gWDT_buffer_position] = TCNT1L; // Record the Timer 1 low byte (only one needed)
- gWDT_buffer_position++; // every time the WDT interrupt is triggered
- if (gWDT_buffer_position >= gWDT_buffer_SIZE)
- {
- // The following code is an implementation of Jenkin's one at a time hash
- for(uint8_t gWDT_loop_counter = 0; gWDT_loop_counter < gWDT_buffer_SIZE; ++gWDT_loop_counter)
- {
- gWDT_entropy += gWDT_buffer[gWDT_loop_counter];
- gWDT_entropy += (gWDT_entropy << 10);
- gWDT_entropy ^= (gWDT_entropy >> 6);
- }
- gWDT_entropy += (gWDT_entropy << 3);
- gWDT_entropy ^= (gWDT_entropy >> 11);
- gWDT_entropy += (gWDT_entropy << 15);
- WDTCSR = 0; // Disable Watchdog interrupt
- }
- }
-#endif
diff --git a/Multiprotocol/Pins.h b/Multiprotocol/Pins.h
new file mode 100644
index 0000000..2e1adbe
--- /dev/null
+++ b/Multiprotocol/Pins.h
@@ -0,0 +1,99 @@
+/*
+ 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 .
+ */
+//*******************
+//*** Pinouts ***
+//*******************
+#if 0
+ // SDIO MOSI
+ #define SDI_pin 2 //D5 = PD5
+ #define SDI_port PORTB
+ #define SDI_ipr PINB
+ #define SDI_ddr DDRB
+ #define SDI_on SDI_port |= _BV(SDI_pin)
+ #define SDI_off SDI_port &= ~_BV(SDI_pin)
+ #define SDI_1 (SDI_ipr & _BV(SDI_pin))
+ #define SDI_0 (SDI_ipr & _BV(SDI_pin)) == 0x00
+ #define SDI_input SDI_ddr &= ~_BV(SDI_pin)
+ #define SDI_output SDI_ddr |= _BV(SDI_pin)
+
+ //SDO / MISO
+ #define SDO_pin 3 //D6 = PD6
+ #define SDO_port PORTB
+ #define SDO_ipr PINB
+ #define SDO_1 (SDO_ipr & _BV(SDO_pin))
+ #define SDO_0 (SDO_ipr & _BV(SDO_pin)) == 0x00
+
+ // SCLK
+ #define SCLK_port PORTB
+ #define SCLK_ddr DDRB
+ #define SCLK_pin 1 //D4 = PD4
+ #define SCLK_output SCLK_ddr |= _BV(SCLK_pin)
+ #define SCLK_on SCLK_port |= _BV(SCLK_pin)
+ #define SCLK_off SCLK_port &= ~_BV(SCLK_pin)
+
+ // Chip select CC2500
+ #define CC25_CSN_pin 7 //D7 = PD7
+ #define CC25_CSN_port PORTE
+ #define CC25_CSN_ddr DDRE
+ #define CC25_CSN_output CC25_CSN_ddr |= _BV(CC25_CSN_pin)
+ #define CC25_CSN_on CC25_CSN_port |= _BV(CC25_CSN_pin)
+ #define CC25_CSN_off CC25_CSN_port &= ~_BV(CC25_CSN_pin)
+
+//*******************
+//*** Timer ***
+//*******************
+#define OCF1A_bm _BV(OCF1A)
+#define OCF1B_bm _BV(OCF1B)
+#define SET_TIMSK1_OCIE1B TIMSK1 |= _BV(OCIE1B)
+#define CLR_TIMSK1_OCIE1B TIMSK1 &=~_BV(OCIE1B)
+#else
+ // SDIO MOSI
+ #define SDI_pin 26
+ #define SDI_on digitalWrite(SDI_pin, HIGH)
+ #define SDI_off digitalWrite(SDI_pin, LOW)
+ #define SDI_1 (digitalRead(SDI_pin) == HIGH)
+ #define SDI_0 (digitalRead(SDI_pin) == LOW)
+ #define SDI_input pinMode(SDI_pin, INPUT);
+ #define SDI_output pinMode(SDI_pin, OUTPUT);
+
+ //SDO / MISO
+ #define SDO_pin 25
+ #define SDO_on digitalWrite(SDO_pin, HIGH)
+ #define SDO_off digitalWrite(SDO_pin, LOW)
+ #define SDO_1 (digitalRead(SDO_pin) == HIGH)
+ #define SDO_0 (digitalRead(SDO_pin) == LOW)
+ #define SDO_input pinMode(SDO_pin, INPUT);
+ #define SDO_output pinMode(SDO_pin, OUTPUT);
+
+ // SCLK
+ #define SCLK_pin 33
+ #define SCLK_on digitalWrite(SCLK_pin, HIGH)
+ #define SCLK_off digitalWrite(SCLK_pin, LOW)
+ #define SCLK_1 (digitalRead(SCLK_pin) == HIGH)
+ #define SCLK_0 (digitalRead(SCLK_pin) == LOW)
+ #define SCLK_input pinMode(SCLK_pin, INPUT);
+ #define SCLK_output pinMode(SCLK_pin, OUTPUT);
+
+ // Chip select CC2500
+ #define CC25_CSN_pin 32
+ #define CC25_CSN_on digitalWrite(CC25_CSN_pin, HIGH)
+ #define CC25_CSN_off digitalWrite(CC25_CSN_pin, LOW)
+ #define CC25_CSN_1 (digitalRead(CC25_CSN_pin) == HIGH)
+ #define CC25_CSN_0 (digitalRead(CC25_CSN_pin) == LOW)
+ #define CC25_CSN_input pinMode(CC25_CSN_pin, INPUT);
+ #define CC25_CSN_output pinMode(CC25_CSN_pin, OUTPUT);
+#endif
+//*******************
+//*** EEPROM ***
+//*******************
+#define EE_ADDR uint8_t*
diff --git a/remote_multiprotocol/SPI.ino b/Multiprotocol/SPI.ino
similarity index 100%
rename from remote_multiprotocol/SPI.ino
rename to Multiprotocol/SPI.ino
diff --git a/remote_multiprotocol/TX_Def.h b/Multiprotocol/TX_Def.h
similarity index 100%
rename from remote_multiprotocol/TX_Def.h
rename to Multiprotocol/TX_Def.h
diff --git a/remote_multiprotocol/Validate.h b/Multiprotocol/Validate.h
similarity index 98%
rename from remote_multiprotocol/Validate.h
rename to Multiprotocol/Validate.h
index 5e56df6..bd682aa 100644
--- a/remote_multiprotocol/Validate.h
+++ b/Multiprotocol/Validate.h
@@ -5,7 +5,7 @@
#if not defined (ORANGE_TX) && not defined (STM32_BOARD)
//Atmega328p
#if (not defined(ARDUINO_AVR_PRO) && not defined(ARDUINO_AVR_LEONARDO) )&& not defined(ARDUINO_MULTI_NO_BOOT) && not defined(ARDUINO_MULTI_FLASH_FROM_TX) && not defined(ARDUINO_AVR_MINI) && not defined(ARDUINO_AVR_NANO)
- #error You must select one of these boards: "Multi 4-in-1", "Arduino Pro or Pro Mini" or "Arduino Mini"
+ #warning You must select one of these boards: "Multi 4-in-1", "Arduino Pro or Pro Mini" or "Arduino Mini"
#endif
#if F_CPU != 16000000L || not defined(__AVR_ATmega328P__) || not defined(__AVR_ATmega32U4__)
#warning You must select the processor type "ATmega328(5V, 16MHz)"
diff --git a/remote_multiprotocol/_Config.h b/Multiprotocol/_Config.h
similarity index 94%
rename from remote_multiprotocol/_Config.h
rename to Multiprotocol/_Config.h
index 5657f5c..6adc618 100644
--- a/remote_multiprotocol/_Config.h
+++ b/Multiprotocol/_Config.h
@@ -59,9 +59,9 @@
//Once a good tuning value is found it can be set here and will override the radio's 'option' setting for all existing and new models which use that protocol.
//For more information: https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/tree/master/docs/Frequency_Tuning.md
//Uncomment the lines below (remove the "//") and set an appropriate value (replace the "0") to enable. Valid range is -127 to +127.
-#define FORCE_FRSKYD_TUNING 0
-#define FORCE_FRSKYV_TUNING 0
-#define FORCE_FRSKYX_TUNING 0
+//#define FORCE_FRSKYD_TUNING 0
+//#define FORCE_FRSKYV_TUNING 0
+//#define FORCE_FRSKYX_TUNING 0
/** Low Power **/
//Low power is reducing the transmit power of the multi module. This setting is configurable per model in PPM (table below) or Serial mode (radio GUI).
@@ -226,25 +226,25 @@
//The parameter below indicates the number of desired banks between 1 and 5. Default is 5.
#define NBR_BANKS 3
-
+uint8_t curr_bank = 0;
const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
#if NBR_BANKS > 0
//****************************** BANK 1 ******************************
// Switch Protocol Sub protocol RX_Num Power Auto Bind Option
-/* 1 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , -120 },
-/* 2 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , -100 },
-/* 3 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , -80 },
-/* 4 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , -60 },
-/* 5 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , -40 },
-/* 6 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , -20 },
-/* 7 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 0 },
-/* 8 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 10 },
-/* 9 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 20 },
-/* 10 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 40 },
-/* 11 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 60 },
-/* 12 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 80 }, // option=fine freq tuning
-/* 13 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 100 },
-/* 14 */ {PROTO_FRSKYD, 0 , 0 , P_LOW , AUTOBIND , 120 },
+/* 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 },
#endif
#if NBR_BANKS > 1
//****************************** BANK 2 ******************************
diff --git a/remote_multiprotocol/iface_cc2500.h b/Multiprotocol/iface_cc2500.h
similarity index 100%
rename from remote_multiprotocol/iface_cc2500.h
rename to Multiprotocol/iface_cc2500.h
diff --git a/Multiprotocol/inputs.ino b/Multiprotocol/inputs.ino
new file mode 100644
index 0000000..542b234
--- /dev/null
+++ b/Multiprotocol/inputs.ino
@@ -0,0 +1,20 @@
+void update_inputs(void) {
+ //analogRead()
+ static int inc = 1;
+ #if 1
+ if (inc > 0) {
+ if (Channel_data[THROTTLE] < CHANNEL_MIN_125 + 100) {
+ Channel_data[THROTTLE] += 1;
+ }else {
+ inc = -1;
+ }
+ }else {
+ if (Channel_data[THROTTLE] > CHANNEL_MIN_125) {
+ Channel_data[THROTTLE] -= 1;
+ }else {
+ inc = +1;
+ }
+ }
+#endif
+}
+
diff --git a/remote_multiprotocol/mi.ino b/Multiprotocol/mi.ino
similarity index 100%
rename from remote_multiprotocol/mi.ino
rename to Multiprotocol/mi.ino
diff --git a/remote_multiprotocol/Pins.h b/remote_multiprotocol/Pins.h
deleted file mode 100644
index 88ba3ae..0000000
--- a/remote_multiprotocol/Pins.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- 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 .
- */
-//*******************
-//*** Pinouts ***
-//*******************
-
- // SDIO MOSI
- #define SDI_pin 2 //D5 = PD5
- #define SDI_port PORTB
- #define SDI_ipr PINB
- #define SDI_ddr DDRB
- #define SDI_on SDI_port |= _BV(SDI_pin)
- #define SDI_off SDI_port &= ~_BV(SDI_pin)
- #define SDI_1 (SDI_ipr & _BV(SDI_pin))
- #define SDI_0 (SDI_ipr & _BV(SDI_pin)) == 0x00
- #define SDI_input SDI_ddr &= ~_BV(SDI_pin)
- #define SDI_output SDI_ddr |= _BV(SDI_pin)
-
- //SDO / MISO
- #define SDO_pin 3 //D6 = PD6
- #define SDO_port PORTB
- #define SDO_ipr PINB
- #define SDO_1 (SDO_ipr & _BV(SDO_pin))
- #define SDO_0 (SDO_ipr & _BV(SDO_pin)) == 0x00
-
- // SCLK
- #define SCLK_port PORTB
- #define SCLK_ddr DDRB
- #define SCLK_pin 1 //D4 = PD4
- #define SCLK_output SCLK_ddr |= _BV(SCLK_pin)
- #define SCLK_on SCLK_port |= _BV(SCLK_pin)
- #define SCLK_off SCLK_port &= ~_BV(SCLK_pin)
-
- // Chip select CC2500
- #define CC25_CSN_pin 7 //D7 = PD7
- #define CC25_CSN_port PORTE
- #define CC25_CSN_ddr DDRE
- #define CC25_CSN_output CC25_CSN_ddr |= _BV(CC25_CSN_pin)
- #define CC25_CSN_on CC25_CSN_port |= _BV(CC25_CSN_pin)
- #define CC25_CSN_off CC25_CSN_port &= ~_BV(CC25_CSN_pin)
-
-//*******************
-//*** Timer ***
-//*******************
-#define OCF1A_bm _BV(OCF1A)
-#define OCF1B_bm _BV(OCF1B)
-#define SET_TIMSK1_OCIE1B TIMSK1 |= _BV(OCIE1B)
-#define CLR_TIMSK1_OCIE1B TIMSK1 &=~_BV(OCIE1B)
-
-//*******************
-//*** EEPROM ***
-//*******************
-#define EE_ADDR uint8_t*