aboutsummaryrefslogtreecommitdiff
path: root/tests/test_usart.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2020-11-24 13:46:41 -0700
committerJosh Rahm <joshuarahm@gmail.com>2020-11-24 13:46:41 -0700
commit93b063fedfcf7409a67df035170ea5670cad22e1 (patch)
treea23321a7465d966b1ccf196ca00e65a70c9f9110 /tests/test_usart.c
parentb040195d31df6ad759f16ea3456471897f55daa1 (diff)
downloadstm32l4-93b063fedfcf7409a67df035170ea5670cad22e1.tar.gz
stm32l4-93b063fedfcf7409a67df035170ea5670cad22e1.tar.bz2
stm32l4-93b063fedfcf7409a67df035170ea5670cad22e1.zip
Moved action to top level.
Removed old iterations of the project and moved the files from 02-usart to the root directory since that's the sole place where the action is and that subproject has outgrown its initial title.
Diffstat (limited to 'tests/test_usart.c')
-rw-r--r--tests/test_usart.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_usart.c b/tests/test_usart.c
new file mode 100644
index 0000000..b19d687
--- /dev/null
+++ b/tests/test_usart.c
@@ -0,0 +1,22 @@
+#include "test_harness.h"
+#include "arch/stm32l4xxx/peripherals/usart.h"
+
+#include <stdlib.h>
+
+TEST(usart, enable_dma)
+{
+ __IO usart_t* usart = &USART1;
+
+ usart->c_r3 = 0;
+
+ usart_enable_dma(usart, USART_ENABLE_TX);
+ ASSERT_EQ(usart->c_r3, 128);
+
+ usart_enable_dma(usart, USART_ENABLE_RX);
+ ASSERT_EQ(usart->c_r3, 192);
+
+ usart_enable_dma(usart, USART_ENABLE_DISABLED);
+ ASSERT_EQ(usart->c_r3, 0);
+
+ return 0;
+}