From 4d68f02ab4422336b5c7b10db103f5757d2b0cd8 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Mon, 24 May 2021 14:32:35 +0200 Subject: [PATCH] Updated documetation for radio.h API, removed old baseband C source files. --- meson.build | 2 +- openrtx/include/interfaces/radio.h | 40 ++- platform/drivers/baseband/radio_GDx.c | 316 ------------------ platform/drivers/baseband/radio_MD3x0.cpp | 2 +- .../{radio_MD9600.c => radio_MD9600.cpp} | 43 +-- platform/drivers/baseband/radio_UV3x0.c | 282 ---------------- platform/drivers/baseband/radio_UV3x0.cpp | 2 +- platform/drivers/baseband/radio_linux.c | 94 ------ 8 files changed, 51 insertions(+), 730 deletions(-) delete mode 100644 platform/drivers/baseband/radio_GDx.c rename platform/drivers/baseband/{radio_MD9600.c => radio_MD9600.cpp} (71%) delete mode 100644 platform/drivers/baseband/radio_UV3x0.c delete mode 100644 platform/drivers/baseband/radio_linux.c diff --git a/meson.build b/meson.build index 5c519692..c307ba67 100644 --- a/meson.build +++ b/meson.build @@ -250,7 +250,7 @@ md9600_src = src + mdx_src + stm32f405_src + ['platform/targets/MD-9600/platform 'platform/drivers/display/ST7567_MD9600.c', 'platform/drivers/keyboard/keyboard_MD9600.c', 'platform/drivers/chSelector/chSelector_MD9600.c', - 'platform/drivers/baseband/radio_MD9600.c', + 'platform/drivers/baseband/radio_MD9600.cpp', 'platform/drivers/NVM/nvmem_MD9600.c', 'platform/drivers/NVM/spiFlash_MD9600.c'] diff --git a/openrtx/include/interfaces/radio.h b/openrtx/include/interfaces/radio.h index 4e129995..6a78cf86 100644 --- a/openrtx/include/interfaces/radio.h +++ b/openrtx/include/interfaces/radio.h @@ -1,8 +1,8 @@ /*************************************************************************** - * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * Silvano Seva IU2KWO * + * Copyright (C) 2020, 2021 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN * + * Frederik Saraci IU2NRO * + * Silvano Seva IU2KWO * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -34,10 +34,19 @@ extern "C" { * rtx driver. Top level application code normally does not have to call directly * the API functions provided here, since all the transceiver managment, comprised * the handling of digital protocols is done by the 'rtx' module. + * + * The radio functionalities are controlled by means of an rtxStatus_t data + * structure containing all the parameters required to define a given operating + * configuration for the RF stage such as TX and RX frequencies, ... + * The data structure is internally accessed by each of the API functions and is + * guaranteed that the access is performed in read only mode. */ /** * Initialise low-level radio transceiver. + * + * @param rtxState: pointer to an rtxStatus_t structure used to describe the + * operating configuration of the radio module. */ void radio_init(const rtxStatus_t *rtxState); @@ -47,42 +56,57 @@ void radio_init(const rtxStatus_t *rtxState); void radio_terminate(); /** + * Set current operating mode. * + * @param mode: new operating mode. */ void radio_setOpmode(const enum opmode mode); /** + * Check if digital squelch is opened, that is if a CTC/DCS code is being + * detected. * + * @return true if RX digital squelch is enabled and if the configured CTC/DCS + * code is present alongside the carrier. */ bool radio_checkRxDigitalSquelch(); /** - * + * Enable the RX stage. */ void radio_enableRx(); /** - * + * Enable the TX stage. */ void radio_enableTx(); /** - * + * Disable both the RX and TX stages, as long as transmission of CTC/DCS code + * and digital squelch. */ void radio_disableRtx(); /** - * + * Update configuration of the radio module to match the one currently described + * by the rtxStatus_t configuration data structure. + * This function has to be called whenever the configuration data structure has + * been updated, to ensure all the operating parameters of the radio driver are + * correctly configured. */ void radio_updateConfiguration(); /** + * Get the current RSSI level in dBm. * + * @return RSSI level in dBm. */ float radio_getRssi(); /** + * Get the current operating status of the radio module. * + * @return current operating status. */ enum opstatus radio_getStatus(); diff --git a/platform/drivers/baseband/radio_GDx.c b/platform/drivers/baseband/radio_GDx.c deleted file mode 100644 index c90eb364..00000000 --- a/platform/drivers/baseband/radio_GDx.c +++ /dev/null @@ -1,316 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * Silvano Seva IU2KWO * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, see * - ***************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include "HR_C6000.h" -#include "AT1846S_wrapper.h" - -const gdxCalibration_t *calData; /* Pointer to calibration data */ - -int8_t currRxBand = -1; /* Current band for RX */ -int8_t currTxBand = -1; /* Current band for TX */ -uint8_t txpwr_lo = 0; /* APC voltage for TX output power control, low power */ -uint8_t txpwr_hi = 0; /* APC voltage for TX output power control, high power */ -tone_t tx_tone = 0; -tone_t rx_tone = 0; - -/** - * \internal - * Function to identify the current band (VHF or UHF), given an input frequency. - * - * @param freq frequency in Hz. - * @return 0 if the frequency is in the VHF band, - * 1 if the frequency is in the UHF band, - * -1 if the band to which the frequency belongs is neither VHF nor UHF. - */ -int8_t _getBandFromFrequency(freq_t freq) -{ - if((freq >= FREQ_LIMIT_VHF_LO) && (freq <= FREQ_LIMIT_VHF_HI)) return 0; - if((freq >= FREQ_LIMIT_UHF_LO) && (freq <= FREQ_LIMIT_UHF_HI)) return 1; - return -1; -} - -void radio_init() -{ - /* - * Load calibration data - */ - calData = ((const gdxCalibration_t *) platform_getCalibrationData()); - - /* - * Configure RTX GPIOs - */ - gpio_setMode(VHF_LNA_EN, OUTPUT); - gpio_setMode(UHF_LNA_EN, OUTPUT); - gpio_setMode(VHF_PA_EN, OUTPUT); - gpio_setMode(UHF_PA_EN, OUTPUT); - gpio_setMode(RX_AUDIO_MUX, OUTPUT); - gpio_setMode(TX_AUDIO_MUX, OUTPUT); - - - gpio_clearPin(VHF_LNA_EN); /* Turn VHF LNA off */ - gpio_clearPin(UHF_LNA_EN); /* Turn UHF LNA off */ - gpio_clearPin(VHF_PA_EN); /* Turn VHF PA off */ - gpio_clearPin(UHF_PA_EN); /* Turn UHF PA off */ - gpio_clearPin(RX_AUDIO_MUX); /* Audio out to HR_C6000 */ - gpio_clearPin(TX_AUDIO_MUX); /* Audio in to microphone */ - - /* - * Enable and configure DAC for PA drive control - */ - SIM->SCGC6 |= SIM_SCGC6_DAC0_MASK; - DAC0->DAT[0].DATL = 0; - DAC0->DAT[0].DATH = 0; - DAC0->C0 |= DAC_C0_DACRFS_MASK /* Reference voltage is Vref2 */ - | DAC_C0_DACEN_MASK; /* Enable DAC */ - - /* - * Enable and configure both AT1846S and HR_C6000 - */ - AT1846S_init(); - C6000_init(); -} - -void radio_terminate() -{ - radio_disableRtx(); - C6000_terminate(); -} - -void radio_setBandwidth(const enum bandwidth bw) -{ - switch(bw) - { - case BW_12_5: - AT1846S_setBandwidth(AT1846S_BW_12P5); - break; - - case BW_20: - case BW_25: - AT1846S_setBandwidth(AT1846S_BW_25); - break; - - default: - break; - } -} - -void radio_setOpmode(const enum opmode mode) -{ - switch(mode) - { - case FM: - gpio_setPin(RX_AUDIO_MUX); /* Audio out to amplifier */ - gpio_clearPin(TX_AUDIO_MUX); /* Audio in to microphone */ - AT1846S_setOpMode(AT1846S_OP_FM); - break; - - case DMR: - gpio_clearPin(RX_AUDIO_MUX); /* Audio out to HR_C6000 */ - gpio_setPin(TX_AUDIO_MUX); /* Audio in from HR_C6000 */ - AT1846S_setOpMode(AT1846S_OP_FM); - break; - - default: - break; - } -} - -void radio_setVcoFrequency(const freq_t frequency, const bool isTransmitting) -{ - (void) isTransmitting; - AT1846S_setFrequency(frequency); -} - -void radio_setCSS(const tone_t rxCss, const tone_t txCss) -{ - rx_tone = rxCss; - tx_tone = txCss; -} - -bool radio_checkRxDigitalSquelch() -{ - return true; -} - -void radio_enableRx() -{ - gpio_clearPin(VHF_LNA_EN); - gpio_clearPin(UHF_LNA_EN); - gpio_clearPin(VHF_PA_EN); - gpio_clearPin(UHF_PA_EN); - DAC0->DAT[0].DATH = 0; - DAC0->DAT[0].DATL = 0; - - if(currRxBand < 0) return; - - AT1846S_setFuncMode(AT1846S_RX); - - if(currRxBand == 0) - { - gpio_setPin(VHF_LNA_EN); - } - else - { - gpio_setPin(UHF_LNA_EN); - } -} - -void radio_enableTx(const float txPower, const bool enableCss) -{ - gpio_clearPin(VHF_LNA_EN); - gpio_clearPin(UHF_LNA_EN); - gpio_clearPin(VHF_PA_EN); - gpio_clearPin(UHF_PA_EN); - - if(currTxBand < 0) return; - - /* - * TODO: increase granularity - */ - uint16_t power = (txPower > 1.0f) ? txpwr_hi : txpwr_lo; - power *= 16; - DAC0->DAT[0].DATH = (power >> 8) & 0xFF; - DAC0->DAT[0].DATL = power & 0xFF; - - AT1846S_setFuncMode(AT1846S_TX); - - if(currTxBand == 0) - { - gpio_setPin(VHF_PA_EN); - } - else - { - gpio_setPin(UHF_PA_EN); - } - - if(enableCss) - { - AT1846S_enableTxCtcss(tx_tone); - } -} - -void radio_disableRtx() -{ - gpio_clearPin(VHF_LNA_EN); - gpio_clearPin(UHF_LNA_EN); - gpio_clearPin(VHF_PA_EN); - gpio_clearPin(UHF_PA_EN); - AT1846S_disableCtcss(); - AT1846S_setFuncMode(AT1846S_OFF); -} - -void radio_updateCalibrationParams(const rtxStatus_t *rtxCfg) -{ - currRxBand = _getBandFromFrequency(rtxCfg->rxFrequency); - currTxBand = _getBandFromFrequency(rtxCfg->txFrequency); - - if((currRxBand < 0) || (currTxBand < 0)) return; - - /* - * Parameters dependent on RX frequency - */ - const bandCalData_t *cal = &(calData->data[currRxBand]); - - AT1846S_setPgaGain(cal->PGA_gain); - AT1846S_setMicGain(cal->analogMicGain); - AT1846S_setAgcGain(cal->rxAGCgain); - AT1846S_setRxAudioGain(cal->rxAudioGainWideband, cal->rxAudioGainNarrowband); - AT1846S_setPaDrive(cal->PA_drv); - - if(rtxCfg->bandwidth == BW_12_5) - { - AT1846S_setTxDeviation(cal->mixGainNarrowband); - AT1846S_setNoise1Thresholds(cal->noise1_HighTsh_Nb, cal->noise1_LowTsh_Nb); - AT1846S_setNoise2Thresholds(cal->noise2_HighTsh_Nb, cal->noise2_LowTsh_Nb); - AT1846S_setRssiThresholds(cal->rssi_HighTsh_Nb, cal->rssi_LowTsh_Nb); - } - else - { - AT1846S_setTxDeviation(cal->mixGainWideband); - AT1846S_setNoise1Thresholds(cal->noise1_HighTsh_Wb, cal->noise1_LowTsh_Wb); - AT1846S_setNoise2Thresholds(cal->noise2_HighTsh_Wb, cal->noise2_LowTsh_Wb); - AT1846S_setRssiThresholds(cal->rssi_HighTsh_Wb, cal->rssi_LowTsh_Wb); - } - - C6000_setDacGain(cal->dacDataRange); - C6000_setMod2Bias(cal->mod2Offset); - C6000_setModOffset(cal->mod1Bias); - - uint8_t sqlTresh = 0; - if(currRxBand == 0) - { - sqlTresh = interpCalParameter(rtxCfg->rxFrequency, calData->vhfCalPoints, - cal->analogSqlThresh, 8); - } - else - { - sqlTresh = interpCalParameter(rtxCfg->rxFrequency, calData->uhfMod1CalPoints, - cal->analogSqlThresh, 8); - } - - AT1846S_setAnalogSqlThresh(sqlTresh); - - /* - * Parameters dependent on TX frequency - */ - uint8_t mod1Amp = 0; - - if(currTxBand == 0) - { - /* VHF band */ - txpwr_lo = interpCalParameter(rtxCfg->txFrequency, calData->vhfCalPoints, - calData->data[currTxBand].txLowPower, 8); - - txpwr_hi = interpCalParameter(rtxCfg->txFrequency, calData->vhfCalPoints, - calData->data[currTxBand].txHighPower, 8); - - mod1Amp = interpCalParameter(rtxCfg->txFrequency, calData->vhfCalPoints, - cal->mod1Amplitude, 8); - } - else - { - /* UHF band */ - txpwr_lo = interpCalParameter(rtxCfg->txFrequency, calData->uhfPwrCalPoints, - calData->data[currTxBand].txLowPower, 16); - - txpwr_hi = interpCalParameter(rtxCfg->txFrequency, calData->uhfPwrCalPoints, - calData->data[currTxBand].txHighPower, 16); - - mod1Amp = interpCalParameter(rtxCfg->txFrequency, calData->uhfMod1CalPoints, - cal->mod1Amplitude, 8); - } - - C6000_setModAmplitude(0, mod1Amp); -} - -float radio_getRssi(const freq_t rxFreq) -{ - (void) rxFreq; - - int16_t rssi = AT1846S_readRSSI(); - return ((float) rssi); -} diff --git a/platform/drivers/baseband/radio_MD3x0.cpp b/platform/drivers/baseband/radio_MD3x0.cpp index 9db2f070..bc1933cc 100644 --- a/platform/drivers/baseband/radio_MD3x0.cpp +++ b/platform/drivers/baseband/radio_MD3x0.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * + * Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, * * Niccolò Izzo IU2KIN * * Frederik Saraci IU2NRO * * Silvano Seva IU2KWO * diff --git a/platform/drivers/baseband/radio_MD9600.c b/platform/drivers/baseband/radio_MD9600.cpp similarity index 71% rename from platform/drivers/baseband/radio_MD9600.c rename to platform/drivers/baseband/radio_MD9600.cpp index 8eea6dbc..51376474 100644 --- a/platform/drivers/baseband/radio_MD9600.c +++ b/platform/drivers/baseband/radio_MD9600.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * + * Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, * * Niccolò Izzo IU2KIN * * Frederik Saraci IU2NRO * * Silvano Seva IU2KWO * @@ -19,19 +19,15 @@ ***************************************************************************/ #include -#include -void radio_init() +void radio_init(const rtxStatus_t *rtxState) { + (void) rtxState; } void radio_terminate() { -} -void radio_setBandwidth(const enum bandwidth bw) -{ - (void) bw; } void radio_setOpmode(const enum opmode mode) @@ -39,18 +35,6 @@ void radio_setOpmode(const enum opmode mode) (void) mode; } -void radio_setVcoFrequency(const freq_t frequency, const bool isTransmitting) -{ - (void) frequency; - (void) isTransmitting; -} - -void radio_setCSS(const tone_t rxCss, const tone_t txCss) -{ - (void) rxCss; - (void) txCss; -} - bool radio_checkRxDigitalSquelch() { return true; @@ -58,25 +42,30 @@ bool radio_checkRxDigitalSquelch() void radio_enableRx() { + } -void radio_enableTx(const float txPower, const bool enableCss) +void radio_enableTx() { - (void) txPower; - (void) enableCss; + } void radio_disableRtx() { + } -void radio_updateCalibrationParams(const rtxStatus_t* rtxCfg) +void radio_updateConfiguration() { - (void) rtxCfg; + } -float radio_getRssi(const freq_t rxFreq) +float radio_getRssi() { - (void) rxFreq; - return -100.0f; + return -154.0f; +} + +enum opstatus radio_getStatus() +{ + return OFF; } diff --git a/platform/drivers/baseband/radio_UV3x0.c b/platform/drivers/baseband/radio_UV3x0.c deleted file mode 100644 index b9d9e55f..00000000 --- a/platform/drivers/baseband/radio_UV3x0.c +++ /dev/null @@ -1,282 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * Silvano Seva IU2KWO * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, see * - ***************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "HR_C6000.h" -#include "AT1846S_wrapper.h" - -const mduv3x0Calib_t *calData; /* Pointer to calibration data */ - -int8_t currRxBand = -1; /* Current band for RX */ -int8_t currTxBand = -1; /* Current band for TX */ -uint8_t txpwr_lo = 0; /* APC voltage for TX output power control, low power */ -uint8_t txpwr_hi = 0; /* APC voltage for TX output power control, high power */ -tone_t tx_tone = 0; -tone_t rx_tone = 0; - -enum opmode currOpMode; /* Current operating mode, needed for TX control */ - -/** - * \internal - * Function to identify the current band (VHF or UHF), given an input frequency. - * - * @param freq frequency in Hz. - * @return 0 if the frequency is in the VHF band, - * 1 if the frequency is in the UHF band, - * -1 if the band to which the frequency belongs is neither VHF nor UHF. - */ -int8_t _getBandFromFrequency(freq_t freq) -{ - if((freq >= FREQ_LIMIT_VHF_LO) && (freq <= FREQ_LIMIT_VHF_HI)) return 0; - if((freq >= FREQ_LIMIT_UHF_LO) && (freq <= FREQ_LIMIT_UHF_HI)) return 1; - return -1; -} - -void radio_init() -{ - /* - * Load calibration data - */ - calData = ((const mduv3x0Calib_t *) platform_getCalibrationData()); - - /* - * Configure RTX GPIOs - */ - gpio_setMode(VHF_LNA_EN, OUTPUT); - gpio_setMode(UHF_LNA_EN, OUTPUT); - gpio_setMode(PA_EN_1, OUTPUT); - gpio_setMode(PA_EN_2, OUTPUT); - gpio_setMode(PA_SEL_SW, OUTPUT); - - gpio_clearPin(VHF_LNA_EN); - gpio_clearPin(UHF_LNA_EN); - gpio_clearPin(PA_EN_1); - gpio_clearPin(PA_EN_2); - gpio_clearPin(PA_SEL_SW); - - /* TODO: keep audio connected to HR_C6000, for volume control */ - gpio_setMode(RX_AUDIO_MUX, OUTPUT); - gpio_setPin(RX_AUDIO_MUX); - - /* - * Configure and enable DAC - */ - gpio_setMode(APC_REF, INPUT_ANALOG); - - RCC->APB1ENR |= RCC_APB1ENR_DACEN; - DAC->CR = DAC_CR_EN1; - DAC->DHR12R1 = 0; - - /* - * Configure AT1846S and HR_C6000 - */ - AT1846S_init(); - C6000_init(); -} - -void radio_terminate() -{ - radio_disableRtx(); - C6000_terminate(); -} - -void radio_setBandwidth(const enum bandwidth bw) -{ - switch(bw) - { - case BW_12_5: - AT1846S_setBandwidth(AT1846S_BW_12P5); - break; - - case BW_20: - case BW_25: - AT1846S_setBandwidth(AT1846S_BW_25); - break; - - default: - break; - } -} - -void radio_setOpmode(const enum opmode mode) -{ - currOpMode = mode; - switch(mode) - { - case FM: - AT1846S_setOpMode(AT1846S_OP_FM); - C6000_fmMode(); - break; - - case DMR: - AT1846S_setOpMode(AT1846S_OP_DMR); - C6000_dmrMode(); - break; - - default: - break; - } -} - -void radio_setVcoFrequency(const freq_t frequency, const bool isTransmitting) -{ - (void) isTransmitting; - AT1846S_setFrequency(frequency); -} - -void radio_setCSS(const tone_t rxCss, const tone_t txCss) -{ - rx_tone = rxCss; - tx_tone = txCss; -} - -bool radio_checkRxDigitalSquelch() -{ - return true; -} - -void radio_enableRx() -{ - gpio_clearPin(PA_EN_1); - gpio_clearPin(PA_EN_2); - gpio_clearPin(VHF_LNA_EN); - gpio_clearPin(UHF_LNA_EN); - DAC->DHR12R1 = 0; - - if(currRxBand < 0) return; - - AT1846S_setFuncMode(AT1846S_RX); - - if(currRxBand == 0) - { - gpio_setPin(VHF_LNA_EN); - } - else - { - gpio_setPin(UHF_LNA_EN); - } -} - -void radio_enableTx(const float txPower, const bool enableCss) -{ - gpio_clearPin(VHF_LNA_EN); - gpio_clearPin(UHF_LNA_EN); - gpio_clearPin(PA_EN_1); - gpio_clearPin(PA_EN_2); - - if(currTxBand < 0) return; - - /* - * TODO: increase granularity - */ - uint8_t power = (txPower > 1.0f) ? txpwr_hi : txpwr_lo; - DAC->DHR12L1 = power * 0xFF; - - if(currOpMode == FM) - { - C6000_startAnalogTx(); - } - - AT1846S_setFuncMode(AT1846S_TX); - - gpio_setPin(PA_EN_1); - - if(currTxBand == 0) - { - gpio_clearPin(PA_SEL_SW); - } - else - { - gpio_setPin(PA_SEL_SW); - } - - gpio_setPin(PA_EN_2); - - if(enableCss) - { - AT1846S_enableTxCtcss(tx_tone); - } -} - -void radio_disableRtx() -{ - gpio_clearPin(VHF_LNA_EN); - gpio_clearPin(UHF_LNA_EN); - gpio_clearPin(PA_EN_1); - gpio_clearPin(PA_EN_2); - DAC->DHR12L1 = 0; - AT1846S_disableCtcss(); - AT1846S_setFuncMode(AT1846S_OFF); - C6000_stopAnalogTx(); -} - -void radio_updateCalibrationParams(const rtxStatus_t *rtxCfg) -{ - currRxBand = _getBandFromFrequency(rtxCfg->rxFrequency); - currTxBand = _getBandFromFrequency(rtxCfg->txFrequency); - - if((currRxBand < 0) || (currTxBand < 0)) return; - - /* TCXO bias voltage */ - uint8_t modBias = calData->vhfCal.freqAdjustMid; - if(currRxBand > 0) modBias = calData->uhfCal.freqAdjustMid; - C6000_setModOffset(modBias); - - /* - * Discarding "const" qualifier to suppress compiler warnings. - * This operation is safe anyway because calibration data is only read. - */ - mduv3x0Calib_t *cal = ((mduv3x0Calib_t *) calData); - freq_t *txCalPoints = cal->vhfCal.txFreq; - uint8_t *loPwrCal = cal->vhfCal.txLowPower; - uint8_t *hiPwrCal = cal->vhfCal.txHighPower; - uint8_t *qRangeCal = (rtxCfg->opMode == FM) ? cal->vhfCal.analogSendQrange - : cal->vhfCal.sendQrange; - - if(currTxBand > 0) - { - txCalPoints = cal->uhfCal.txFreq; - loPwrCal = cal->uhfCal.txLowPower; - hiPwrCal = cal->uhfCal.txHighPower; - qRangeCal = (rtxCfg->opMode == FM) ? cal->uhfCal.analogSendQrange - : cal->uhfCal.sendQrange; - } - - /* APC voltage for TX output power control */ - txpwr_lo = interpCalParameter(rtxCfg->txFrequency, txCalPoints, loPwrCal, 9); - txpwr_hi = interpCalParameter(rtxCfg->txFrequency, txCalPoints, hiPwrCal, 9); - - /* HR_C6000 modulation amplitude */ - uint8_t Q = interpCalParameter(rtxCfg->txFrequency, txCalPoints, qRangeCal, 9); - C6000_setModAmplitude(0, Q); -} - -float radio_getRssi(const freq_t rxFreq) -{ - (void) rxFreq; - - int16_t rssi = AT1846S_readRSSI(); - return ((float) rssi); -} diff --git a/platform/drivers/baseband/radio_UV3x0.cpp b/platform/drivers/baseband/radio_UV3x0.cpp index 9a8c480a..9531e9fe 100644 --- a/platform/drivers/baseband/radio_UV3x0.cpp +++ b/platform/drivers/baseband/radio_UV3x0.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * + * Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, * * Niccolò Izzo IU2KIN * * Frederik Saraci IU2NRO * * Silvano Seva IU2KWO * diff --git a/platform/drivers/baseband/radio_linux.c b/platform/drivers/baseband/radio_linux.c deleted file mode 100644 index b0a7c77a..00000000 --- a/platform/drivers/baseband/radio_linux.c +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * Silvano Seva IU2KWO * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, see * - ***************************************************************************/ - -#include -#include - -void radio_init() -{ - puts("radio_linux: init() called"); -} - -void radio_terminate() -{ - puts("radio_linux: terminate() called"); -} - -void radio_setBandwidth(const enum bandwidth bw) -{ - - char *band = (bw == BW_12_5) ? "12.5" : - ((bw == BW_20) ? "20" : "25"); - - printf("radio_linux: setting bandwidth to %skHz\n", band); -} - -void radio_setOpmode(const enum opmode mode) -{ - char *mod = (mode == FM) ? "FM" : "DMR"; - printf("radio_linux: setting opmode to %s\n", mod); -} - -void radio_setVcoFrequency(const freq_t frequency, const bool isTransmitting) -{ - char *txrx = isTransmitting ? "RX" : "RX"; - printf("radio_linux: setting %s VCO frequency to %d\n", txrx, frequency); -} - -void radio_setCSS(const tone_t rxCss, const tone_t txCss) -{ - printf("radio_linux: setting CTCSS: RX to %.1f and TX to %.1f\n", - rxCss/10.0f, txCss/10.0f); -} - -bool radio_checkRxDigitalSquelch() -{ - puts("radio_linux: radio_checkRxDigitalSquelch(), returning 'true'"); - return true; -} - -void radio_enableRx() -{ - puts("radio_linux: enableRx() called"); -} - -void radio_enableTx(const float txPower, const bool enableCss) -{ - printf("radio_linux: enabling TX with output power of %.2fW and CTCSS %s\n", - txPower, enableCss ? "enabled" : "disabled"); -} - -void radio_disableRtx() -{ - puts("radio_linux: disableRtx() called"); -} - -void radio_updateCalibrationParams(const rtxStatus_t* rtxCfg) -{ - (void) rtxCfg; - puts("radio_linux: updateCalibrationParams() called"); -} - -float radio_getRssi(__attribute__((unused)) const freq_t rxFreq) -{ - // Commented to reduce verbosity on Linux - //printf("radio_linux: requested RSSI at freq %d, returning -100dBm\n", rxFreq); - return -100.0f; -}