[Pulses] Refactoring
This commit is contained in:
@@ -30,10 +30,10 @@ void intmoduleStop()
|
||||
|
||||
void intmodulePxxStart()
|
||||
{
|
||||
// shouldn't be used anymore
|
||||
intmoduleSerialStart(INTMODULE_USART_PXX_BAUDRATE, false);
|
||||
}
|
||||
|
||||
void intmoduleSerialStart(uint32_t baudrate)
|
||||
void intmoduleSerialStart(uint32_t baudrate, uint8_t rxEnable)
|
||||
{
|
||||
INTERNAL_MODULE_ON();
|
||||
|
||||
@@ -66,11 +66,12 @@ void intmoduleSerialStart(uint32_t baudrate)
|
||||
USART_Init(INTMODULE_USART, &USART_InitStructure);
|
||||
USART_Cmd(INTMODULE_USART, ENABLE);
|
||||
|
||||
intmoduleFifo.clear();
|
||||
|
||||
USART_ITConfig(INTMODULE_USART, USART_IT_RXNE, ENABLE);
|
||||
NVIC_SetPriority(INTMODULE_USART_IRQn, 6);
|
||||
NVIC_EnableIRQ(INTMODULE_USART_IRQn);
|
||||
if (rxEnable) {
|
||||
intmoduleFifo.clear();
|
||||
USART_ITConfig(INTMODULE_USART, USART_IT_RXNE, ENABLE);
|
||||
NVIC_SetPriority(INTMODULE_USART_IRQn, 6);
|
||||
NVIC_EnableIRQ(INTMODULE_USART_IRQn);
|
||||
}
|
||||
}
|
||||
|
||||
#define USART_FLAG_ERRORS (USART_FLAG_ORE | USART_FLAG_NE | USART_FLAG_FE | USART_FLAG_PE)
|
||||
@@ -119,10 +120,17 @@ void intmoduleSendBuffer(const uint8_t * data, uint8_t size)
|
||||
|
||||
void intmoduleSendNextFrame()
|
||||
{
|
||||
switch(moduleSettings[INTERNAL_MODULE].protocol) {
|
||||
#if defined(PXX2)
|
||||
if (moduleSettings[INTERNAL_MODULE].protocol == PROTOCOL_CHANNELS_PXX2) {
|
||||
intmoduleSendBuffer(intmodulePulsesData.pxx2.getData(), intmodulePulsesData.pxx2.getSize());
|
||||
}
|
||||
case PROTOCOL_CHANNELS_PXX2:
|
||||
intmoduleSendBuffer(intmodulePulsesData.pxx2.getData(), intmodulePulsesData.pxx2.getSize());
|
||||
break;
|
||||
#endif
|
||||
#if defined(PXX1)
|
||||
case PROTOCOL_CHANNELS_PXX1:
|
||||
intmoduleSendBuffer(intmodulePulsesData.pxx_uart.getData(), intmodulePulsesData.pxx_uart.getSize());
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user