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)
67
67
68
68
void Uart::end ()
69
69
{
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
+ }
71
84
}
72
85
73
86
int Uart::available ()
@@ -93,7 +106,8 @@ int Uart::read()
93
106
94
107
void Uart::flush ()
95
108
{
96
- // todo:
109
+ // Make sure the UART has finished sending everything it's going to send.
110
+ am_hal_uart_tx_flush (_handle);
97
111
}
98
112
99
113
size_t Uart::write (const uint8_t data)
You can’t perform that action at this time.
0 commit comments