diff --git a/platform/drivers/baseband/HR-C5000_MD3x0.c b/platform/drivers/baseband/HR-C5000_MD3x0.c index 0a1f709c..7d49d6d1 100644 --- a/platform/drivers/baseband/HR-C5000_MD3x0.c +++ b/platform/drivers/baseband/HR-C5000_MD3x0.c @@ -131,7 +131,7 @@ void C5000_setModOffset(uint8_t offset) * Original TYT MD-380 code does this, both for DMR and FM. */ uint8_t offUpper = (offset < 0x80) ? 0x00 : 0x03; - uint8_t offLower = offset - 0x7F; + uint8_t offLower = 0x7F - offset; _writeReg(0x00, 0x48, offUpper); // Two-point bias, upper value _writeReg(0x00, 0x47, offLower); // Two-point bias, lower value diff --git a/tests/platform/MD380_FM_receiver.c b/tests/platform/MD380_FM_receiver.c deleted file mode 100644 index 2c521656..00000000 --- a/tests/platform/MD380_FM_receiver.c +++ /dev/null @@ -1,70 +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 "gpio.h" -#include "delays.h" -#include "rtx.h" -#include "ADC1_MDxx380.h" -#include "graphics.h" -#include "platform.h" -#include "hwconfig.h" - -int main(void) -{ - platform_init(); - - gpio_setMode(SPK_MUTE, OUTPUT); - gpio_setMode(AMP_EN, OUTPUT); - gpio_setMode(FM_MUTE, OUTPUT); - - gpio_setPin(AMP_EN); /* Turn on audio amplifier */ - gpio_setPin(FM_MUTE); /* Unmute path from AF_out to amplifier */ - gpio_clearPin(SPK_MUTE); /* Unmute speaker */ - - rtx_init(); - rtx_setRxFreq(430100000.0f); - rtx_setBandwidth(BW_25); - rtx_setOpmode(FM); - rtx_setFuncmode(RX); - - gfx_init(); - platform_setBacklightLevel(255); - - color_t white = {255, 255, 255}; - point_t origin = {0, SCREEN_HEIGHT / 9}; - char buf[30] = {0}; - - while (1) - { - snprintf(sizeof(buf), buf, "RSSI level %f\n", rtx_getRssi()); - gfx_clearScreen(); - gfx_print(origin, buf, FONT_SIZE_3, TEXT_ALIGN_CENTER, white); - gfx_render(); - while (gfx_renderingInProgress()); - OS_ERR err; - OSTimeDlyHMSM(0u, 0u, 0u, 500u, OS_OPT_TIME_HMSM_STRICT, &err); - } - - return 0; -} diff --git a/tests/platform/MD380_FM_transmitter.c b/tests/platform/MD380_FM_simpleRtx.c similarity index 91% rename from tests/platform/MD380_FM_transmitter.c rename to tests/platform/MD380_FM_simpleRtx.c index 99a8e171..4ab0eb7c 100644 --- a/tests/platform/MD380_FM_transmitter.c +++ b/tests/platform/MD380_FM_simpleRtx.c @@ -25,7 +25,6 @@ #include "gpio.h" #include "delays.h" #include "rtx.h" -#include "ADC1_MDxx380.h" #include "platform.h" #include "hwconfig.h" #include "HR-C5000_MD3x0.h" @@ -47,19 +46,22 @@ int main(void) rtx_init(); rtx_setTxFreq(430100000.0f); + rtx_setRxFreq(430100000.0f); rtx_setBandwidth(BW_25); rtx_setOpmode(FM); - rtx_setFuncmode(OFF); + rtx_setFuncmode(RX); gpio_setMode(GPIOA, 14, OUTPUT); /* Micpwr_sw */ gpio_setPin(GPIOA, 14); bool txActive = false; + uint8_t count = 0; while (1) { if(platform_getPttStatus() && (txActive == false)) { + rtx_setFuncmode(OFF); rtx_setFuncmode(TX); C5000_startAnalogTx(); platform_ledOn(RED); @@ -71,9 +73,17 @@ int main(void) rtx_setFuncmode(OFF); C5000_stopAnalogTx(); platform_ledOff(RED); + rtx_setFuncmode(RX); txActive = false; } + count++; + if(count == 50) + { + printf("RSSI: %f\r\n", rtx_getRssi()); + count = 0; + } + OS_ERR err; OSTimeDlyHMSM(0u, 0u, 0u, 10u, OS_OPT_TIME_HMSM_STRICT, &err); }