File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
cores/arduino/ard_sup/uart Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,20 @@ void Uart::begin(unsigned long baudrate, am_hal_uart_config_t config)
6767
6868void Uart::end ()
6969{
70- // todo:
70+ if (_handle != NULL )
71+ {
72+ flush ();
73+
74+ // Power down the UART, and surrender the handle.
75+ am_hal_uart_power_control (_handle, AM_HAL_SYSCTRL_DEEPSLEEP, false );
76+ am_hal_uart_deinitialize (_handle);
77+
78+ // Disable the UART pins.
79+ am_hal_gpio_pinconfig (_pinTX, g_AM_HAL_GPIO_DISABLE);
80+ am_hal_gpio_pinconfig (_pinRX, g_AM_HAL_GPIO_DISABLE);
81+
82+ _handle = NULL ;
83+ }
7184}
7285
7386int Uart::available ()
@@ -93,7 +106,8 @@ int Uart::read()
93106
94107void Uart::flush ()
95108{
96- // todo:
109+ // Make sure the UART has finished sending everything it's going to send.
110+ am_hal_uart_tx_flush (_handle);
97111}
98112
99113size_t Uart::write (const uint8_t data)
You can’t perform that action at this time.
0 commit comments