Moved 'rtx.h' out of 'interfaces' folder, since it now becomes a cross-platform component
This commit is contained in:
parent
2fee6d0d06
commit
1840c1aeb5
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <interfaces/rtx.h>
|
|
||||||
#include <datatypes.h>
|
#include <datatypes.h>
|
||||||
|
#include <rtx.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \enum admit_t Enumeration type defining the admission criteria to a the
|
* \enum admit_t Enumeration type defining the admission criteria to a the
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ typedef struct
|
||||||
rtxStatus_t;
|
rtxStatus_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \enum bandwidth Enumeration type defining the bandwidth of the channel.
|
* \enum bandwidth Enumeration type defining the current rtx bandwidth.
|
||||||
*/
|
*/
|
||||||
enum bandwidth
|
enum bandwidth
|
||||||
{
|
{
|
||||||
|
|
@ -59,8 +59,7 @@ enum bandwidth
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \enum opmode Enumeration type defining the operating mode associated to each
|
* \enum opmode Enumeration type defining the current rtx operating mode.
|
||||||
* channel.
|
|
||||||
*/
|
*/
|
||||||
enum opmode
|
enum opmode
|
||||||
{
|
{
|
||||||
|
|
@ -68,6 +67,9 @@ enum opmode
|
||||||
DMR = 1 /**< DMR */
|
DMR = 1 /**< DMR */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \enum opstatus Enumeration type defining the current rtx operating status.
|
||||||
|
*/
|
||||||
enum opstatus
|
enum opstatus
|
||||||
{
|
{
|
||||||
OFF = 0, /**< OFF */
|
OFF = 0, /**< OFF */
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <interfaces/platform.h>
|
#include <interfaces/platform.h>
|
||||||
#include <hwconfig.h>
|
#include <hwconfig.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <interfaces/rtx.h>
|
#include <rtx.h>
|
||||||
|
|
||||||
/* Mutex for concurrent access to state variable */
|
/* Mutex for concurrent access to state variable */
|
||||||
static OS_MUTEX state_mutex;
|
static OS_MUTEX state_mutex;
|
||||||
|
|
@ -100,7 +100,7 @@ static void ui_task(void *arg)
|
||||||
event_t event = ((event_t) msg);
|
event_t event = ((event_t) msg);
|
||||||
|
|
||||||
// Lock mutex, read and write state
|
// 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
|
// React to keypresses and update FSM inside state
|
||||||
ui_updateFSM(event, &sync_rtx);
|
ui_updateFSM(event, &sync_rtx);
|
||||||
// Update state local copy
|
// Update state local copy
|
||||||
|
|
@ -221,12 +221,12 @@ static void kbd_task(void *arg)
|
||||||
event.type = EVENT_KBD;
|
event.type = EVENT_KBD;
|
||||||
event.payload = msg.value;
|
event.payload = msg.value;
|
||||||
// Send keyboard status in queue
|
// 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);
|
OS_OPT_POST_FIFO + OS_OPT_POST_NO_SCHED, &os_err);
|
||||||
}
|
}
|
||||||
// Save current keyboard state as previous
|
// Save current keyboard state as previous
|
||||||
prev_keys = keys;
|
prev_keys = keys;
|
||||||
|
|
||||||
// Read keyboard state at 20Hz
|
// Read keyboard state at 20Hz
|
||||||
OSTimeDlyHMSM(0u, 0u, 0u, 50u, OS_OPT_TIME_HMSM_STRICT, &os_err);
|
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);
|
OSMutexPend(&state_mutex, 0u, OS_OPT_PEND_BLOCKING, 0u, &os_err);
|
||||||
|
|
||||||
#ifdef HAS_RTC
|
#ifdef HAS_RTC
|
||||||
state.time = rtc_getTime();
|
state.time = rtc_getTime();
|
||||||
#endif
|
#endif
|
||||||
state.v_bat = platform_getVbat();
|
state.v_bat = platform_getVbat();
|
||||||
state.charge = battery_getCharge(state.v_bat);
|
state.charge = battery_getCharge(state.v_bat);
|
||||||
|
|
@ -258,9 +258,9 @@ static void dev_task(void *arg)
|
||||||
event_t dev_msg;
|
event_t dev_msg;
|
||||||
dev_msg.type = EVENT_STATUS;
|
dev_msg.type = EVENT_STATUS;
|
||||||
dev_msg.payload = 0;
|
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);
|
OS_OPT_POST_FIFO + OS_OPT_POST_NO_SCHED, &os_err);
|
||||||
|
|
||||||
// Execute state update thread every 1s
|
// Execute state update thread every 1s
|
||||||
OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err);
|
OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err);
|
||||||
}
|
}
|
||||||
|
|
@ -310,7 +310,7 @@ void create_threads()
|
||||||
OSMutexCreate((OS_MUTEX *) &display_mutex,
|
OSMutexCreate((OS_MUTEX *) &display_mutex,
|
||||||
(CPU_CHAR *) "Display Mutex",
|
(CPU_CHAR *) "Display Mutex",
|
||||||
(OS_ERR *) &os_err);
|
(OS_ERR *) &os_err);
|
||||||
|
|
||||||
// State initialization, execute before starting all tasks
|
// State initialization, execute before starting all tasks
|
||||||
state_init();
|
state_init();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <ui.h>
|
#include <ui.h>
|
||||||
#include <interfaces/rtx.h>
|
#include <rtx.h>
|
||||||
#include <interfaces/platform.h>
|
#include <interfaces/platform.h>
|
||||||
#include <interfaces/nvmem.h>
|
#include <interfaces/nvmem.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -497,7 +497,7 @@ void _ui_fsm_confirmVFOInput(bool *sync_rtx) {
|
||||||
// Otherwise set both frequencies
|
// Otherwise set both frequencies
|
||||||
else
|
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))
|
_ui_freq_check_limits(ui_state.new_tx_frequency))
|
||||||
{
|
{
|
||||||
state.channel.rx_frequency = ui_state.new_rx_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)
|
if(ui_state.input_position == 1)
|
||||||
ui_state.new_rx_frequency = 0;
|
ui_state.new_rx_frequency = 0;
|
||||||
// Calculate portion of the new RX frequency
|
// 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);
|
ui_state.input_position, ui_state.input_number);
|
||||||
if(ui_state.input_position >= FREQ_DIGITS)
|
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)
|
if(ui_state.input_position == 1)
|
||||||
ui_state.new_tx_frequency = 0;
|
ui_state.new_tx_frequency = 0;
|
||||||
// Calculate portion of the new TX frequency
|
// 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);
|
ui_state.input_position, ui_state.input_number);
|
||||||
if(ui_state.input_position >= FREQ_DIGITS)
|
if(ui_state.input_position >= FREQ_DIGITS)
|
||||||
{
|
{
|
||||||
// Save both inserted frequencies
|
// 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))
|
_ui_freq_check_limits(ui_state.new_tx_frequency))
|
||||||
{
|
{
|
||||||
state.channel.rx_frequency = ui_state.new_rx_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
|
// Save pressed number to calculare frequency and show in GUI
|
||||||
ui_state.input_number = input_getPressedNumber(msg);
|
ui_state.input_number = input_getPressedNumber(msg);
|
||||||
// Calculate portion of the new frequency
|
// 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);
|
ui_state.input_position, ui_state.input_number);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue