diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-06-05 21:21:28 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-06-05 21:21:28 +0200 |
commit | 310c2837836d24e1335eafed4fda2701570c1760 (patch) | |
tree | 5dec2822850656080ff0dcf89d2772a057e56c8c | |
parent | 8618657695b2530f463d1e7e0fca11304d2b897e (diff) | |
download | glutte-o-matic-310c2837836d24e1335eafed4fda2701570c1760.tar.gz glutte-o-matic-310c2837836d24e1335eafed4fda2701570c1760.tar.bz2 glutte-o-matic-310c2837836d24e1335eafed4fda2701570c1760.zip |
Create objects for common/ fsm main minmea
-rw-r--r-- | src/common/includes/Core/fsm.h | 3 | ||||
-rw-r--r-- | src/common/sourcelist.txt | 3 | ||||
-rw-r--r-- | src/common/src/Core/fsm.c | 3 | ||||
-rw-r--r-- | src/glutt-o-logique/fsm.c | 4 | ||||
-rw-r--r-- | src/glutt-o-logique/main.c | 2 | ||||
-rw-r--r-- | src/glutt-o-logique/minmea.c | 1 | ||||
-rw-r--r-- | src/simulator/src/Core/fsm.c | 40 | ||||
-rw-r--r-- | src/simulator/src/Core/main.c | 12 | ||||
-rw-r--r-- | src/simulator/src/GPS/minema.c | 1 | ||||
-rw-r--r-- | src/simulator/src/Gui/gui.c | 4 |
10 files changed, 51 insertions, 22 deletions
diff --git a/src/common/includes/Core/fsm.h b/src/common/includes/Core/fsm.h index 41f0503..c061597 100644 --- a/src/common/includes/Core/fsm.h +++ b/src/common/includes/Core/fsm.h @@ -99,5 +99,8 @@ void fsm_update_inputs(struct fsm_input_signals_t* inputs); // Getter for outputs void fsm_get_outputs(struct fsm_output_signals_t* out); +// Announce a state change +void fsm_state_switched(const char *new_state); + #endif // _FSM_H_ diff --git a/src/common/sourcelist.txt b/src/common/sourcelist.txt index 4c85b65..350c037 100644 --- a/src/common/sourcelist.txt +++ b/src/common/sourcelist.txt @@ -1,5 +1,8 @@ src/GPIO/usart.c src/GPS/gps.c +src/GPS/minmea.c src/Core/common.c +src/Core/fsm.c +src/Core/main.c src/Audio/cw.c src/Audio/audio.c diff --git a/src/common/src/Core/fsm.c b/src/common/src/Core/fsm.c index e5d7ca7..d2c95f6 100644 --- a/src/common/src/Core/fsm.c +++ b/src/common/src/Core/fsm.c @@ -36,9 +36,6 @@ static fsm_state_t current_state; // in ms using the timestamp_now() function static uint64_t timestamp_state[_NUM_FSM_STATES]; - -void fsm_state_switched(char * new_state); - void fsm_init() { memset(&fsm_in, 0, sizeof(fsm_in)); memset(&fsm_out, 0, sizeof(fsm_out)); diff --git a/src/glutt-o-logique/fsm.c b/src/glutt-o-logique/fsm.c index edc6f6f..bc39030 100644 --- a/src/glutt-o-logique/fsm.c +++ b/src/glutt-o-logique/fsm.c @@ -22,10 +22,10 @@ * SOFTWARE. */ -#include "../common/src/Core/fsm.c" +#include "Core/fsm.h" #include "GPIO/usart.h" -void fsm_state_switched(char * new_state) { +void fsm_state_switched(const char *new_state) { usart_debug_puts_header("FSM: ", new_state); } diff --git a/src/glutt-o-logique/main.c b/src/glutt-o-logique/main.c index 4ffc3dc..6d4597e 100644 --- a/src/glutt-o-logique/main.c +++ b/src/glutt-o-logique/main.c @@ -25,8 +25,6 @@ #include "stm32f4xx_conf.h" #include "leds.h" -#include "../common/src/Core/main.c" - void init() { /* Initialise the onboard peripherals diff --git a/src/glutt-o-logique/minmea.c b/src/glutt-o-logique/minmea.c deleted file mode 100644 index 0fe2966..0000000 --- a/src/glutt-o-logique/minmea.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/src/GPS/minmea.c" diff --git a/src/simulator/src/Core/fsm.c b/src/simulator/src/Core/fsm.c index 4c52525..8c761fd 100644 --- a/src/simulator/src/Core/fsm.c +++ b/src/simulator/src/Core/fsm.c @@ -1,11 +1,35 @@ -#include "../../../common/src/Core/fsm.c" - - -extern char * gui_last_fsm_states[]; -extern int * gui_last_fsm_states_timestamps[]; - - -void fsm_state_switched(char * new_state) { +/* + * The MIT License (MIT) + * + * Copyright (c) 2016 Matthias P. Braendli, Maximilien Cuony + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. +*/ + +#include "Core/fsm.h" +#include "GPIO/usart.h" +#include <time.h> + +extern const char * gui_last_fsm_states[]; +extern int gui_last_fsm_states_timestamps[]; + +void fsm_state_switched(const char *new_state) { usart_debug_puts_header("FSM: ", new_state); for (int i = 8; i >= 0; i--) { diff --git a/src/simulator/src/Core/main.c b/src/simulator/src/Core/main.c index 911191b..faf7fd7 100644 --- a/src/simulator/src/Core/main.c +++ b/src/simulator/src/Core/main.c @@ -22,10 +22,16 @@ * SOFTWARE. */ -#include "../../../common/src/Core/main.c" - #include <pthread.h> - +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "timers.h" +#include "semphr.h" static void thread_gui(void *arg) { main_gui(); diff --git a/src/simulator/src/GPS/minema.c b/src/simulator/src/GPS/minema.c deleted file mode 100644 index 10df198..0000000 --- a/src/simulator/src/GPS/minema.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../../common/src/GPS/minmea.c" diff --git a/src/simulator/src/Gui/gui.c b/src/simulator/src/Gui/gui.c index 42376ed..713b18a 100644 --- a/src/simulator/src/Gui/gui.c +++ b/src/simulator/src/Gui/gui.c @@ -132,8 +132,8 @@ int in_u = 0; int in_d = 0; int in_fax_n = 1; -char * gui_last_fsm_states[] = {"", "", "", "", "", "", "", "", "", ""}; -int * gui_last_fsm_states_timestamps[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +const char * gui_last_fsm_states[] = {"", "", "", "", "", "", "", "", "", ""}; +int gui_last_fsm_states_timestamps[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int auto_scroll_uart = 1; |