From e2bbe8a422ac95f927a32a446a88495ce4bd0782 Mon Sep 17 00:00:00 2001 From: Andrew Shkolik Date: Tue, 24 Dec 2019 15:03:35 -0600 Subject: [PATCH 1/4] definitions for direct inputs --- Multiprotocol/_Config.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 6c5f011..88d02a8 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -488,6 +488,26 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { // - 0x40010000 will give to the protocol the channels in the order 4,2,3,1,5,6,7,8 swapping channel 1 and 4. Note: 0 means leave the channel where it is. // - 0x0000ABCD will give to the protocol the channels in the order 1,2,3,4,10,11,12,13 which potentially enables acces to channels not available on your TX. Note A=10,B=11,C=12,D=13,E=14,F=15. + +/**********************************/ +/*** DIRECT INPUTS SETTINGS ***/ +/**********************************/ +//In this section you can configure the direct inputs. +//It enables switches wired directly to the board +//Current mappings are: AUX1-PB10, AUX2-PB11, AUX3-PA2, AUX4-PA3 +//Direct inputs works only in ppm mode and only for stm_32 boards +#if defined(ENABLE_PPM) && defined (STM32_BOARD) && not defined (ENABLE_SERIAL) + +//If plan to use direct input mode please uncomment lines below +//#define ENABLE_DIRECT_INPUTS +// +//Direct inputs start channel +//Uncomment and change from what channel direct inputs starts +//#define DIRECT_INPUTS_START 7 +// + +#endif +#endif /* Available protocols and associated sub protocols to pick and choose from (Listed in alphabetical order) PROTO_AFHDS2A PWM_IBUS From 6906f1652ed9050f994348c2e620d81a639e6e7c Mon Sep 17 00:00:00 2001 From: Andrew Shkolik Date: Tue, 24 Dec 2019 23:41:04 -0600 Subject: [PATCH 2/4] Inputs logic added --- Multiprotocol/Multiprotocol.ino | 17 ++++++++++++++++- Multiprotocol/Pins.h | 2 +- Multiprotocol/_Config.h | 34 ++++++++++++++++++++++++--------- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index b09b472..43a15bb 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -667,7 +667,22 @@ bool Update_All() { uint32_t chan_or=chan_order; uint8_t ch; - for(uint8_t i=0;i Date: Mon, 30 Dec 2019 15:44:16 -0600 Subject: [PATCH 3/4] code cleanup --- Multiprotocol/Multiprotocol.ino | 40 ++++++++++++++++++++++++-------- Multiprotocol/Validate.h | 15 ++++++++++++ Multiprotocol/_Config.h | 41 +++++++++++++-------------------- 3 files changed, 62 insertions(+), 34 deletions(-) diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 43a15bb..de9ceb5 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -331,6 +331,21 @@ void setup() pinMode(S2_pin,INPUT_PULLUP); pinMode(S3_pin,INPUT_PULLUP); pinMode(S4_pin,INPUT_PULLUP); + + #if defined ENABLE_DIRECT_INPUTS + #if defined (DI1_PIN) + pinMode(DI1_PIN,INPUT_PULLUP); + #endif + #if defined (DI2_PIN) + pinMode(DI2_PIN,INPUT_PULLUP); + #endif + #if defined (DI3_PIN) + pinMode(DI3_PIN,INPUT_PULLUP); + #endif + #if defined (DI4_PIN) + pinMode(DI4_PIN,INPUT_PULLUP); + #endif + #endif //Random pins pinMode(PB0, INPUT_ANALOG); // set up pin for analog input @@ -666,23 +681,29 @@ bool Update_All() if(mode_select!=MODE_SERIAL && IS_PPM_FLAG_on) // PPM mode and a full frame has been received { uint32_t chan_or=chan_order; - uint8_t ch; - uint8_t channels_count = PPM_chan_max; - #ifdef ENABLE_DIRECT_INPUTS + uint8_t ch; + uint8_t channelsCount = PPM_chan_max; + + #ifdef ENABLE_DIRECT_INPUTS #ifdef DI_CH1_read - PPM_data[channels_count++] = DI_CH1_read + PPM_data[channelsCount] = DI_CH1_read; + channelsCount++; #endif #ifdef DI_CH2_read - PPM_data[channels_count++] = DI_CH2_read + PPM_data[channelsCount] = DI_CH2_read; + channelsCount++; #endif #ifdef DI_CH3_read - PPM_data[channels_count++] = DI_CH3_read + PPM_data[channelsCount] = DI_CH3_read; + channelsCount++; #endif #ifdef DI_CH4_read - PPM_data[channels_count++] = DI_CH4_read - #endif + PPM_data[channelsCount] = DI_CH4_read; + channelsCount++; + #endif #endif - for(uint8_t i=0;i Date: Mon, 30 Dec 2019 16:53:12 -0600 Subject: [PATCH 4/4] disable myConfig --- Multiprotocol/_Config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 39fffe1..69dc5f8 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -23,7 +23,7 @@ //If you know parameters you want for sure to be enabled or disabled which survives in future, you can use a file named "_MyConfig.h". //An example is given within the file named "_MyConfig.h.example" which needs to be renamed if you want to use it. //To enable this config file remove the // from the line below. -#define USE_MY_CONFIG +//#define USE_MY_CONFIG /*************************/