From 1840c1aeb5a3f28cb58f094020f1f108c411eec3 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Fri, 29 Jan 2021 20:35:48 +0100 Subject: [PATCH] Moved 'rtx.h' out of 'interfaces' folder, since it now becomes a cross-platform component --- openrtx/include/cps.h | 2 +- openrtx/include/{interfaces => }/rtx.h | 8 +++++--- openrtx/src/threads.c | 16 ++++++++-------- openrtx/src/ui/ui.c | 12 ++++++------ 4 files changed, 20 insertions(+), 18 deletions(-) rename openrtx/include/{interfaces => }/rtx.h (94%) diff --git a/openrtx/include/cps.h b/openrtx/include/cps.h index 57b921e1..c358fcf1 100644 --- a/openrtx/include/cps.h +++ b/openrtx/include/cps.h @@ -23,8 +23,8 @@ #include #include -#include #include +#include /** * \enum admit_t Enumeration type defining the admission criteria to a the diff --git a/openrtx/include/interfaces/rtx.h b/openrtx/include/rtx.h similarity index 94% rename from openrtx/include/interfaces/rtx.h rename to openrtx/include/rtx.h index a89aa9df..5cfaaf34 100644 --- a/openrtx/include/interfaces/rtx.h +++ b/openrtx/include/rtx.h @@ -49,7 +49,7 @@ typedef struct rtxStatus_t; /** - * \enum bandwidth Enumeration type defining the bandwidth of the channel. + * \enum bandwidth Enumeration type defining the current rtx bandwidth. */ enum bandwidth { @@ -59,8 +59,7 @@ enum bandwidth }; /** - * \enum opmode Enumeration type defining the operating mode associated to each - * channel. + * \enum opmode Enumeration type defining the current rtx operating mode. */ enum opmode { @@ -68,6 +67,9 @@ enum opmode DMR = 1 /**< DMR */ }; +/** + * \enum opstatus Enumeration type defining the current rtx operating status. + */ enum opstatus { OFF = 0, /**< OFF */ diff --git a/openrtx/src/threads.c b/openrtx/src/threads.c index 2363f3cb..2684da71 100644 --- a/openrtx/src/threads.c +++ b/openrtx/src/threads.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include /* Mutex for concurrent access to state variable */ static OS_MUTEX state_mutex; @@ -100,7 +100,7 @@ static void ui_task(void *arg) event_t event = ((event_t) msg); // Lock mutex, read and write state - OSMutexPend(&state_mutex, 0u, OS_OPT_PEND_BLOCKING, 0u, &os_err); + OSMutexPend(&state_mutex, 0u, OS_OPT_PEND_BLOCKING, 0u, &os_err); // React to keypresses and update FSM inside state ui_updateFSM(event, &sync_rtx); // Update state local copy @@ -221,12 +221,12 @@ static void kbd_task(void *arg) event.type = EVENT_KBD; event.payload = msg.value; // Send keyboard status in queue - OSQPost(&ui_queue, (void *)event.value, sizeof(event_t), + OSQPost(&ui_queue, (void *)event.value, sizeof(event_t), OS_OPT_POST_FIFO + OS_OPT_POST_NO_SCHED, &os_err); } // Save current keyboard state as previous prev_keys = keys; - + // Read keyboard state at 20Hz OSTimeDlyHMSM(0u, 0u, 0u, 50u, OS_OPT_TIME_HMSM_STRICT, &os_err); } @@ -246,7 +246,7 @@ static void dev_task(void *arg) OSMutexPend(&state_mutex, 0u, OS_OPT_PEND_BLOCKING, 0u, &os_err); #ifdef HAS_RTC - state.time = rtc_getTime(); + state.time = rtc_getTime(); #endif state.v_bat = platform_getVbat(); state.charge = battery_getCharge(state.v_bat); @@ -258,9 +258,9 @@ static void dev_task(void *arg) event_t dev_msg; dev_msg.type = EVENT_STATUS; dev_msg.payload = 0; - OSQPost(&ui_queue, (void *)dev_msg.value, sizeof(event_t), + OSQPost(&ui_queue, (void *)dev_msg.value, sizeof(event_t), OS_OPT_POST_FIFO + OS_OPT_POST_NO_SCHED, &os_err); - + // Execute state update thread every 1s OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err); } @@ -310,7 +310,7 @@ void create_threads() OSMutexCreate((OS_MUTEX *) &display_mutex, (CPU_CHAR *) "Display Mutex", (OS_ERR *) &os_err); - + // State initialization, execute before starting all tasks state_init(); diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 8b7f23ed..38c3bea7 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -64,7 +64,7 @@ #include #include #include -#include +#include #include #include #include @@ -497,7 +497,7 @@ void _ui_fsm_confirmVFOInput(bool *sync_rtx) { // Otherwise set both frequencies else { - if(_ui_freq_check_limits(ui_state.new_rx_frequency) && + if(_ui_freq_check_limits(ui_state.new_rx_frequency) && _ui_freq_check_limits(ui_state.new_tx_frequency)) { state.channel.rx_frequency = ui_state.new_rx_frequency; @@ -519,7 +519,7 @@ void _ui_fsm_insertVFONumber(kbd_msg_t msg, bool *sync_rtx) { if(ui_state.input_position == 1) ui_state.new_rx_frequency = 0; // Calculate portion of the new RX frequency - ui_state.new_rx_frequency = _ui_freq_add_digit(ui_state.new_rx_frequency, + ui_state.new_rx_frequency = _ui_freq_add_digit(ui_state.new_rx_frequency, ui_state.input_position, ui_state.input_number); if(ui_state.input_position >= FREQ_DIGITS) { @@ -536,12 +536,12 @@ void _ui_fsm_insertVFONumber(kbd_msg_t msg, bool *sync_rtx) { if(ui_state.input_position == 1) ui_state.new_tx_frequency = 0; // Calculate portion of the new TX frequency - ui_state.new_tx_frequency = _ui_freq_add_digit(ui_state.new_tx_frequency, + ui_state.new_tx_frequency = _ui_freq_add_digit(ui_state.new_tx_frequency, ui_state.input_position, ui_state.input_number); if(ui_state.input_position >= FREQ_DIGITS) { // Save both inserted frequencies - if(_ui_freq_check_limits(ui_state.new_rx_frequency) && + if(_ui_freq_check_limits(ui_state.new_rx_frequency) && _ui_freq_check_limits(ui_state.new_tx_frequency)) { state.channel.rx_frequency = ui_state.new_rx_frequency; @@ -728,7 +728,7 @@ void ui_updateFSM(event_t event, bool *sync_rtx) // Save pressed number to calculare frequency and show in GUI ui_state.input_number = input_getPressedNumber(msg); // Calculate portion of the new frequency - ui_state.new_rx_frequency = _ui_freq_add_digit(ui_state.new_rx_frequency, + ui_state.new_rx_frequency = _ui_freq_add_digit(ui_state.new_rx_frequency, ui_state.input_position, ui_state.input_number); } break;