mirror of
https://github.com/opentx/opentx.git
synced 2025-07-25 17:25:13 +03:00
Fix FrSky D cable telementry for 9XR PRO and DJT module. (#5220)
* Fix FrSky D cable telementry for 9XR PRO and DJT module. * Revert a breaking change.
This commit is contained in:
parent
6f3577c9a5
commit
9cb4b782e1
3 changed files with 13 additions and 5 deletions
|
@ -405,6 +405,7 @@ void rxPdcUsart( void (*pChProcess)(uint8_t x) );
|
|||
|
||||
// Second UART driver
|
||||
void serial2TelemetryInit(unsigned int protocol);
|
||||
void serial2Putc(const unsigned char c);
|
||||
#if defined(__cplusplus)
|
||||
bool telemetrySecondPortReceive(uint8_t & data);
|
||||
#endif
|
||||
|
|
|
@ -37,12 +37,12 @@ Fifo<uint8_t, 512> serial2RxFifo;
|
|||
* This function is synchronous (i.e. uses polling).
|
||||
* c Character to send.
|
||||
*/
|
||||
void serial2Putc(const char c)
|
||||
void serial2Putc(const unsigned char c)
|
||||
{
|
||||
Uart *pUart = SECOND_SERIAL_UART;
|
||||
|
||||
/* Wait for the transmitter to be ready */
|
||||
while ( (pUart->UART_SR & UART_SR_TXEMPTY) == 0 ) ;
|
||||
while ( (pUart->UART_SR & UART_SR_TXRDY) == 0 ) ;
|
||||
|
||||
/* Send character */
|
||||
pUart->UART_THR = c;
|
||||
|
@ -98,9 +98,13 @@ void SECOND_UART_Stop()
|
|||
}
|
||||
|
||||
extern "C" void UART0_IRQHandler()
|
||||
{
|
||||
if ( SECOND_SERIAL_UART->UART_SR & UART_SR_RXRDY )
|
||||
{
|
||||
serial2RxFifo.push(SECOND_SERIAL_UART->UART_RHR);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#define SECOND_UART_Configure(...)
|
||||
#endif
|
||||
|
@ -109,7 +113,6 @@ extern "C" void UART0_IRQHandler()
|
|||
void serial2TelemetryInit(unsigned int /*protocol*/)
|
||||
{
|
||||
SECOND_UART_Configure(FRSKY_D_BAUDRATE, Master_frequency);
|
||||
// startPdcUsartReceive();
|
||||
}
|
||||
|
||||
bool telemetrySecondPortReceive(uint8_t & data)
|
||||
|
@ -117,3 +120,7 @@ bool telemetrySecondPortReceive(uint8_t & data)
|
|||
return serial2RxFifo.pop(data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG)
|
||||
void serialPrintf(const char*, ... ) {}
|
||||
#endif
|
||||
|
|
|
@ -404,7 +404,7 @@ void telemetryInit(uint8_t protocol)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(SERIAL2)
|
||||
#if defined(SERIAL2) || defined(PCBSKY9X)
|
||||
else if (protocol == PROTOCOL_FRSKY_D_SECONDARY) {
|
||||
telemetryPortInit(0, TELEMETRY_SERIAL_DEFAULT);
|
||||
serial2TelemetryInit(PROTOCOL_FRSKY_D_SECONDARY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue