[Taranis] DEBUG Tx now in its interrupt at 115200bauds

This commit is contained in:
bsongis@gmail.com
2013-05-19 22:17:54 +00:00
parent bea62a03ff
commit 0a719d9ec7
10 changed files with 47 additions and 44 deletions
+26 -2
View File
@@ -64,9 +64,33 @@ void uartInit(uint32_t baudrate)
USART_Init(UART3, &USART_InitStructure);
USART_Cmd(UART3, ENABLE);
USART_ITConfig(UART3, USART_IT_RXNE, DISABLE);
USART_ITConfig(UART3, USART_IT_TXE, DISABLE);
NVIC_EnableIRQ(USART3_IRQn);
}
void uartPutc(const char c)
#if defined(DEBUG)
#include "../../fifo.h"
Fifo<512> debugTxFifo;
void debugPutc(const char c)
{
USART_SendData(UART3, c);
debugTxFifo.push(c);
USART_ITConfig(UART3, USART_IT_TXE, ENABLE);
}
extern "C" void USART3_IRQHandler(void)
{
if (USART_GetITStatus(UART3, USART_IT_TXE) != RESET) {
uint8_t txchar;
if (debugTxFifo.pop(txchar)) {
/* Write one byte to the transmit data register */
USART_SendData(UART3, txchar);
}
else {
USART_ITConfig(UART3, USART_IT_TXE, DISABLE);
}
}
}
#endif