mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 03:20:00 +03:00
fix at32 serial bidir pp od init and smart audio (#13764) include fix for F4 and G4 as well Co-authored-by: Benedikt Kleiner <b.kleiner@str8labs.com> Co-authored-by: Eike Ahmels <ea@weslink.de>
This commit is contained in:
parent
72101c4f1c
commit
073b70f7dc
4 changed files with 7 additions and 3 deletions
|
@ -391,7 +391,7 @@ uartPort_t *serialUART(UARTDevice_e device, uint32_t baudRate, portMode_e mode,
|
|||
GPIO_MODE_MUX,
|
||||
GPIO_DRIVE_STRENGTH_STRONGER,
|
||||
((options & SERIAL_INVERTED) || (options & SERIAL_BIDIR_PP) || (options & SERIAL_BIDIR_PP_PD)) ? GPIO_OUTPUT_PUSH_PULL : GPIO_OUTPUT_OPEN_DRAIN,
|
||||
(options & SERIAL_INVERTED) ? GPIO_PULL_DOWN : GPIO_PULL_UP
|
||||
((options & SERIAL_INVERTED) || (options & SERIAL_BIDIR_PP_PD)) ? GPIO_PULL_DOWN : GPIO_PULL_UP
|
||||
);
|
||||
IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(device));
|
||||
IOConfigGPIOAF(txIO, ioCfg, uartdev->tx.af);
|
||||
|
|
|
@ -337,7 +337,9 @@ uartPort_t *serialUART(UARTDevice_e device, uint32_t baudRate, portMode_e mode,
|
|||
|
||||
if (options & SERIAL_BIDIR) {
|
||||
IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(device));
|
||||
IOConfigGPIOAF(txIO, ((options & SERIAL_BIDIR_PP) || (options & SERIAL_BIDIR_PP_PD)) ? IOCFG_AF_PP : IOCFG_AF_OD, hardware->af);
|
||||
IOConfigGPIOAF(txIO, (options & SERIAL_BIDIR_PP_PD) ? IOCFG_AF_PP_PD
|
||||
: (options & SERIAL_BIDIR_PP) ? IOCFG_AF_PP
|
||||
: IOCFG_AF_OD, hardware->af);
|
||||
} else {
|
||||
if ((mode & MODE_TX) && txIO) {
|
||||
IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(device));
|
||||
|
|
|
@ -300,7 +300,7 @@ uartPort_t *serialUART(UARTDevice_e device, uint32_t baudRate, portMode_e mode,
|
|||
ioConfig_t ioCfg = IO_CONFIG(
|
||||
((options & SERIAL_INVERTED) || (options & SERIAL_BIDIR_PP) || (options & SERIAL_BIDIR_PP_PD)) ? GPIO_MODE_AF_PP : GPIO_MODE_AF_OD,
|
||||
GPIO_SPEED_FREQ_HIGH,
|
||||
(options & SERIAL_INVERTED) ? GPIO_PULLDOWN : GPIO_PULLUP
|
||||
((options & SERIAL_INVERTED) || (options & SERIAL_BIDIR_PP_PD)) ? GPIO_PULLDOWN : GPIO_PULLUP
|
||||
);
|
||||
|
||||
IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(device));
|
||||
|
|
|
@ -497,6 +497,7 @@ static void saReceiveFrame(uint8_t c)
|
|||
static void saSendFrame(uint8_t *buf, int len)
|
||||
{
|
||||
if (!IS_RC_MODE_ACTIVE(BOXVTXCONTROLDISABLE)) {
|
||||
#ifndef AT32F4
|
||||
switch (smartAudioSerialPort->identifier) {
|
||||
case SERIAL_PORT_SOFTSERIAL1:
|
||||
case SERIAL_PORT_SOFTSERIAL2:
|
||||
|
@ -508,6 +509,7 @@ static void saSendFrame(uint8_t *buf, int len)
|
|||
serialWrite(smartAudioSerialPort, 0x00); // Generate 1st start byte
|
||||
break;
|
||||
}
|
||||
#endif //AT32F4
|
||||
|
||||
for (int i = 0 ; i < len ; i++) {
|
||||
serialWrite(smartAudioSerialPort, buf[i]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue