From f9830e1405752e114e8d45c1b207e3dd48ef17ce Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Mon, 10 Jan 2022 16:28:15 +0100 Subject: [PATCH] Remove PPM_PIN_SERIAL --- radio/src/pulses/dsm2.cpp | 38 -------------------------------------- radio/src/pulses/multi.cpp | 5 ----- radio/src/pulses/pulses.h | 15 --------------- radio/src/pulses/sbus.cpp | 23 ----------------------- 4 files changed, 81 deletions(-) diff --git a/radio/src/pulses/dsm2.cpp b/radio/src/pulses/dsm2.cpp index 6227a36c7..7e6b7f6a2 100644 --- a/radio/src/pulses/dsm2.cpp +++ b/radio/src/pulses/dsm2.cpp @@ -33,38 +33,6 @@ #define BITLEN_DSM2 (8*2) //125000 Baud => 8uS per bit -#if defined(PPM_PIN_SERIAL) -void putDsm2SerialBit(uint8_t bit) -{ - extmodulePulsesData.dsm2.serialByte >>= 1; - if (bit & 1) { - extmodulePulsesData.dsm2.serialByte |= 0x80; - } - if (++extmodulePulsesData.dsm2.serialBitCount >= 8) { - *extmodulePulsesData.dsm2.ptr++ = extmodulePulsesData.dsm2.serialByte; - extmodulePulsesData.dsm2.serialBitCount = 0; - } -} - -void sendByteDsm2(uint8_t b) // max 10changes 0 10 10 10 10 1 -{ - putDsm2SerialBit(0); // Start bit - for (uint8_t i=0; i<8; i++) { // 8 data Bits - putDsm2SerialBit(b & 1); - b >>= 1; - } - - putDsm2SerialBit(1); // Stop bit - putDsm2SerialBit(1); // Stop bit -} - -void putDsm2Flush() -{ - for (int i=0; i<16; i++) { - putDsm2SerialBit(1); // 16 extra stop bits - } -} -#else void _send_1(uint8_t v) { if (extmodulePulsesData.dsm2.index & 1) @@ -102,7 +70,6 @@ void putDsm2Flush() else *(extmodulePulsesData.dsm2.ptr - 1) = 60000; } -#endif // This is the data stream to send, prepare after 19.5 mS // Send after 22.5 mS @@ -111,12 +78,7 @@ void setupPulsesDSM2() { uint8_t dsmDat[14]; -#if defined(PPM_PIN_SERIAL) - extmodulePulsesData.dsm2.serialByte = 0 ; - extmodulePulsesData.dsm2.serialBitCount = 0 ; -#else extmodulePulsesData.dsm2.index = 0; -#endif extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses; diff --git a/radio/src/pulses/multi.cpp b/radio/src/pulses/multi.cpp index cb2bfdd9d..914562b43 100644 --- a/radio/src/pulses/multi.cpp +++ b/radio/src/pulses/multi.cpp @@ -222,12 +222,7 @@ void setupPulsesMulti(uint8_t moduleIdx) void setupPulsesMultiExternalModule() { -#if defined(PPM_PIN_SERIAL) - extmodulePulsesData.dsm2.serialByte = 0 ; - extmodulePulsesData.dsm2.serialBitCount = 0 ; -#else extmodulePulsesData.dsm2.index = 0; -#endif extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses; setupPulsesMulti(EXTERNAL_MODULE); diff --git a/radio/src/pulses/pulses.h b/radio/src/pulses/pulses.h index fec47ed4c..bfd6f1959 100644 --- a/radio/src/pulses/pulses.h +++ b/radio/src/pulses/pulses.h @@ -108,16 +108,6 @@ template struct PpmPulsesData { T * ptr; }; -#if defined(PPM_PIN_SERIAL) -PACK(struct Dsm2SerialPulsesData { - uint8_t pulses[64]; - uint8_t * ptr; - uint8_t serialByte ; - uint8_t serialBitCount; - uint16_t _alignment; -}); -typedef Dsm2SerialPulsesData Dsm2PulsesData; -#else #define MAX_PULSES_TRANSITIONS 300 PACK(struct Dsm2TimerPulsesData { pulse_duration_t pulses[MAX_PULSES_TRANSITIONS]; @@ -125,7 +115,6 @@ PACK(struct Dsm2TimerPulsesData { uint8_t index; }); typedef Dsm2TimerPulsesData Dsm2PulsesData; -#endif #define PPM_DEF_PERIOD 225 /* 22.5ms */ #define PPM_STEP_SIZE 5 /*0.5ms*/ @@ -191,12 +180,8 @@ union ExternalModulePulsesData { #if defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML) UartPxx1Pulses pxx_uart; #endif -#if defined(PPM_PIN_SERIAL) - SerialPxx1Pulses pxx; -#else PwmPxx1Pulses pxx; #endif -#endif #if defined(PXX2) Pxx2Pulses pxx2; diff --git a/radio/src/pulses/sbus.cpp b/radio/src/pulses/sbus.cpp index bb757c1a9..0b2c8f407 100644 --- a/radio/src/pulses/sbus.cpp +++ b/radio/src/pulses/sbus.cpp @@ -28,23 +28,6 @@ /* The protocol reuse some the DSM2 definitions where they are identical */ -#if defined(PPM_PIN_SERIAL) -void sendByteSbus(uint8_t b) -{ - uint8_t parity = 1; - - putDsm2SerialBit(0); // Start bit - for (uint8_t i=0; i<8; i++) { // 8 data Bits - putDsm2SerialBit(b & 1); - parity = parity ^ (b & 1); - b >>= 1; - } - putDsm2SerialBit(!parity); // Even Parity bit - - putDsm2SerialBit(1); // Stop bit - putDsm2SerialBit(1); // Stop bit -} -#else static void _send_level(uint8_t v) { /* Copied over from DSM, this looks doubious and in my logic analyzer @@ -81,7 +64,6 @@ void sendByteSbus(uint8_t b) // max 11 changes 0 10 10 10 10 P 1 } _send_level(len+ BITLEN_SBUS); // enlarge the last bit to be two stop bits long } -#endif #define SBUS_NORMAL_CHANS 16 @@ -117,12 +99,7 @@ static void sbusFlush() void setupPulsesSbus() { -#if defined(PPM_PIN_SERIAL) - extmodulePulsesData.dsm2.serialByte = 0; - extmodulePulsesData.dsm2.serialBitCount = 0; -#else extmodulePulsesData.dsm2.index = 0; -#endif extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses;