aboutsummaryrefslogtreecommitdiffstats
path: root/src/simulator
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-06-05 20:28:32 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-06-05 20:28:32 +0200
commit97a104555de59091124a854cad3a5a4ff6bd285b (patch)
treef3f0bcb9cdcaa908bc3384da1759bef6998acf40 /src/simulator
parentff3d9f84a14ca5c2d4c44bf946b0f0def8abe6b6 (diff)
downloadglutte-o-matic-97a104555de59091124a854cad3a5a4ff6bd285b.tar.gz
glutte-o-matic-97a104555de59091124a854cad3a5a4ff6bd285b.tar.bz2
glutte-o-matic-97a104555de59091124a854cad3a5a4ff6bd285b.zip
Fix USART concurrency, create common usart object
Diffstat (limited to 'src/simulator')
-rw-r--r--src/simulator/Makefile4
-rw-r--r--src/simulator/src/Core/fsm.c4
-rw-r--r--src/simulator/src/GPIO/usart.c16
3 files changed, 7 insertions, 17 deletions
diff --git a/src/simulator/Makefile b/src/simulator/Makefile
index 663570e..484ddda 100644
--- a/src/simulator/Makefile
+++ b/src/simulator/Makefile
@@ -31,6 +31,10 @@ C_FILES += timers.c
C_FILES += heap_3.c
C_FILES += port.c
+# common Objects
+COMMON_SOURCE_LIST=$(shell cat ../common/sourcelist.txt)
+C_FILES+=$(COMMON_SOURCE_LIST:%.c=../common/%.c)
+
# Main Object
SRC_SOURCES+=$(shell find -L src/ -name '*.c')
C_FILES += $(SRC_SOURCES)
diff --git a/src/simulator/src/Core/fsm.c b/src/simulator/src/Core/fsm.c
index 6f771c2..4c52525 100644
--- a/src/simulator/src/Core/fsm.c
+++ b/src/simulator/src/Core/fsm.c
@@ -6,9 +6,7 @@ extern int * gui_last_fsm_states_timestamps[];
void fsm_state_switched(char * new_state) {
- usart_debug_puts("FSM: ");
- usart_debug_puts_no_header(new_state);
- usart_debug_puts_no_header("\r\n");
+ usart_debug_puts_header("FSM: ", new_state);
for (int i = 8; i >= 0; i--) {
gui_last_fsm_states[i + 1] = gui_last_fsm_states[i];
diff --git a/src/simulator/src/GPIO/usart.c b/src/simulator/src/GPIO/usart.c
index 650602a..37822d6 100644
--- a/src/simulator/src/GPIO/usart.c
+++ b/src/simulator/src/GPIO/usart.c
@@ -23,19 +23,7 @@
*/
-#define USART_TypeDef int
-
-int _USART2 = 2;
-int _USART3 = 3;
-
-#define USART2 &_USART2
-#define USART3 &_USART3
-
-static void usart_puts(USART_TypeDef*, const char*);
-
#include "../../../common/includes/GPIO/usart.h"
-#include "../../../common/src/GPIO/usart.c"
-
extern char uart_recv_txt[4096];
int uart_recv_pointer = 0;
@@ -68,9 +56,9 @@ void usart_move_buffer_up() {
}
// Make sure Tasks are suspended when this is called!
-static void usart_puts(USART_TypeDef* USART, const char* str) {
+void usart_puts(USART_TypeDef* USART, const char* str) {
- if (*USART == _USART2) {
+ if (USART == USART2) {
while(*str) {
if (*str != '\r') {
uart_recv_txt[uart_recv_pointer+1] = '\0';