@@ -296,6 +296,22 @@ ap3_err_t Uart::set_config(HardwareSerial_Config_e HWSconfig)
296
296
retval = AP3_INVALID_ARG;
297
297
break ;
298
298
}
299
+
300
+ // Setup flow control
301
+ _config.ui32FlowControl = AM_HAL_UART_FLOW_CTRL_NONE;
302
+ if (_pinRTS != AP3_UART_PIN_UNUSED && _pinCTS != AP3_UART_PIN_UNUSED)
303
+ {
304
+ _config.ui32FlowControl = AM_HAL_UART_FLOW_CTRL_RTS_CTS;
305
+ }
306
+ else if (_pinRTS != AP3_UART_PIN_UNUSED)
307
+ {
308
+ _config.ui32FlowControl = AM_HAL_UART_FLOW_CTRL_RTS_ONLY;
309
+ }
310
+ else if (_pinCTS != AP3_UART_PIN_UNUSED)
311
+ {
312
+ _config.ui32FlowControl = AM_HAL_UART_FLOW_CTRL_CTS_ONLY;
313
+ }
314
+
299
315
return retval;
300
316
}
301
317
@@ -375,7 +391,7 @@ ap3_err_t Uart::_begin(void)
375
391
376
392
if (_pinRTS != AP3_UART_PIN_UNUSED)
377
393
{
378
- retval = ap3_uart_pad_funcsel (_instance, AP3_UART_TX , ap3_gpio_pin2pad (_pinRTS), &funcsel);
394
+ retval = ap3_uart_pad_funcsel (_instance, AP3_UART_RTS , ap3_gpio_pin2pad (_pinRTS), &funcsel);
379
395
if (retval != AP3_OK)
380
396
{
381
397
return retval;
@@ -391,7 +407,7 @@ ap3_err_t Uart::_begin(void)
391
407
392
408
if (_pinCTS != AP3_UART_PIN_UNUSED)
393
409
{
394
- retval = ap3_uart_pad_funcsel (_instance, AP3_UART_RX , ap3_gpio_pin2pad (_pinCTS), &funcsel);
410
+ retval = ap3_uart_pad_funcsel (_instance, AP3_UART_CTS , ap3_gpio_pin2pad (_pinCTS), &funcsel);
395
411
if (retval != AP3_OK)
396
412
{
397
413
return retval;
0 commit comments