PXX2 pulses now received on external module

This commit is contained in:
Bertrand Songis
2019-02-21 12:27:52 +01:00
parent 4b339bebbe
commit 9472fd2132
4 changed files with 21 additions and 8 deletions
+3
View File
@@ -88,9 +88,12 @@ class ModuleFifo : public Fifo<uint8_t, 32> {
ridx = nextIndex(next);
return true;
}
uint32_t errors;
};
extern ModuleFifo intmoduleFifo;
extern ModuleFifo extmoduleFifo;
class Pxx2CrcMixin {
protected:
@@ -21,7 +21,6 @@
#include "opentx.h"
ModuleFifo intmoduleFifo;
uint8_t intmoduleErrors;
void intmoduleStop()
{
@@ -80,7 +79,7 @@ extern "C" void INTMODULE_USART_IRQHandler(void)
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
uint8_t data = INTMODULE_USART->DR;
if (status & USART_FLAG_ERRORS) {
intmoduleErrors++;
intmoduleFifo.errors++;
}
else {
intmoduleFifo.push(data);
@@ -110,6 +110,8 @@ void extmoduleSerialStart(uint32_t /*baudrate*/, uint32_t period_half_us)
}
#if defined(EXTMODULE_USART)
ModuleFifo extmoduleFifo;
void extmoduleInvertedSerialStart(uint32_t baudrate)
{
EXTERNAL_MODULE_ON();
@@ -182,10 +184,10 @@ extern "C" void EXTMODULE_USART_IRQHandler(void)
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
uint8_t data = EXTMODULE_USART->DR;
if (status & USART_FLAG_ERRORS) {
// TODO later extmoduleErrors++;
extmoduleFifo.errors++;
}
else {
// TODO later extmoduleFifo.push(data);
extmoduleFifo.push(data);
}
status = EXTMODULE_USART->SR;
}
+13 -4
View File
@@ -211,11 +211,20 @@ void telemetryWakeup()
}
#endif
#if defined(INTMODULE_USART)
#if defined(INTMODULE_USART) || defined(EXTMODULE_USART)
uint8_t frame[32];
if (intmoduleFifo.getFrame(frame)) {
processModuleFrame(INTERNAL_MODULE, frame);
}
#if defined(INTMODULE_USART)
if (intmoduleFifo.getFrame(frame)) {
processModuleFrame(INTERNAL_MODULE, frame);
}
#endif
#if defined(EXTMODULE_USART)
if (extmoduleFifo.getFrame(frame)) {
processModuleFrame(EXTERNAL_MODULE, frame);
}
#endif
#endif
#if defined(STM32)