add SERCOM HAL Async library
Change-Id: I530a5bc5ee7e89149eb251bda0adf7963733d2ee
diff --git a/sysmoOCTSIM/examples/driver_examples.c b/sysmoOCTSIM/examples/driver_examples.c
index 56247ff..8384c87 100644
--- a/sysmoOCTSIM/examples/driver_examples.c
+++ b/sysmoOCTSIM/examples/driver_examples.c
@@ -12,12 +12,29 @@
/**
* Example of using UART_debug to write "Hello World" using the IO abstraction.
+ *
+ * Since the driver is asynchronous we need to use statically allocated memory for string
+ * because driver initiates transfer and then returns before the transmission is completed.
+ *
+ * Once transfer has been completed the tx_cb function will be called.
*/
+
+static uint8_t example_UART_debug[12] = "Hello World!";
+
+static void tx_cb_UART_debug(const struct usart_async_descriptor *const io_descr)
+{
+ /* Transfer completed */
+}
+
void UART_debug_example(void)
{
struct io_descriptor *io;
- usart_sync_get_io_descriptor(&UART_debug, &io);
- usart_sync_enable(&UART_debug);
- io_write(io, (uint8_t *)"Hello World!", 12);
+ usart_async_register_callback(&UART_debug, USART_ASYNC_TXC_CB, tx_cb_UART_debug);
+ /*usart_async_register_callback(&UART_debug, USART_ASYNC_RXC_CB, rx_cb);
+ usart_async_register_callback(&UART_debug, USART_ASYNC_ERROR_CB, err_cb);*/
+ usart_async_get_io_descriptor(&UART_debug, &io);
+ usart_async_enable(&UART_debug);
+
+ io_write(io, example_UART_debug, 12);
}