[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
+11 -26
View File
@@ -41,7 +41,6 @@
#if !defined(SIMU)
Fifo<512> debugRxFifo;
Fifo<512> debugTxFifo;
// Outputs a string to the UART
void debugPuts(const char *format, ...)
@@ -55,7 +54,7 @@ void debugPuts(const char *format, ...)
const char *t = tmp;
while (*t) {
debugTxFifo.push(*t++);
debugPutc(*t++);
}
}
@@ -78,15 +77,10 @@ uint32_t Mem_address ;
uint32_t Next_mem_address ;
uint32_t Memaddmode ;
void txmit( uint8_t chr )
{
debugTxFifo.push( chr) ;
}
void crlf()
{
txmit( 13 ) ;
txmit( 10 ) ;
debugPutc( 13 ) ;
debugPutc( 10 ) ;
}
// Send a single 4 bit value to the RS232 port as a hex digit
@@ -98,7 +92,7 @@ void hex_digit_send( unsigned char c )
c += 7 ;
}
c += '0' ;
txmit( c ) ;
debugPutc( c ) ;
}
// Send the 8 bit value to the RS232 port as 2 hex digits
@@ -135,7 +129,7 @@ static void dispw_256( register uint32_t address, register uint32_t lines )
p8hex( address ) ;
for ( j = 0 ; j < 4 ; j += 1 )
{
txmit(' ') ;
debugPutc(' ') ;
p8hex( *( (uint32_t *)address ) ) ;
address += 4 ;
}
@@ -165,7 +159,7 @@ void debugTask(void* pdata)
}
if ( ( ( rxchar >= '0' ) && ( rxchar <= '9' ) ) || ( ( rxchar >= 'A' ) && ( rxchar <= 'F' ) ) )
{
txmit( rxchar ) ;
debugPutc( rxchar ) ;
rxchar -= '0' ;
if ( rxchar > 9 )
{
@@ -187,9 +181,9 @@ void debugTask(void* pdata)
}
else if ( rxchar == 8 )
{
txmit( rxchar ) ;
txmit( rxchar ) ;
txmit( rxchar ) ;
debugPutc( rxchar ) ;
debugPutc( rxchar ) ;
debugPutc( rxchar ) ;
Mem_address >>= 4 ;
}
else if ( rxchar == 27 )
@@ -204,27 +198,18 @@ void debugTask(void* pdata)
{
Memaddmode = 1 ;
Mem_address = 0 ;
txmit( '>' ) ;
debugPutc( '>' ) ;
}
if ( rxchar == 'm' )
{
crlf() ;
p8hex( (uint32_t) &g_model.moduleData[0] ) ;
txmit( ' ' ) ;
debugPutc( ' ' ) ;
p8hex( (uint32_t) &g_model.moduleData[1] ) ;
crlf() ;
}
}
}
void debugTx(void)
{
uint8_t txchar;
if (debugTxFifo.pop(txchar))
debugPutc(txchar);
}
#endif
-1
View File
@@ -90,7 +90,6 @@ void dump(unsigned char *data, unsigned int size);
#define DUMP(data, size) dump(data, size)
void debugTask(void* pdata);
void debugTx(void);
#else
-11
View File
@@ -109,13 +109,6 @@ uint8_t usbPlugged(void)
return usbState == USB_CONNECTED;
}
#if defined(DEBUG)
void debugPutc(const char c)
{
uartPutc(c);
}
#endif
#if !defined(SIMU)
extern "C" {
USB_OTG_CORE_HANDLE USB_OTG_dev;
@@ -175,10 +168,6 @@ void interrupt5ms()
pre_scale = 0 ;
per10ms();
}
#if defined(DEBUG)
debugTx();
#endif
}
extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
+1 -1
View File
@@ -84,7 +84,7 @@ uint8_t usbPlugged(void);
void delaysInit();
#define DEBUG_UART_BAUDRATE 9600
#define DEBUG_UART_BAUDRATE 115200
#define SPORT_BAUDRATE 57600
void uartInit(uint32_t baudrate);
+1 -1
View File
@@ -69,7 +69,7 @@ void sportInit(void)
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Tx|USART_Mode_Rx;
USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
USART_Init(SPORT, &USART_InitStructure);
USART_Cmd(SPORT, ENABLE);
+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
+5
View File
@@ -684,6 +684,11 @@ void telemetryInterrupt10ms()
frskyData.power = ((current>>1) * (voltage>>1)) / 25;
#endif
#if 0
if (frskyData.power > frskyData.maxPower)
frskyData.maxPower = frskyData.power;
#endif
frskyData.currentPrescale += current;
if (frskyData.currentPrescale >= 3600) {
frskyData.currentConsumption += 1;
+1
View File
@@ -176,6 +176,7 @@ struct FrskyData {
uint16_t currentConsumption;
uint16_t currentPrescale;
uint16_t power;
// TODO uint16_t maxPower;
};
// Global Fr-Sky telemetry data variables
+1 -1
View File
@@ -1 +1 @@
0x80,0x1f,0xc0,0x3f,0xe0,0x76,0x68,0x66,0x6c,0x66,0x66,0x66,0x62,0x66,0xe0,0x66,0xc0,0x07,0x80,0x07,0x80,0x1f,0xc0,0x3f,0xe0,0x76,0x62,0x66,0x66,0x66,0x6c,0x66,0x68,0x66,0xe0,0x66,0xc0,0x07,0x80,0x07,0x00,0x18,0x00,0x3c,0x60,0x7e,0x62,0x66,0x66,0x66,0x6c,0x66,0x68,0x66,0xe0,0x66,0xc0,0x7f,0x80,0x7f,0x00,0x00,0x00,0x00,0x98,0x61,0x98,0x61,0x86,0x7f,0x86,0x7f,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00,0xe0,0x07,0xf0,0x0f,0x38,0x9c,0x18,0xd8,0x18,0x78,0x18,0x38,0x18,0x18,0x18,0x1c,0x00,0x0e,0x00,0x06,
0x80,0x1f,0xc0,0x3f,0xe0,0x76,0x68,0x66,0x6c,0x66,0x66,0x66,0x62,0x66,0xe0,0x66,0xc0,0x07,0x80,0x07,0x80,0x1f,0xc0,0x3f,0xe0,0x76,0x62,0x66,0x66,0x66,0x6c,0x66,0x68,0x66,0xe0,0x66,0xc0,0x07,0x80,0x07,0x00,0x18,0x00,0x3c,0x60,0x7e,0x62,0x66,0x66,0x66,0x6c,0x66,0x68,0x66,0xe0,0x66,0xc0,0x7f,0x80,0x7f,0x00,0x00,0x00,0x00,0x98,0x61,0x98,0x61,0x86,0x7f,0x86,0x7f,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00,0xe0,0x07,0xf0,0x0f,0x38,0x9c,0x18,0xd8,0x18,0x78,0x18,0x38,0x18,0x18,0x18,0x1c,0x00,0x0e,0x00,0x06,
+1 -1
View File
@@ -1 +1 @@
0x38,0x54,0x56,0x55,0x18,0x38,0x55,0x56,0x54,0x18,0x20,0x55,0x56,0x54,0x78,0x00,0x4a,0x79,0x42,0x00,0x1c,0xa2,0x62,0x22,0x10,
0x38,0x54,0x56,0x55,0x18,0x38,0x55,0x56,0x54,0x18,0x20,0x55,0x56,0x54,0x78,0x00,0x4a,0x79,0x42,0x00,0x1c,0xa2,0x62,0x22,0x10,