From c3646fd31ba9cd6a97500b449c1fcc0938ad5ad5 Mon Sep 17 00:00:00 2001 From: KaitlynAnn99 Date: Fri, 22 Nov 2024 16:01:04 -0500 Subject: [PATCH 1/3] added tiny --- test/include/double/tiny_uart_double.hpp | 5 +++++ test/src/tiny_uart_double.cpp | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/test/include/double/tiny_uart_double.hpp b/test/include/double/tiny_uart_double.hpp index 615bc94..6763743 100644 --- a/test/include/double/tiny_uart_double.hpp +++ b/test/include/double/tiny_uart_double.hpp @@ -44,4 +44,9 @@ void tiny_uart_double_trigger_receive(tiny_uart_double_t* self, uint8_t byte); */ void tiny_uart_double_configure_automatic_send_complete(tiny_uart_double_t* self, bool enabled); +/*! + * When enabled, the double will raise a receive event when a byte is sent. Defaults to disabled. + */ +void tiny_uart_double_enable_echo(tiny_uart_double_t* self); + #endif diff --git a/test/src/tiny_uart_double.cpp b/test/src/tiny_uart_double.cpp index f49d3c6..03e299e 100644 --- a/test/src/tiny_uart_double.cpp +++ b/test/src/tiny_uart_double.cpp @@ -16,6 +16,9 @@ static void send(i_tiny_uart_t* _self, uint8_t byte) if(self->automatic_send_complete) { tiny_uart_double_trigger_send_complete(self); } + if(self->echoing) { + tiny_uart_double_trigger_receive(self, byte); + } } static i_tiny_event_t* on_send_complete(i_tiny_uart_t* _self) @@ -62,3 +65,8 @@ void tiny_uart_double_configure_automatic_send_complete(tiny_uart_double_t* self { self->automatic_send_complete = enabled; } + +void tiny_uart_double_enable_echo(tiny_uart_double_t* self) +{ + self->echoing = true; +} From 2f08dddbb0b1b812520bc868b7fd3e1085d77ac8 Mon Sep 17 00:00:00 2001 From: KaitlynAnn99 Date: Fri, 22 Nov 2024 16:12:08 -0500 Subject: [PATCH 2/3] lol whoops --- test/include/double/tiny_uart_double.hpp | 1 + test/src/tiny_uart_double.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/test/include/double/tiny_uart_double.hpp b/test/include/double/tiny_uart_double.hpp index 6763743..62451c4 100644 --- a/test/include/double/tiny_uart_double.hpp +++ b/test/include/double/tiny_uart_double.hpp @@ -17,6 +17,7 @@ typedef struct { tiny_event_t send_complete; bool automatic_send_complete; bool sending; + bool echoing; } tiny_uart_double_t; /*! diff --git a/test/src/tiny_uart_double.cpp b/test/src/tiny_uart_double.cpp index 03e299e..aae5e5a 100644 --- a/test/src/tiny_uart_double.cpp +++ b/test/src/tiny_uart_double.cpp @@ -40,6 +40,8 @@ void tiny_uart_double_init(tiny_uart_double_t* self) self->interface.api = &api; self->sending = false; self->automatic_send_complete = false; + self->echoing = false; + tiny_event_init(&self->send_complete); tiny_event_init(&self->receive); } From 3e4c08617edc0aac7687a6d4069f204bf7974242 Mon Sep 17 00:00:00 2001 From: KaitlynAnn99 Date: Fri, 22 Nov 2024 16:12:32 -0500 Subject: [PATCH 3/3] whitespace --- test/src/tiny_uart_double.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/src/tiny_uart_double.cpp b/test/src/tiny_uart_double.cpp index aae5e5a..cfac8f8 100644 --- a/test/src/tiny_uart_double.cpp +++ b/test/src/tiny_uart_double.cpp @@ -16,6 +16,7 @@ static void send(i_tiny_uart_t* _self, uint8_t byte) if(self->automatic_send_complete) { tiny_uart_double_trigger_send_complete(self); } + if(self->echoing) { tiny_uart_double_trigger_receive(self, byte); }