Remove PPM_PIN_SERIAL
This commit is contained in:
committed by
Peter Feerick
parent
09c49e24ee
commit
f9830e1405
@@ -33,38 +33,6 @@
|
|||||||
|
|
||||||
#define BITLEN_DSM2 (8*2) //125000 Baud => 8uS per bit
|
#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)
|
void _send_1(uint8_t v)
|
||||||
{
|
{
|
||||||
if (extmodulePulsesData.dsm2.index & 1)
|
if (extmodulePulsesData.dsm2.index & 1)
|
||||||
@@ -102,7 +70,6 @@ void putDsm2Flush()
|
|||||||
else
|
else
|
||||||
*(extmodulePulsesData.dsm2.ptr - 1) = 60000;
|
*(extmodulePulsesData.dsm2.ptr - 1) = 60000;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// This is the data stream to send, prepare after 19.5 mS
|
// This is the data stream to send, prepare after 19.5 mS
|
||||||
// Send after 22.5 mS
|
// Send after 22.5 mS
|
||||||
@@ -111,12 +78,7 @@ void setupPulsesDSM2()
|
|||||||
{
|
{
|
||||||
uint8_t dsmDat[14];
|
uint8_t dsmDat[14];
|
||||||
|
|
||||||
#if defined(PPM_PIN_SERIAL)
|
|
||||||
extmodulePulsesData.dsm2.serialByte = 0 ;
|
|
||||||
extmodulePulsesData.dsm2.serialBitCount = 0 ;
|
|
||||||
#else
|
|
||||||
extmodulePulsesData.dsm2.index = 0;
|
extmodulePulsesData.dsm2.index = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses;
|
extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses;
|
||||||
|
|
||||||
|
|||||||
@@ -222,12 +222,7 @@ void setupPulsesMulti(uint8_t moduleIdx)
|
|||||||
|
|
||||||
void setupPulsesMultiExternalModule()
|
void setupPulsesMultiExternalModule()
|
||||||
{
|
{
|
||||||
#if defined(PPM_PIN_SERIAL)
|
|
||||||
extmodulePulsesData.dsm2.serialByte = 0 ;
|
|
||||||
extmodulePulsesData.dsm2.serialBitCount = 0 ;
|
|
||||||
#else
|
|
||||||
extmodulePulsesData.dsm2.index = 0;
|
extmodulePulsesData.dsm2.index = 0;
|
||||||
#endif
|
|
||||||
extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses;
|
extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses;
|
||||||
|
|
||||||
setupPulsesMulti(EXTERNAL_MODULE);
|
setupPulsesMulti(EXTERNAL_MODULE);
|
||||||
|
|||||||
@@ -108,16 +108,6 @@ template<class T> struct PpmPulsesData {
|
|||||||
T * ptr;
|
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
|
#define MAX_PULSES_TRANSITIONS 300
|
||||||
PACK(struct Dsm2TimerPulsesData {
|
PACK(struct Dsm2TimerPulsesData {
|
||||||
pulse_duration_t pulses[MAX_PULSES_TRANSITIONS];
|
pulse_duration_t pulses[MAX_PULSES_TRANSITIONS];
|
||||||
@@ -125,7 +115,6 @@ PACK(struct Dsm2TimerPulsesData {
|
|||||||
uint8_t index;
|
uint8_t index;
|
||||||
});
|
});
|
||||||
typedef Dsm2TimerPulsesData Dsm2PulsesData;
|
typedef Dsm2TimerPulsesData Dsm2PulsesData;
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PPM_DEF_PERIOD 225 /* 22.5ms */
|
#define PPM_DEF_PERIOD 225 /* 22.5ms */
|
||||||
#define PPM_STEP_SIZE 5 /*0.5ms*/
|
#define PPM_STEP_SIZE 5 /*0.5ms*/
|
||||||
@@ -191,12 +180,8 @@ union ExternalModulePulsesData {
|
|||||||
#if defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML)
|
#if defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML)
|
||||||
UartPxx1Pulses pxx_uart;
|
UartPxx1Pulses pxx_uart;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PPM_PIN_SERIAL)
|
|
||||||
SerialPxx1Pulses pxx;
|
|
||||||
#else
|
|
||||||
PwmPxx1Pulses pxx;
|
PwmPxx1Pulses pxx;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PXX2)
|
#if defined(PXX2)
|
||||||
Pxx2Pulses pxx2;
|
Pxx2Pulses pxx2;
|
||||||
|
|||||||
@@ -28,23 +28,6 @@
|
|||||||
/* The protocol reuse some the DSM2 definitions where they are identical */
|
/* 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)
|
static void _send_level(uint8_t v)
|
||||||
{
|
{
|
||||||
/* Copied over from DSM, this looks doubious and in my logic analyzer
|
/* 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
|
_send_level(len+ BITLEN_SBUS); // enlarge the last bit to be two stop bits long
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define SBUS_NORMAL_CHANS 16
|
#define SBUS_NORMAL_CHANS 16
|
||||||
@@ -117,12 +99,7 @@ static void sbusFlush()
|
|||||||
|
|
||||||
void setupPulsesSbus()
|
void setupPulsesSbus()
|
||||||
{
|
{
|
||||||
#if defined(PPM_PIN_SERIAL)
|
|
||||||
extmodulePulsesData.dsm2.serialByte = 0;
|
|
||||||
extmodulePulsesData.dsm2.serialBitCount = 0;
|
|
||||||
#else
|
|
||||||
extmodulePulsesData.dsm2.index = 0;
|
extmodulePulsesData.dsm2.index = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses;
|
extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user