PXX2 pulses now received on external module
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user