Fix MPM firmware update

This commit is contained in:
Raphael Coeffic
2022-03-27 17:03:41 +02:00
parent dcc8902f17
commit 1017172350
4 changed files with 16 additions and 11 deletions
+3 -11
View File
@@ -128,6 +128,7 @@ class MultiInternalUpdateDriver: public MultiFirmwareUpdateDriver
}; };
#endif #endif
#if defined(HARDWARE_EXTERNAL_MODULE)
class MultiExternalUpdateDriver: public MultiFirmwareUpdateDriver class MultiExternalUpdateDriver: public MultiFirmwareUpdateDriver
{ {
public: public:
@@ -141,15 +142,7 @@ class MultiExternalUpdateDriver: public MultiFirmwareUpdateDriver
void init(bool inverted) override void init(bool inverted) override
{ {
#if !defined(EXTMODULE_USART) extmoduleInitTxPin();
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = EXTMODULE_TX_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_Init(EXTMODULE_TX_GPIO, &GPIO_InitStructure);
#endif
if (inverted) if (inverted)
telemetryPortInvertedInit(57600); telemetryPortInvertedInit(57600);
@@ -164,9 +157,7 @@ class MultiExternalUpdateDriver: public MultiFirmwareUpdateDriver
void sendByte(uint8_t byte) const override void sendByte(uint8_t byte) const override
{ {
#if defined(HARDWARE_EXTERNAL_MODULE)
extmoduleSendInvertedByte(byte); extmoduleSendInvertedByte(byte);
#endif
} }
void clear() const override void clear() const override
@@ -184,6 +175,7 @@ class MultiExternalUpdateDriver: public MultiFirmwareUpdateDriver
clear(); clear();
} }
}; };
#endif
class MultiExtSportUpdateDriver: public MultiFirmwareUpdateDriver class MultiExtSportUpdateDriver: public MultiFirmwareUpdateDriver
{ {
@@ -144,6 +144,17 @@ void extmoduleSendNextFrameSoftSerial(const void* pulses, uint16_t length, bool
stm32_pulse_start_dma_req(&extmoduleTimer, pulses, length, LL_TIM_OCMODE_TOGGLE, 0); stm32_pulse_start_dma_req(&extmoduleTimer, pulses, length, LL_TIM_OCMODE_TOGGLE, 0);
} }
void extmoduleInitTxPin()
{
LL_GPIO_InitTypeDef pinInit;
LL_GPIO_StructInit(&pinInit);
pinInit.Pin = extmoduleTimer.GPIO_Pin;
pinInit.Mode = LL_GPIO_MODE_OUTPUT;
pinInit.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
pinInit.Pull = LL_GPIO_PULL_UP;
LL_GPIO_Init(extmoduleTimer.GPIOx, &pinInit);
}
// Delay based byte sending @ 57600 bps // Delay based byte sending @ 57600 bps
void extmoduleSendInvertedByte(uint8_t byte) void extmoduleSendInvertedByte(uint8_t byte)
{ {
@@ -41,4 +41,5 @@ void extmoduleSendNextFrameSoftSerial(const void* pulses, uint16_t length,
bool polarity = true); bool polarity = true);
// Bitbang serial // Bitbang serial
void extmoduleInitTxPin();
void extmoduleSendInvertedByte(uint8_t byte); void extmoduleSendInvertedByte(uint8_t byte);
@@ -42,6 +42,7 @@ void extmodulePpmStart(unsigned short, bool) {}
void extmoduleSerialStart() {} void extmoduleSerialStart() {}
void extmodulePxx1SerialStart() {} void extmodulePxx1SerialStart() {}
void extmodulePxx1PulsesStart() {} void extmodulePxx1PulsesStart() {}
void extmoduleInitTxPin() {}
void extmoduleSendInvertedByte(uint8_t) {} void extmoduleSendInvertedByte(uint8_t) {}
void extmoduleSendNextFramePxx1(void const*, unsigned short) {} void extmoduleSendNextFramePxx1(void const*, unsigned short) {}
void extmoduleSendNextFrameSoftSerial(void const*, unsigned short, bool) {} void extmoduleSendNextFrameSoftSerial(void const*, unsigned short, bool) {}