Improved RX activation mechanism in rtx driver
This commit is contained in:
parent
061c90cfb4
commit
6dfbd2419d
|
|
@ -26,13 +26,13 @@
|
||||||
#include <interfaces/gpio.h>
|
#include <interfaces/gpio.h>
|
||||||
#include <hwconfig.h>
|
#include <hwconfig.h>
|
||||||
|
|
||||||
|
|
||||||
OS_MUTEX *cfgMutex; /* Mutex for incoming config messages */
|
OS_MUTEX *cfgMutex; /* Mutex for incoming config messages */
|
||||||
OS_Q cfgMailbox; /* Queue for incoming config messages */
|
OS_Q cfgMailbox; /* Queue for incoming config messages */
|
||||||
|
|
||||||
rtxStatus_t rtxStatus; /* RTX driver status */
|
rtxStatus_t rtxStatus; /* RTX driver status */
|
||||||
|
|
||||||
bool sqlOpen; /* Flag for squlech open/close */
|
bool sqlOpen; /* Flag for squelch open/close */
|
||||||
|
bool enterRx; /* Flag for RX mode activation */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These functions below provide a basic API for audio path management. They
|
* These functions below provide a basic API for audio path management. They
|
||||||
|
|
@ -127,6 +127,7 @@ void rtx_init(OS_MUTEX *m)
|
||||||
rtxStatus.txTone = 0;
|
rtxStatus.txTone = 0;
|
||||||
|
|
||||||
sqlOpen = false;
|
sqlOpen = false;
|
||||||
|
enterRx = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialise low-level platform-specific driver
|
* Initialise low-level platform-specific driver
|
||||||
|
|
@ -225,17 +226,10 @@ void rtx_taskFunc()
|
||||||
radio_setVcoFrequency(rtxStatus.rxFrequency, false);
|
radio_setVcoFrequency(rtxStatus.rxFrequency, false);
|
||||||
radio_enableRx();
|
radio_enableRx();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: temporarily force to RX mode if rtx is off. */
|
/* TODO: temporarily force to RX mode if rtx is off. */
|
||||||
if(rtxStatus.opStatus == OFF)
|
if(rtxStatus.opStatus == OFF) enterRx = true;
|
||||||
{
|
}
|
||||||
radio_disableRtx();
|
|
||||||
|
|
||||||
radio_setVcoFrequency(rtxStatus.rxFrequency, false);
|
|
||||||
radio_enableRx();
|
|
||||||
rtxStatus.opStatus = RX;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RX logic */
|
/* RX logic */
|
||||||
|
|
@ -259,6 +253,15 @@ void rtx_taskFunc()
|
||||||
sqlOpen = false;
|
sqlOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if((rtxStatus.opMode == OFF) && enterRx)
|
||||||
|
{
|
||||||
|
radio_disableRtx();
|
||||||
|
|
||||||
|
radio_setVcoFrequency(rtxStatus.rxFrequency, false);
|
||||||
|
radio_enableRx();
|
||||||
|
rtxStatus.opStatus = RX;
|
||||||
|
enterRx = false;
|
||||||
|
}
|
||||||
|
|
||||||
/* TX logic */
|
/* TX logic */
|
||||||
if(platform_getPttStatus() && (rtxStatus.opStatus != TX))
|
if(platform_getPttStatus() && (rtxStatus.opStatus != TX))
|
||||||
|
|
@ -278,6 +281,7 @@ void rtx_taskFunc()
|
||||||
radio_disableRtx();
|
radio_disableRtx();
|
||||||
|
|
||||||
rtxStatus.opStatus = OFF;
|
rtxStatus.opStatus = OFF;
|
||||||
|
enterRx = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Led control logic */
|
/* Led control logic */
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,21 @@ void create_threads()
|
||||||
// State initialization, execute before starting all tasks
|
// State initialization, execute before starting all tasks
|
||||||
state_init();
|
state_init();
|
||||||
|
|
||||||
|
// Create rtx radio thread
|
||||||
|
OSTaskCreate((OS_TCB *) &rtx_tcb,
|
||||||
|
(CPU_CHAR *) "RTX Task",
|
||||||
|
(OS_TASK_PTR ) rtx_task,
|
||||||
|
(void *) 0,
|
||||||
|
(OS_PRIO ) 5,
|
||||||
|
(CPU_STK *) &rtx_stk[0],
|
||||||
|
(CPU_STK ) 0,
|
||||||
|
(CPU_STK_SIZE) RTX_TASK_STKSIZE/sizeof(CPU_STK),
|
||||||
|
(OS_MSG_QTY ) 0,
|
||||||
|
(OS_TICK ) 0,
|
||||||
|
(void *) 0,
|
||||||
|
(OS_OPT ) (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
|
||||||
|
(OS_ERR *) &os_err);
|
||||||
|
|
||||||
// Create UI thread
|
// Create UI thread
|
||||||
OSTaskCreate((OS_TCB *) &ui_tcb,
|
OSTaskCreate((OS_TCB *) &ui_tcb,
|
||||||
(CPU_CHAR *) "UI Task",
|
(CPU_CHAR *) "UI Task",
|
||||||
|
|
@ -358,19 +373,4 @@ void create_threads()
|
||||||
(void *) 0,
|
(void *) 0,
|
||||||
(OS_OPT ) (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
|
(OS_OPT ) (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
|
||||||
(OS_ERR *) &os_err);
|
(OS_ERR *) &os_err);
|
||||||
|
|
||||||
// Create rtx radio thread
|
|
||||||
OSTaskCreate((OS_TCB *) &rtx_tcb,
|
|
||||||
(CPU_CHAR *) "RTX Task",
|
|
||||||
(OS_TASK_PTR ) rtx_task,
|
|
||||||
(void *) 0,
|
|
||||||
(OS_PRIO ) 5,
|
|
||||||
(CPU_STK *) &rtx_stk[0],
|
|
||||||
(CPU_STK ) 0,
|
|
||||||
(CPU_STK_SIZE) RTX_TASK_STKSIZE/sizeof(CPU_STK),
|
|
||||||
(OS_MSG_QTY ) 0,
|
|
||||||
(OS_TICK ) 0,
|
|
||||||
(void *) 0,
|
|
||||||
(OS_OPT ) (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
|
|
||||||
(OS_ERR *) &os_err);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue