kopia lustrzana https://github.com/OpenRTX/OpenRTX
Added function to radio API allowing to fine tune the radio's VCXO polarisation voltage. Currently, this functionality is effective only on MD-3x0 devices. (TG-195 #ready-for-test)
rodzic
b29b24fdc0
commit
66552be403
|
@ -23,14 +23,16 @@
|
|||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* This function returns true if at least one number is pressed on the
|
||||
/**
|
||||
* This function returns true if at least one number is pressed on the
|
||||
* keyboard.
|
||||
* @param msg: the keyboard queue message
|
||||
* @return true if at least a number is pressed on the keyboard
|
||||
*/
|
||||
bool input_isNumberPressed(kbd_msg_t msg);
|
||||
|
||||
/* This function returns the smallest number that is pressed on the keyboard,
|
||||
/**
|
||||
* This function returns the smallest number that is pressed on the keyboard,
|
||||
* 0 if none is pressed.
|
||||
* @param msg: the keyboard queue message
|
||||
* @return the smalled pressed number on the keyboard
|
||||
|
|
|
@ -55,6 +55,19 @@ void radio_init(const rtxStatus_t *rtxState);
|
|||
*/
|
||||
void radio_terminate();
|
||||
|
||||
/**
|
||||
* This function allows to fine tune the VCXO frequency by acting on the
|
||||
* polarisation voltage.
|
||||
* The offset parameters allowed range of ±32768 and they are algebraically
|
||||
* added to the tuning value provided by the manufacturer's calibration data.
|
||||
* Not calling this function results in leaving the VCXO tuning as provided by
|
||||
* the manufacturer's calibration data.
|
||||
*
|
||||
* @param vhfOffset: VCXO tuning offset for VHF band.
|
||||
* @param uhfOffset: VCXO tuning offset for UHF band.
|
||||
*/
|
||||
void radio_tuneVcxo(const int16_t vhfOffset, const int16_t uhfOffset);
|
||||
|
||||
/**
|
||||
* Set current operating mode.
|
||||
*
|
||||
|
|
|
@ -96,6 +96,14 @@ void radio_terminate()
|
|||
SIM->SCGC6 &= ~SIM_SCGC6_DAC0_MASK;
|
||||
}
|
||||
|
||||
void radio_tuneVcxo(const int16_t vhfOffset, const int16_t uhfOffset)
|
||||
{
|
||||
//TODO: this part will be implemented in the future, when proved to be
|
||||
// necessary.
|
||||
(void) vhfOffset;
|
||||
(void) uhfOffset;
|
||||
}
|
||||
|
||||
void radio_setOpmode(const enum opmode mode)
|
||||
{
|
||||
switch(mode)
|
||||
|
|
|
@ -160,6 +160,29 @@ void radio_terminate()
|
|||
RCC->APB1ENR &= ~RCC_APB1ENR_DACEN;
|
||||
}
|
||||
|
||||
void radio_tuneVcxo(const int16_t vhfOffset, const int16_t uhfOffset)
|
||||
{
|
||||
(void) vhfOffset;
|
||||
|
||||
/*
|
||||
* Adjust VCXO bias voltage acting on the value stored in MCU's DAC.
|
||||
* Data from calibration is first converted to int16_t, then the value for
|
||||
* the DAC register is computed according to which is done inside TYT's
|
||||
* firmware.
|
||||
* The signed offset is then added to this value, the result is constrained
|
||||
* in the range [0 4095], converted to uint16_t and written into the DAC
|
||||
* register.
|
||||
*
|
||||
* NOTE: we deliberately chose not to update the HR_C5000 modulation offset
|
||||
* register, as we still have to deeply understand how TYT computes
|
||||
* the values written there.
|
||||
*/
|
||||
int16_t calValue = static_cast< int16_t >(calData->freqAdjustMid);
|
||||
int16_t oscTune = (calValue*4 + 0x600) + uhfOffset;
|
||||
oscTune = std::max(std::min(oscTune, int16_t(4095)), int16_t(0));
|
||||
DAC->DHR12R2 = static_cast< uint16_t >(oscTune);
|
||||
}
|
||||
|
||||
void radio_setOpmode(const enum opmode mode)
|
||||
{
|
||||
switch(mode)
|
||||
|
|
|
@ -30,6 +30,12 @@ void radio_terminate()
|
|||
|
||||
}
|
||||
|
||||
void radio_tuneVcxo(const int16_t vhfOffset, const int16_t uhfOffset)
|
||||
{
|
||||
(void) vhfOffset;
|
||||
(void) uhfOffset;
|
||||
}
|
||||
|
||||
void radio_setOpmode(const enum opmode mode)
|
||||
{
|
||||
(void) mode;
|
||||
|
@ -37,7 +43,7 @@ void radio_setOpmode(const enum opmode mode)
|
|||
|
||||
bool radio_checkRxDigitalSquelch()
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void radio_enableRx()
|
||||
|
|
|
@ -100,6 +100,14 @@ void radio_terminate()
|
|||
RCC->APB1ENR &= ~RCC_APB1ENR_DACEN;
|
||||
}
|
||||
|
||||
void radio_tuneVcxo(const int16_t vhfOffset, const int16_t uhfOffset)
|
||||
{
|
||||
//TODO: this part will be implemented in the future, when proved to be
|
||||
// necessary.
|
||||
(void) vhfOffset;
|
||||
(void) uhfOffset;
|
||||
}
|
||||
|
||||
void radio_setOpmode(const enum opmode mode)
|
||||
{
|
||||
switch(mode)
|
||||
|
|
|
@ -33,6 +33,13 @@ void radio_terminate()
|
|||
puts("radio_linux: terminate() called");
|
||||
}
|
||||
|
||||
void radio_tuneVcxo(const int16_t vhfOffset, const int16_t uhfOffset)
|
||||
{
|
||||
(void) vhfOffset;
|
||||
(void) uhfOffset;
|
||||
puts("radio_linux: tuneVcxo() called");
|
||||
}
|
||||
|
||||
void radio_setOpmode(const enum opmode mode)
|
||||
{
|
||||
std::string mStr(" ");
|
||||
|
|
Ładowanie…
Reference in New Issue